Commit 1995a40a authored by Simon Spannagel's avatar Simon Spannagel
Browse files

MakeModule: allow no input message (empty input)

parent bc00a479
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ read -p "Input message type? " MESSAGETYPE
# Check that message type exists
OBJDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )"
OBJDIR=$OBJDIR/../../src/objects
if [ ! -e ${OBJDIR}/${MESSAGETYPE}.hpp ]
if [ ! -z "${MESSAGETYPE}"] && [ ! -e ${OBJDIR}/${MESSAGETYPE}.hpp ]
then
  echo -e "\nMessage type ${MESSAGETYPE} does not exist. \nPlease see the message types in ${OBJDIR}\n"
  exit 1
@@ -139,10 +139,16 @@ if [ "$sequence" = 1 ]; then
  eval $command
fi

if [ ! -z "${MESSAGETYPE}"]; then
  # Replace the corresponding message type in the header and source file
  command="sed ${opt} \
  -e 's/PixelHit/${MESSAGETYPE}/g' \
  $MODDIR/$MODNAME/${MODNAME}Module.*pp"
else
  command="sed ${opt} \
  -e '/PixelHit/g' \
  $MODDIR/$MODNAME/${MODNAME}Module.*pp"
fi
eval $command

# Print a summary of the module created:
@@ -151,7 +157,9 @@ echo "Name: $MODNAME"
echo "Description: $MODDESC"
echo "Author:      $MYNAME ($MYMAIL)"
echo "Path:        $FINALPATH"
if [ ! -z "${MESSAGETYPE}"]; then
  echo "This module listens to \"$MESSAGETYPE\" messages from" $([ "$type" = 2 ] && echo "one detector" || echo "all detectors")
fi
if [ "$sequence" = 1 ]; then
  echo "This module requires sequential processing of events in multithreaded environments."
fi