ROOT logo
//-*- Mode: C++ -*-
// $Id$
#ifndef ALIHLTTRIGGERMENUSYMBOL_H
#define ALIHLTTRIGGERMENUSYMBOL_H
/* This file is property of and copyright by the ALICE HLT Project        *
 * ALICE Experiment at CERN, All rights reserved.                         *
 * See cxx source for full Copyright notice                               */

/// @file   AliHLTTriggerMenuSymbol.h
/// @author Artur Szostak <artursz@iafrica.com>
/// @date   28 Dec 2008
/// @brief  Declaration of the AliHLTTriggerMenuSymbol class.

#include "TObject.h"
#include "TString.h"
#include "AliHLTDataTypes.h"
#include "AliHLTDomainEntry.h"

/**
 * \class AliHLTTriggerMenuSymbol
 * The trigger menu symbol is used to either label a TObject variable found in
 * one of the input data blocks or create a constant object that can be used in
 * various trigger menu expressions.
 * It essentially represents a C++ variable with a name and type. This is filled
 * with the information found in an input TObject, as specified by the
 * <i>AssignExpression()</i> method. If nothing can be assigned because an
 * appropriate TObject cannot be found, then a default value is used.
 * The correct TObject is found by searching for a TObject with a matching class
 * type as given by <i>ObjectClass()</i> from the input data blocks. The input
 * data block must also have the data block type and specification match those
 * given in the <i>BlockType()</i> method.
 *
 * The symbol name should normally be a valid C++ symbol name. This normally
 * excludes the minus sign from being used in the name. However, since CTP trigger
 * names use the minus sign extensively, the minus sign is also allowed in HLT
 * trigger menu symbol names. This is implicitly converted to an underscore in the
 * name. However, the original name with minus signs is retained and available
 * with the <i>RealName()</i> method. In addition, the <i>RealName</i> is used
 * for display purposes.
 * \note Trigger menu symbols names that use minus signs are synonymous to those
 * that use understores in the same locations. For this reason it is better to use
 * one or the other form, but not both at the same time.
 * \note The following symbol names are reserved and should not be used:
 *   _domain_
 *   _description_
 *   _item_result_
 *   _group_result_
 *   _previous_match_
 *   _trigger_matched_
 *   FillFromMenu
 *   NewEvent
 *   Add
 *   CalculateTriggerDecision
 *   GetCounters
 *   SetCounters
 *   CreateNew
 */
class AliHLTTriggerMenuSymbol : public TObject
{
 public:
  
  /**
   * Default constructor.
   */
  AliHLTTriggerMenuSymbol();
  
  /**
   * Default destructor.
   */
  virtual ~AliHLTTriggerMenuSymbol();
  
  /**
   * Inherited from TObject, this prints the contents of the symbol.
   * \param option  Can be "compact", which will print in the compact format.
   */
  virtual void Print(Option_t* option = "") const;
  
  /**
   * Returns the real name which can differ from the symbol name
   * by '-' characters instead of '_'. This approach has been introduced
   * to allow trigger and item names containing '-' characters and thus
   * violating the C++ naming conventions.
   */
  const char* RealName() const;
  
  /**
   * Returns the valid C++ symbol name.
   */
  const char* Name() const { return fName.Data(); }

  /**
   * Set the symbol name. It can contain '-' characters.
   */
  void Name(const char* value);
  
  /**
   * Returns the symbol data type.
   */
  const char* Type() const { return fType.Data(); }
  
  /**
   * Set the symbol data type.
   */
  void Type(const char* value) { fType = value; }
  
  /**
   * Returns the data block type and specification from which the symbol is fetched.
   */
  const AliHLTDomainEntry& BlockType() const { return fBlockType; }
  
  /**
   * Set the data block type and specification from which the symbol is fetched.
   * \param type  The data block type and origin to use.
   */
  void BlockType(const AliHLTComponentDataType& type)
  {
    fBlockType = AliHLTDomainEntry(type);
  }
  
  /**
   * Set the data block type and specification from which the symbol is fetched.
   * \param blocktype  The data block type string of the data block. The value
   *    kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
   * \param origin  The origin of the data block, such as the detector name.
   *    The value kAliHLTDataOriginAny can be used to specify the any origin
   *    wild card value.
   */
  void BlockType(const char* blocktype, const char* origin)
  {
    fBlockType = AliHLTDomainEntry(blocktype, origin);
  }
  
  /**
   * Set the data block type and specification from which the symbol is fetched.
   * \param type  The data block type and origin to use.
   * \param spec  The data block specification to use.
   */
  void BlockType(const AliHLTComponentDataType& type, UInt_t spec)
  {
    fBlockType = AliHLTDomainEntry(type, spec);
  }
  
