Changeset 860 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 07/09/01 16:13:19 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MParList.cc
r858 r860 57 57 { 58 58 *fName = name ? name : "MParList"; 59 *fTitle = title ? title : " List of Parameter Containers";59 *fTitle = title ? title : "A list of Parameter Containers"; 60 60 61 61 // … … 100 100 // If 'where' is given, the object will be added after this. 101 101 // 102 Bool_t MParList::AddToList(MParContainer * obj, MParContainer *where)102 Bool_t MParList::AddToList(MParContainer *cont, MParContainer *where) 103 103 { 104 104 // … … 106 106 // 107 107 108 if (!obj) return kTRUE; 109 110 *fLog << "Adding " << obj->GetName() << " to " << GetName() << "... " << flush; 111 // 112 // check if it is in the list yet 113 // 114 if (fContainer.FindObject(obj)) 108 if (!cont) 109 return kFALSE; 110 111 // 112 // Get Name of new container 113 // 114 const char *name = cont->GetName(); 115 116 // 117 // Check if the new container is already existing in the list 118 // 119 const TObject *objn = fContainer.FindObject(name); 120 const TObject *objt = fContainer.FindObject(cont); 121 122 if (objn || objt) 115 123 { 116 *fLog << dbginf << "Container already added" << endl; 117 return kTRUE; 124 // 125 // If the container is already in the list ignore it. 126 // 127 if (objt || objn==cont) 128 { 129 *fLog << dbginf << "Warning: Container '" << cont->GetName() << ", 0x" << (void*)cont; 130 *fLog << "' already existing in '" << GetName() << "'... ignoring." << endl; 131 return kTRUE; 132 } 133 134 // 135 // Otherwise add it to the list, but print a warning message 136 // 137 *fLog << dbginf << "Warning: Container with the same name '" << cont->GetName(); 138 *fLog << "' already existing in '" << GetName() << "'." << endl; 139 *fLog << "You may not be able to get a pointer to container task by name." << endl; 118 140 } 119 141 120 142 // 121 143 // check if you want to add the new parameter container somewhere 122 // special (in that case you specify "where")144 // special (in that case you specify "where") 123 145 // 124 146 if (where) … … 126 148 if (!fContainer.FindObject(where)) 127 149 { 128 *fLog << dbginf << " Cannot find parameter container after which the new one should be added!" << endl;150 *fLog << dbginf << "Error: Cannot find parameter container after which the new one should be added!" << endl; 129 151 return kFALSE; 130 152 } 131 153 } 132 154 133 fContainer.Add(obj); 155 *fLog << "Adding " << name << " to " << GetName() << "... " << flush; 156 157 fContainer.Add(cont); 134 158 *fLog << "Done." << endl; 135 159 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r858 r860 27 27 // MTaskList // 28 28 // // 29 // Collection of tasks to be processed in the eventloop // 29 // Collection of tasks. // 30 // // 31 // A tasklist is necessary to run the eventloop. It contains the scheduled // 32 // tasks, which should be executed in your program. // 33 // // 34 // To add a task use AddToList. // 35 // // 36 // The tasklist itself is a task, too. You can add a tasklist to another // 37 // tasklist. This makes sense, if you want to filter the execution of // 38 // more than one task of your tasklist using the same filter. // 39 // // 40 // The tasks in the list are idetified by their names. If more than one // 41 // task has the same name, the tasklist will still work correctly, but // 42 // you might run into trouble trying to get a pointer to a task by name // 43 // from the list. // 30 44 // // 31 45 ///////////////////////////////////////////////////////////////////////////// … … 47 61 // this name in the parameter list (by MEvtLoop::SetParList) 48 62 // 49 MTaskList::MTaskList(const char * title)50 { 51 *fName = "MTaskList";52 *fTitle = title ? title : " List for Tasks";63 MTaskList::MTaskList(const char *name, const char *title) 64 { 65 *fName = name ? name : "MTaskList"; 66 *fTitle = title ? title : "A list for tasks to be executed"; 53 67 } 54 68 … … 95 109 Bool_t MTaskList::AddToList(MTask *task, const char *type, MTask *where) 96 110 { 111 // FIXME: We agreed to put the task into list in an ordered way. 112 113 // 114 // Sanity check 115 // 97 116 if (!task) 98 return kTRUE; 99 117 return kFALSE; 118 119 // 120 // Get Name of new task 121 // 100 122 const char *name = task->GetName(); 101 123 102 // FIXME: We agreed to put the task into list in an ordered way. 103 104 if (fTasks.FindObject(task)) 105 { 106 *fLog << dbginf << "Task already existing." << endl; 107 return kTRUE; 108 } 109 110 if (fTasks.FindObject(name)) 111 { 112 *fLog << dbginf << "'" << name << "' exists in List already." << endl; 113 return kTRUE; 124 // 125 // Check if the new task is already existing in the list 126 // 127 const TObject *objn = fTasks.FindObject(name); 128 const TObject *objt = fTasks.FindObject(task); 129 130 if (objn || objt) 131 { 132 // 133 // If the task is already in the list ignore it. 134 // 135 if (objt || objn==task) 136 { 137 *fLog << dbginf << "Warning: Task '" << task->GetName() << ", 0x" << (void*)task; 138 *fLog << "' already existing in '" << GetName() << "'... ignoring." << endl; 139 return kTRUE; 140 } 141 142 // 143 // Otherwise add it to the list, but print a warning message 144 // 145 *fLog << dbginf << "Warning: Task with the same name '" << task->GetName(); 146 *fLog << "' already existing in '" << GetName() << "'." << endl; 147 *fLog << "You may not be able to get a pointer to this task by name." << endl; 114 148 } 115 149 … … 118 152 if (!fTasks.FindObject(where)) 119 153 { 120 *fLog << dbginf << " Cannot find task after which the new task should be scheduled!" << endl;154 *fLog << dbginf << "Error: Cannot find task after which the new task should be scheduled!" << endl; 121 155 return kFALSE; 122 156 } -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r858 r860 28 28 29 29 public: 30 MTaskList(const char * title=NULL);30 MTaskList(const char *name=NULL, const char *title=NULL); 31 31 32 32 MTaskList(MTaskList &ts);
Note:
See TracChangeset
for help on using the changeset viewer.