46 |
/*! @brief Constructor. |
/*! @brief Constructor. |
47 |
* |
* |
48 |
* @param collectionName The collection's name. |
* @param collectionName The collection's name. |
49 |
|
* @param owns If true, the collection will own the cuts and the actions, ie., it will |
50 |
|
* destroy them in its destructor. |
51 |
*/ |
*/ |
52 |
SmartCollection(const char* collectionName) : |
SmartCollection(const char* collectionName, bool owns = true) : |
53 |
PamCutCollection(collectionName), _actions(0) { |
PamCutCollection(collectionName, owns), _actions(0) { |
54 |
} |
} |
55 |
|
|
56 |
/*! @brief Destructor. */ |
/*! @brief Destructor. */ |
57 |
~SmartCollection() { |
~SmartCollection(); |
|
} |
|
58 |
|
|
59 |
/*! @brief Adds an action to the SmartCollection */ |
/*! @brief Adds an action to the SmartCollection */ |
60 |
virtual void AddAction(CollectionAction& action); |
virtual void AddAction(CollectionAction *action); |
61 |
|
|
62 |
/*! @brief Returns the iAction-th action. |
/*! @brief Returns the iAction-th action. |
63 |
* |
* |
67 |
*/ |
*/ |
68 |
CollectionAction *GetAction(unsigned int iAction); |
CollectionAction *GetAction(unsigned int iAction); |
69 |
|
|
70 |
|
/*! @brief Searches for an action by name. |
71 |
|
* |
72 |
|
* @param actionName The name of the action to search for. |
73 |
|
* @return pointer to the desired action; NULL if the specified action cannot be found or if no actions are present. |
74 |
|
*/ |
75 |
|
CollectionAction *GetAction(const char *actionName); |
76 |
|
|
77 |
|
/*! @brief The number of actions in the collection. |
78 |
|
* |
79 |
|
* @return The number of actions currently in the collection. |
80 |
|
*/ |
81 |
|
unsigned int GetActionsSize() { |
82 |
|
return _actions.size(); |
83 |
|
} |
84 |
|
|
85 |
|
/*! @brief The position of specified action. |
86 |
|
* |
87 |
|
* This method returns the position of the iAction-th action. For every action |
88 |
|
* placed before the first cut this will return -1. Otherwise it will return the index |
89 |
|
* of the cut preceding the action (eg., if action number 3 is after cut number 2, GetActionPosition(3) |
90 |
|
* will return 2) |
91 |
|
* |
92 |
|
* @param iAction The index of the action (0 = first action) |
93 |
|
* @return The position of the specified action |
94 |
|
*/ |
95 |
|
int GetActionPosition(unsigned int iAction) { |
96 |
|
return _actionsPositions[iAction]; |
97 |
|
} |
98 |
|
|
99 |
/*! @brief The pre-analysis task definition. |
/*! @brief The pre-analysis task definition. |
100 |
* |
* |
101 |
* This override of the Setup() method calls Setup() for the base class PamCutCollection, and subsequently for each |
* This override of the Setup() method calls Setup() for the base class PamCutCollection, and subsequently for each |
123 |
|
|
124 |
protected: |
protected: |
125 |
|
|
126 |
|
/*! @brief The vector containing the actions */ |
127 |
std::vector<CollectionAction*> _actions; |
std::vector<CollectionAction*> _actions; |
128 |
std::vector<unsigned int> _actionsPositions; |
|
129 |
|
/*! The vector of actions' positions |
130 |
|
* |
131 |
|
* An action is placed after N cuts, so that the SmartCollection, after applying N cuts, has to |
132 |
|
* perform the action. The numbers N for each action are stored here: the element i is N for the |
133 |
|
* i-th action in #_actions. |
134 |
|
*/ |
135 |
|
std::vector<int> _actionsPositions; |
136 |
|
|
137 |
}; |
}; |
138 |
|
|