  /**
   * Set the data block type and specification from which the symbol is fetched.
   * \param blocktype  The data block type string of the data block. The value
   *    kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
   * \param origin  The origin of the data block, such as the detector name.
   *    The value kAliHLTDataOriginAny can be used to specify the any origin
   *    wild card value.
   * \param spec  The data block specification to use.
   */
  void BlockType(const char* blocktype, const char* origin, UInt_t spec)
  {
    fBlockType = AliHLTDomainEntry(blocktype, origin, spec);
  }
  
  /**
   * Returns the class name of the object in the data block.
   */
  const char* ObjectClass() const { return fClass.Data(); }
  
  /**
   * Set the class name of the object in the data block.
   */
  void ObjectClass(const char* value) { fClass = value; }
  
  /**
   * Returns the expression to assign the symbol value.
   */
  const char* AssignExpression() const { return fAssignExpr.Data(); }
  
  /**
   * Set the expression to assign the symbol value.
   * The keyword 'this' is used as the place holder of the object in the matched
   * data block. For example if we want to get a public attribute names xyz from
   * the object to assign to the symbol we would write the assignment expression
   * as "this->xyz".
   */
  void AssignExpression(const char* value) { fAssignExpr = value; }
  
  /**
   * Returns the default value expression.
   */
  const char* DefaultValue() const { return fDefaultValue.Data(); }
  
  /**
   * Set the default value expression.
   */
  void DefaultValue(const char* value) { fDefaultValue = value; }

 private:
  
  TString fName;  /// The name of the symbol (Must be a valid C++ variable name but can contain the '-' character as an extention).
  TString fType;  /// The data type of the symbol (Must be a valid C++ type name).
  AliHLTDomainEntry fBlockType;  /// The data block type and specification this symbol is fetched from.
  TString fClass;  /// The class name of the object to read from (Must be a valid C++ class name).
  TString fAssignExpr;  /// The expression to assign to the symbol (Must be a valid C++ expression).
  TString fDefaultValue;  /// The default value this symbol is set to (this must be a valid C++ expression).
  TString fRealName; /// The name of the symbol, differs from fName by replaced '-' chars.
  
  ClassDef(AliHLTTriggerMenuSymbol, 4) // Trigger menu item for global HLT trigger.
};

#endif // ALIHLTTRIGGERMENUSYMBOL_H

 AliHLTTriggerMenuSymbol.h:1
 AliHLTTriggerMenuSymbol.h:2
 AliHLTTriggerMenuSymbol.h:3
 AliHLTTriggerMenuSymbol.h:4
 AliHLTTriggerMenuSymbol.h:5
 AliHLTTriggerMenuSymbol.h:6
 AliHLTTriggerMenuSymbol.h:7
 AliHLTTriggerMenuSymbol.h:8
 AliHLTTriggerMenuSymbol.h:9
 AliHLTTriggerMenuSymbol.h:10
 AliHLTTriggerMenuSymbol.h:11
 AliHLTTriggerMenuSymbol.h:12
 AliHLTTriggerMenuSymbol.h:13
 AliHLTTriggerMenuSymbol.h:14
 AliHLTTriggerMenuSymbol.h:15
 AliHLTTriggerMenuSymbol.h:16
 AliHLTTriggerMenuSymbol.h:17
 AliHLTTriggerMenuSymbol.h:18
 AliHLTTriggerMenuSymbol.h:19
 AliHLTTriggerMenuSymbol.h:20
 AliHLTTriggerMenuSymbol.h:21
 AliHLTTriggerMenuSymbol.h:22
 AliHLTTriggerMenuSymbol.h:23
 AliHLTTriggerMenuSymbol.h:24
 AliHLTTriggerMenuSymbol.h:25
 AliHLTTriggerMenuSymbol.h:26
 AliHLTTriggerMenuSymbol.h:27
 AliHLTTriggerMenuSymbol.h:28
 AliHLTTriggerMenuSymbol.h:29
 AliHLTTriggerMenuSymbol.h:30
 AliHLTTriggerMenuSymbol.h:31
 AliHLTTriggerMenuSymbol.h:32
 AliHLTTriggerMenuSymbol.h:33
 AliHLTTriggerMenuSymbol.h:34
 AliHLTTriggerMenuSymbol.h:35
 AliHLTTriggerMenuSymbol.h:36
 AliHLTTriggerMenuSymbol.h:37
 AliHLTTriggerMenuSymbol.h:38
 AliHLTTriggerMenuSymbol.h:39
 AliHLTTriggerMenuSymbol.h:40
 AliHLTTriggerMenuSymbol.h:41
 AliHLTTriggerMenuSymbol.h:42
 AliHLTTriggerMenuSymbol.h:43
 AliHLTTriggerMenuSymbol.h:44
 AliHLTTriggerMenuSymbol.h:45
 AliHLTTriggerMenuSymbol.h:46
 AliHLTTriggerMenuSymbol.h:47
 AliHLTTriggerMenuSymbol.h:48
 AliHLTTriggerMenuSymbol.h:49
 AliHLTTriggerMenuSymbol.h:50
 AliHLTTriggerMenuSymbol.h:51
 AliHLTTriggerMenuSymbol.h:52
 AliHLTTriggerMenuSymbol.h:53
 AliHLTTriggerMenuSymbol.h:54
 AliHLTTriggerMenuSymbol.h:55
 AliHLTTriggerMenuSymbol.h:56
 AliHLTTriggerMenuSymbol.h:57
 AliHLTTriggerMenuSymbol.h:58
 AliHLTTriggerMenuSymbol.h:59
 AliHLTTriggerMenuSymbol.h:60
 AliHLTTriggerMenuSymbol.h:61
 AliHLTTriggerMenuSymbol.h:62
 AliHLTTriggerMenuSymbol.h:63
 AliHLTTriggerMenuSymbol.h:64
 AliHLTTriggerMenuSymbol.h:65
 AliHLTTriggerMenuSymbol.h:66
 AliHLTTriggerMenuSymbol.h:67
 AliHLTTriggerMenuSymbol.h:68
 AliHLTTriggerMenuSymbol.h:69
 AliHLTTriggerMenuSymbol.h:70
 AliHLTTriggerMenuSymbol.h:71
 AliHLTTriggerMenuSymbol.h:72
 AliHLTTriggerMenuSymbol.h:73
 AliHLTTriggerMenuSymbol.h:74
 AliHLTTriggerMenuSymbol.h:75
 AliHLTTriggerMenuSymbol.h:76
 AliHLTTriggerMenuSymbol.h:77
 AliHLTTriggerMenuSymbol.h:78
 AliHLTTriggerMenuSymbol.h:79
 AliHLTTriggerMenuSymbol.h:80
 AliHLTTriggerMenuSymbol.h:81
 AliHLTTriggerMenuSymbol.h:82
 AliHLTTriggerMenuSymbol.h:83
 AliHLTTriggerMenuSymbol.h:84
 AliHLTTriggerMenuSymbol.h:85
 AliHLTTriggerMenuSymbol.h:86
 AliHLTTriggerMenuSymbol.h:87
 AliHLTTriggerMenuSymbol.h:88
 AliHLTTriggerMenuSymbol.h:89
 AliHLTTriggerMenuSymbol.h:90
 AliHLTTriggerMenuSymbol.h:91
 AliHLTTriggerMenuSymbol.h:92
 AliHLTTriggerMenuSymbol.h:93
 AliHLTTriggerMenuSymbol.h:94
 AliHLTTriggerMenuSymbol.h:95
 AliHLTTriggerMenuSymbol.h:96
 AliHLTTriggerMenuSymbol.h:97
 AliHLTTriggerMenuSymbol.h:98
 AliHLTTriggerMenuSymbol.h:99
 AliHLTTriggerMenuSymbol.h:100
 AliHLTTriggerMenuSymbol.h:101
 AliHLTTriggerMenuSymbol.h:102
 AliHLTTriggerMenuSymbol.h:103
 AliHLTTriggerMenuSymbol.h:104
 AliHLTTriggerMenuSymbol.h:105
 AliHLTTriggerMenuSymbol.h:106
 AliHLTTriggerMenuSymbol.h:107
 AliHLTTriggerMenuSymbol.h:108
 AliHLTTriggerMenuSymbol.h:109
 AliHLTTriggerMenuSymbol.h:110
 AliHLTTriggerMenuSymbol.h:111
 AliHLTTriggerMenuSymbol.h:112
 AliHLTTriggerMenuSymbol.h:113
 AliHLTTriggerMenuSymbol.h:114
 AliHLTTriggerMenuSymbol.h:115
 AliHLTTriggerMenuSymbol.h:116
 AliHLTTriggerMenuSymbol.h:117
 AliHLTTriggerMenuSymbol.h:118
 AliHLTTriggerMenuSymbol.h:119
 AliHLTTriggerMenuSymbol.h:120
 AliHLTTriggerMenuSymbol.h:121
 AliHLTTriggerMenuSymbol.h:122
 AliHLTTriggerMenuSymbol.h:123
 AliHLTTriggerMenuSymbol.h:124
 AliHLTTriggerMenuSymbol.h:125
 AliHLTTriggerMenuSymbol.h:126
 AliHLTTriggerMenuSymbol.h:127
 AliHLTTriggerMenuSymbol.h:128
 AliHLTTriggerMenuSymbol.h:129
 AliHLTTriggerMenuSymbol.h:130
 AliHLTTriggerMenuSymbol.h:131
 AliHLTTriggerMenuSymbol.h:132
 AliHLTTriggerMenuSymbol.h:133
 AliHLTTriggerMenuSymbol.h:134
 AliHLTTriggerMenuSymbol.h:135
 AliHLTTriggerMenuSymbol.h:136
 AliHLTTriggerMenuSymbol.h:137
 AliHLTTriggerMenuSymbol.h:138
 AliHLTTriggerMenuSymbol.h:139
 AliHLTTriggerMenuSymbol.h:140
 AliHLTTriggerMenuSymbol.h:141
 AliHLTTriggerMenuSymbol.h:142
 AliHLTTriggerMenuSymbol.h:143
 AliHLTTriggerMenuSymbol.h:144
 AliHLTTriggerMenuSymbol.h:145
 AliHLTTriggerMenuSymbol.h:146
 AliHLTTriggerMenuSymbol.h:147
 AliHLTTriggerMenuSymbol.h:148
 AliHLTTriggerMenuSymbol.h:149
 AliHLTTriggerMenuSymbol.h:150
 AliHLTTriggerMenuSymbol.h:151
 AliHLTTriggerMenuSymbol.h:152
 AliHLTTriggerMenuSymbol.h:153
 AliHLTTriggerMenuSymbol.h:154
 AliHLTTriggerMenuSymbol.h:155
 AliHLTTriggerMenuSymbol.h:156
 AliHLTTriggerMenuSymbol.h:157
 AliHLTTriggerMenuSymbol.h:158
 AliHLTTriggerMenuSymbol.h:159
 AliHLTTriggerMenuSymbol.h:160
 AliHLTTriggerMenuSymbol.h:161
 AliHLTTriggerMenuSymbol.h:162
 AliHLTTriggerMenuSymbol.h:163
 AliHLTTriggerMenuSymbol.h:164
 AliHLTTriggerMenuSymbol.h:165
 AliHLTTriggerMenuSymbol.h:166
 AliHLTTriggerMenuSymbol.h:167
 AliHLTTriggerMenuSymbol.h:168
 AliHLTTriggerMenuSymbol.h:169
 AliHLTTriggerMenuSymbol.h:170
 AliHLTTriggerMenuSymbol.h:171
 AliHLTTriggerMenuSymbol.h:172
 AliHLTTriggerMenuSymbol.h:173
 AliHLTTriggerMenuSymbol.h:174
 AliHLTTriggerMenuSymbol.h:175
 AliHLTTriggerMenuSymbol.h:176
 AliHLTTriggerMenuSymbol.h:177
 AliHLTTriggerMenuSymbol.h:178
 AliHLTTriggerMenuSymbol.h:179
 AliHLTTriggerMenuSymbol.h:180
 AliHLTTriggerMenuSymbol.h:181
 AliHLTTriggerMenuSymbol.h:182
 AliHLTTriggerMenuSymbol.h:183
 AliHLTTriggerMenuSymbol.h:184
 AliHLTTriggerMenuSymbol.h:185
 AliHLTTriggerMenuSymbol.h:186
 AliHLTTriggerMenuSymbol.h:187
 AliHLTTriggerMenuSymbol.h:188
 AliHLTTriggerMenuSymbol.h:189
 AliHLTTriggerMenuSymbol.h:190
 AliHLTTriggerMenuSymbol.h:191
 AliHLTTriggerMenuSymbol.h:192
 AliHLTTriggerMenuSymbol.h:193
 AliHLTTriggerMenuSymbol.h:194
 AliHLTTriggerMenuSymbol.h:195
 AliHLTTriggerMenuSymbol.h:196
 AliHLTTriggerMenuSymbol.h:197
 AliHLTTriggerMenuSymbol.h:198
 AliHLTTriggerMenuSymbol.h:199
 AliHLTTriggerMenuSymbol.h:200
 AliHLTTriggerMenuSymbol.h:201
 AliHLTTriggerMenuSymbol.h:202
 AliHLTTriggerMenuSymbol.h:203
 AliHLTTriggerMenuSymbol.h:204
 AliHLTTriggerMenuSymbol.h:205