00001 /* 00002 GNU GENERAL PUBLIC LICENSE 00003 Version 2, June 1991 00004 00005 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 00006 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00007 Everyone is permitted to copy and distribute verbatim copies 00008 of this license document, but changing it is not allowed. 00009 00010 Preamble 00011 00012 The licenses for most software are designed to take away your 00013 freedom to share and change it. By contrast, the GNU General Public 00014 License is intended to guarantee your freedom to share and change free 00015 software--to make sure the software is free for all its users. This 00016 General Public License applies to most of the Free Software 00017 Foundation's software and to any other program whose authors commit to 00018 using it. (Some other Free Software Foundation software is covered by 00019 the GNU Library General Public License instead.) You can apply it to 00020 your programs, too. 00021 00022 When we speak of free software, we are referring to freedom, not 00023 price. Our General Public Licenses are designed to make sure that you 00024 have the freedom to distribute copies of free software (and charge for 00025 this service if you wish), that you receive source code or can get it 00026 if you want it, that you can change the software or use pieces of it 00027 in new free programs; and that you know you can do these things. 00028 00029 To protect your rights, we need to make restrictions that forbid 00030 anyone to deny you these rights or to ask you to surrender the rights. 00031 These restrictions translate to certain responsibilities for you if you 00032 distribute copies of the software, or if you modify it. 00033 00034 For example, if you distribute copies of such a program, whether 00035 gratis or for a fee, you must give the recipients all the rights that 00036 you have. You must make sure that they, too, receive or can get the 00037 source code. And you must show them these terms so they know their 00038 rights. 00039 00040 We protect your rights with two steps: (1) copyright the software, and 00041 (2) offer you this license which gives you legal permission to copy, 00042 distribute and/or modify the software. 00043 00044 Also, for each author's protection and ours, we want to make certain 00045 that everyone understands that there is no warranty for this free 00046 software. If the software is modified by someone else and passed on, we 00047 want its recipients to know that what they have is not the original, so 00048 that any problems introduced by others will not reflect on the original 00049 authors' reputations. 00050 00051 Finally, any free program is threatened constantly by software 00052 patents. We wish to avoid the danger that redistributors of a free 00053 program will individually obtain patent licenses, in effect making the 00054 program proprietary. To prevent this, we have made it clear that any 00055 patent must be licensed for everyone's free use or not licensed at all. 00056 00057 The precise terms and conditions for copying, distribution and 00058 modification follow. 00059 00060 GNU GENERAL PUBLIC LICENSE 00061 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 00062 00063 0. This License applies to any program or other work which contains 00064 a notice placed by the copyright holder saying it may be distributed 00065 under the terms of this General Public License. The "Program", below, 00066 refers to any such program or work, and a "work based on the Program" 00067 means either the Program or any derivative work under copyright law: 00068 that is to say, a work containing the Program or a portion of it, 00069 either verbatim or with modifications and/or translated into another 00070 language. (Hereinafter, translation is included without limitation in 00071 the term "modification".) Each licensee is addressed as "you". 00072 00073 Activities other than copying, distribution and modification are not 00074 covered by this License; they are outside its scope. The act of 00075 running the Program is not restricted, and the output from the Program 00076 is covered only if its contents constitute a work based on the 00077 Program (independent of having been made by running the Program). 00078 Whether that is true depends on what the Program does. 00079 00080 1. You may copy and distribute verbatim copies of the Program's 00081 source code as you receive it, in any medium, provided that you 00082 conspicuously and appropriately publish on each copy an appropriate 00083 copyright notice and disclaimer of warranty; keep intact all the 00084 notices that refer to this License and to the absence of any warranty; 00085 and give any other recipients of the Program a copy of this License 00086 along with the Program. 00087 00088 You may charge a fee for the physical act of transferring a copy, and 00089 you may at your option offer warranty protection in exchange for a fee. 00090 00091 2. You may modify your copy or copies of the Program or any portion 00092 of it, thus forming a work based on the Program, and copy and 00093 distribute such modifications or work under the terms of Section 1 00094 above, provided that you also meet all of these conditions: 00095 00096 a) You must cause the modified files to carry prominent notices 00097 stating that you changed the files and the date of any change. 00098 00099 b) You must cause any work that you distribute or publish, that in 00100 whole or in part contains or is derived from the Program or any 00101 part thereof, to be licensed as a whole at no charge to all third 00102 parties under the terms of this License. 00103 00104 c) If the modified program normally reads commands interactively 00105 when run, you must cause it, when started running for such 00106 interactive use in the most ordinary way, to print or display an 00107 announcement including an appropriate copyright notice and a 00108 notice that there is no warranty (or else, saying that you provide 00109 a warranty) and that users may redistribute the program under 00110 these conditions, and telling the user how to view a copy of this 00111 License. (Exception: if the Program itself is interactive but 00112 does not normally print such an announcement, your work based on 00113 the Program is not required to print an announcement.) 00114 00115 These requirements apply to the modified work as a whole. If 00116 identifiable sections of that work are not derived from the Program, 00117 and can be reasonably considered independent and separate works in 00118 themselves, then this License, and its terms, do not apply to those 00119 sections when you distribute them as separate works. But when you 00120 distribute the same sections as part of a whole which is a work based 00121 on the Program, the distribution of the whole must be on the terms of 00122 this License, whose permissions for other licensees extend to the 00123 entire whole, and thus to each and every part regardless of who wrote it. 00124 00125 Thus, it is not the intent of this section to claim rights or contest 00126 your rights to work written entirely by you; rather, the intent is to 00127 exercise the right to control the distribution of derivative or 00128 collective works based on the Program. 00129 00130 In addition, mere aggregation of another work not based on the Program 00131 with the Program (or with a work based on the Program) on a volume of 00132 a storage or distribution medium does not bring the other work under 00133 the scope of this License. 00134 00135 3. You may copy and distribute the Program (or a work based on it, 00136 under Section 2) in object code or executable form under the terms of 00137 Sections 1 and 2 above provided that you also do one of the following: 00138 00139 a) Accompany it with the complete corresponding machine-readable 00140 source code, which must be distributed under the terms of Sections 00141 1 and 2 above on a medium customarily used for software interchange; or, 00142 00143 b) Accompany it with a written offer, valid for at least three 00144 years, to give any third party, for a charge no more than your 00145 cost of physically performing source distribution, a complete 00146 machine-readable copy of the corresponding source code, to be 00147 distributed under the terms of Sections 1 and 2 above on a medium 00148 customarily used for software interchange; or, 00149 00150 c) Accompany it with the information you received as to the offer 00151 to distribute corresponding source code. (This alternative is 00152 allowed only for noncommercial distribution and only if you 00153 received the program in object code or executable form with such 00154 an offer, in accord with Subsection b above.) 00155 00156 The source code for a work means the preferred form of the work for 00157 making modifications to it. For an executable work, complete source 00158 code means all the source code for all modules it contains, plus any 00159 associated interface definition files, plus the scripts used to 00160 control compilation and installation of the executable. However, as a 00161 special exception, the source code distributed need not include 00162 anything that is normally distributed (in either source or binary 00163 form) with the major components (compiler, kernel, and so on) of the 00164 operating system on which the executable runs, unless that component 00165 itself accompanies the executable. 00166 00167 If distribution of executable or object code is made by offering 00168 access to copy from a designated place, then offering equivalent 00169 access to copy the source code from the same place counts as 00170 distribution of the source code, even though third parties are not 00171 compelled to copy the source along with the object code. 00172 00173 4. You may not copy, modify, sublicense, or distribute the Program 00174 except as expressly provided under this License. Any attempt 00175 otherwise to copy, modify, sublicense or distribute the Program is 00176 void, and will automatically terminate your rights under this License. 00177 However, parties who have received copies, or rights, from you under 00178 this License will not have their licenses terminated so long as such 00179 parties remain in full compliance. 00180 00181 5. You are not required to accept this License, since you have not 00182 signed it. However, nothing else grants you permission to modify or 00183 distribute the Program or its derivative works. These actions are 00184 prohibited by law if you do not accept this License. Therefore, by 00185 modifying or distributing the Program (or any work based on the 00186 Program), you indicate your acceptance of this License to do so, and 00187 all its terms and conditions for copying, distributing or modifying 00188 the Program or works based on it. 00189 00190 6. Each time you redistribute the Program (or any work based on the 00191 Program), the recipient automatically receives a license from the 00192 original licensor to copy, distribute or modify the Program subject to 00193 these terms and conditions. You may not impose any further 00194 restrictions on the recipients' exercise of the rights granted herein. 00195 You are not responsible for enforcing compliance by third parties to 00196 this License. 00197 00198 7. If, as a consequence of a court judgment or allegation of patent 00199 infringement or for any other reason (not limited to patent issues), 00200 conditions are imposed on you (whether by court order, agreement or 00201 otherwise) that contradict the conditions of this License, they do not 00202 excuse you from the conditions of this License. If you cannot 00203 distribute so as to satisfy simultaneously your obligations under this 00204 License and any other pertinent obligations, then as a consequence you 00205 may not distribute the Program at all. For example, if a patent 00206 license would not permit royalty-free redistribution of the Program by 00207 all those who receive copies directly or indirectly through you, then 00208 the only way you could satisfy both it and this License would be to 00209 refrain entirely from distribution of the Program. 00210 00211 If any portion of this section is held invalid or unenforceable under 00212 any particular circumstance, the balance of the section is intended to 00213 apply and the section as a whole is intended to apply in other 00214 circumstances. 00215 00216 It is not the purpose of this section to induce you to infringe any 00217 patents or other property right claims or to contest validity of any 00218 such claims; this section has the sole purpose of protecting the 00219 integrity of the free software distribution system, which is 00220 implemented by public license practices. Many people have made 00221 generous contributions to the wide range of software distributed 00222 through that system in reliance on consistent application of that 00223 system; it is up to the author/donor to decide if he or she is willing 00224 to distribute software through any other system and a licensee cannot 00225 impose that choice. 00226 00227 This section is intended to make thoroughly clear what is believed to 00228 be a consequence of the rest of this License. 00229 00230 8. If the distribution and/or use of the Program is restricted in 00231 certain countries either by patents or by copyrighted interfaces, the 00232 original copyright holder who places the Program under this License 00233 may add an explicit geographical distribution limitation excluding 00234 those countries, so that distribution is permitted only in or among 00235 countries not thus excluded. In such case, this License incorporates 00236 the limitation as if written in the body of this License. 00237 00238 9. The Free Software Foundation may publish revised and/or new versions 00239 of the General Public License from time to time. Such new versions will 00240 be similar in spirit to the present version, but may differ in detail to 00241 address new problems or concerns. 00242 00243 Each version is given a distinguishing version number. If the Program 00244 specifies a version number of this License which applies to it and "any 00245 later version", you have the option of following the terms and conditions 00246 either of that version or of any later version published by the Free Software 00247 Foundation. If the Program does not specify a version number of this License, 00248 you may choose any version ever published by the Free Software Foundation. 00249 00250 10. If you wish to incorporate parts of the Program into other free 00251 programs whose distribution conditions are different, write to the author to 00252 ask for permission. For software which is copyrighted by the Free Software 00253 Foundation, write to the Free Software Foundation; we sometimes make 00254 exceptions for this. Our decision will be guided by the two goals of 00255 preserving the free status of all derivatives of our free software and of 00256 promoting the sharing and reuse of software generally. 00257 00258 NO WARRANTY 00259 00260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR 00261 THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 00262 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE 00263 THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 00264 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00265 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 00266 PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, 00267 YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 00268 00269 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 00270 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 00271 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 00272 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 00273 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO 00274 LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR 00275 THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 00276 EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 00277 DAMAGES. 00278 00279 END OF TERMS AND CONDITIONS ' 00280 */ 00281 static const char* Copyright = "(C) Copyright Michigan State University 1977, All rights reserved"; 00282 00284 #include "CReadOrder.h" 00285 #include <spectrodaq.h> 00286 #include <string> 00287 #include <algorithm> 00288 #include <TCLInterpreter.h> 00289 #include <TCLResult.h> 00290 #include <vector> 00291 #include "CModuleCommand.h" 00292 #include "CReadableObject.h" 00293 #include "CDigitizerDictionary.h" 00294 #include "CReadException.h" 00295 #include "CConfigurationParameter.h" 00296 #include "CIntConfigParam.h" 00297 #include "CBoolConfigParam.h" 00298 00304 CReadOrder::CReadOrder (CTCLInterpreter* pInterp, 00305 CDigitizerDictionary* pDict, 00306 const string& rCommand) : 00307 CReadableObject(rCommand, *pInterp), 00308 m_pModules(pDict), 00309 m_nPacketId(-1), 00310 m_fPacketize(false), 00311 m_pPacketIdParam(0), 00312 m_pPacketizeParam(0) 00313 { 00314 CConfigurableObject::ParameterIterator p; 00315 p = AddBoolParam("packetize", false); 00316 m_pPacketizeParam = (CBoolConfigParam*)(*p); 00317 p = AddIntParam("id",-1); // Start with illegal id. 00318 m_pPacketIdParam = (CIntConfigParam*)(*p); 00319 m_pPacketIdParam->setRange(0, 0xffff); // The id must fit in a word. 00320 00321 00322 } 00328 CReadOrder::~CReadOrder ( ) //Destructor - Delete dynamic objects 00329 { 00330 OnDelete(); 00331 } 00332 00333 00334 00335 // Functions for class CReadOrder 00336 00342 void 00343 CReadOrder::Add(CReadableObject* pModule) 00344 { 00345 if(pModule) { 00346 pModule->Link(this); // Link the module to us... 00347 m_ReadoutList.push_back(pModule); 00348 } 00349 else { 00350 throw string("CReadOrderAdd:: pModule is a null pointer!"); 00351 } 00352 } 00353 00362 void 00363 CReadOrder::Remove(ModuleIterator p) 00364 { 00365 if(p != readerend()) { 00366 (*p)->Unlink(); 00367 m_ReadoutList.erase(p); 00368 } 00369 else { 00370 throw string("CReadOrder::Remove - ModuleIterator p == readerend()!"); 00371 } 00372 } 00373 void 00374 CReadOrder::Remove(CReadableObject* pModule) 00375 { 00376 if(pModule) { 00377 ModuleIterator p = find(readerbegin(), readerend(), pModule); 00378 Remove(p); 00379 } 00380 else { 00381 throw string("CReadOrder::Remove - pModule is a null pointer!"); 00382 } 00383 00384 } 00385 00392 void 00393 CReadOrder::Initialize() 00394 { 00395 00396 m_fPacketize = m_pPacketizeParam->getOptionValue(); 00397 m_nPacketId = m_pPacketIdParam->getOptionValue(); 00398 if(m_fPacketize && (m_nPacketId < 0)) { 00399 throw string("CReadorder::Initialize- packetization enabled, but no id set"); 00400 } 00401 ModuleInitialize init; 00402 for_each(readerbegin(), readerend(), init); 00403 } 00404 00410 void 00411 CReadOrder::Prepare() 00412 { 00413 ModulePrepare prepare; 00414 for_each(readerbegin(), readerend(), prepare); 00415 } 00416 00425 void 00426 CReadOrder::Read(DAQWordBufferPtr& p) 00427 { 00428 DAQWordBufferPtr size = p; 00429 CReadException except; 00430 00431 if(m_fPacketize) { 00432 ++p; 00433 *p = m_nPacketId; 00434 ++p; 00435 } 00436 try { 00437 ModuleIterator pM = readerbegin(); 00438 while( pM != readerend()) { 00439 CReadableObject* pModule = *pM; 00440 pModule->Read(p); 00441 pM++; 00442 } 00443 } 00444 catch (string msg) { 00445 except.Add(msg, p.GetIndex() - size.GetIndex()); 00446 } 00447 catch (CReadException e) { 00448 except.Add(e.GetString(), e.GetCount()); 00449 } 00450 catch (...) { 00451 except.Add("Unexpected exception", 00452 p.GetIndex()- size.GetIndex()); 00453 } 00454 if(m_fPacketize) { 00455 *size = (p.GetIndex() - size.GetIndex()); 00456 } 00457 if(except.GetCount()) { // If anyone added an exception throw this. 00458 throw except; 00459 } 00460 00461 } 00466 int 00467 CReadOrder::Read(void* pBuf) 00468 { 00469 ModuleIterator pM = readerbegin(); 00470 short* p((short*)pBuf); 00471 short* pwords((short*)pBuf); 00472 int nRead(0); 00473 CReadException except; 00474 00475 00476 if(m_fPacketize) { 00477 p++; 00478 *p++ = m_nPacketId; 00479 nRead = 2; // Packet overhead is 2 words. 00480 } 00481 00482 try { 00483 while(pM != readerend()) { 00484 CReadableObject* pModule = *pM; 00485 int nThisRead = pModule->Read(p); 00486 nRead += nThisRead; 00487 p += nThisRead; 00488 pM++; 00489 } 00490 } 00491 catch (CReadException e) { 00492 except.Add(e.GetString(), e.GetCount()); 00493 } 00494 catch (string msg) { 00495 except.Add(msg, nRead); 00496 } 00497 catch (...) { 00498 except.Add(string("Unanticipated exception"), 00499 nRead); 00500 } 00501 00502 if(m_fPacketize) { 00503 *pwords = nRead; // Fill in size. 00504 } 00505 if(except.GetCount()) { 00506 throw except; 00507 } 00508 return nRead; 00509 00510 } 00515 void 00516 CReadOrder::Clear() 00517 { 00518 ModuleClear clear; 00519 for_each(readerbegin(), readerend(), clear); 00520 } 00521 00528 int 00529 CReadOrder::readersize() 00530 { 00531 return m_ReadoutList.size(); 00532 } 00533 00540 CReadOrder::ModuleIterator 00541 CReadOrder::readerbegin() 00542 { 00543 return m_ReadoutList.begin(); 00544 } 00545 00552 CReadOrder::ModuleIterator 00553 CReadOrder::readerend() 00554 { 00555 return m_ReadoutList.end(); 00556 } 00562 CReadOrder::ModuleIterator 00563 CReadOrder::readerfind(const string& rName) 00564 { 00565 CompareName cname(rName); 00566 return find_if(readerbegin(), readerend(), cname); 00567 } 00568 00590 int 00591 CReadOrder::operator()(CTCLInterpreter& rInterp, 00592 CTCLResult& rResult, 00593 int nargc, char** pargv) 00594 { 00595 int nArgc(nargc); // Use copies so the originals can be 00596 char** pArgv(pargv); // passed unmodified to base class operator() 00597 int nStatus = TCL_OK; 00598 00599 // Skip the command keyword: 00600 00601 nArgc--; 00602 pArgv++; 00603 00604 // All commands require at least one additional parameter: 00605 00606 if(nArgc < 1) { 00607 nStatus = TCL_ERROR; 00608 rResult = Usage(); 00609 } 00610 else { 00611 // Dispatch to appropriate function: 00612 00613 string SubCommand(*pArgv); 00614 if(SubCommand == string("add")) { 00615 nStatus = AddCommand(rInterp, rResult, nArgc, pArgv); 00616 } 00617 else if (SubCommand == string("list")) { 00618 nStatus = ListCommand(rInterp, rResult, nArgc, pArgv); 00619 } 00620 else if (SubCommand == string("remove")) { 00621 nStatus = RemoveCommand(rInterp, rResult, nArgc, pArgv); 00622 } 00623 else { 00624 // Could be processed by base classes: 00625 00626 nStatus = CReadableObject::operator()(rInterp, rResult, 00627 nargc, pargv); 00628 if(nStatus != TCL_OK) { 00629 rResult += Usage(); // Append our usage. 00630 } 00631 } 00632 } 00633 return nStatus; 00634 } 00635 00657 int 00658 CReadOrder::AddCommand(CTCLInterpreter& rInterp, 00659 CTCLResult& rResult, 00660 int nArgc, char** pArgv) 00661 { 00662 int nStatus = TCL_OK; 00663 00664 // Skip command keyword: 00665 00666 nArgc--; 00667 pArgv++; 00668 00669 // Build vectors of good and bad modules (those that 00670 // exist and those that don't. 00671 // 00672 vector<CReadableObject*> good; 00673 vector<string> bad; 00674 00675 while (nArgc) { 00676 CDigitizerDictionary::ModuleIterator p = m_pModules->DigitizerFind(string(*pArgv)); 00677 if(p == m_pModules->DigitizerEnd()) { 00678 nStatus = TCL_ERROR; 00679 bad.push_back(string(*pArgv)); 00680 } 00681 else { 00682 good.push_back((p->second)); 00683 } 00684 nArgc--; 00685 pArgv++; 00686 } 00687 if(nStatus == TCL_OK) { // All modules are ok. 00688 for(int i =0; i < good.size(); i++) { 00689 Add(good[i]); 00690 } 00691 } 00692 else { // Some modules don't exist. 00693 rResult = "The following modules do not exist: "; 00694 for(int i =0; i < bad.size(); i++) { 00695 rResult += bad[i]; 00696 rResult += " "; 00697 } 00698 rResult += "\nNo modules added to readout"; 00699 } 00700 00701 return nStatus; 00702 } 00722 int 00723 CReadOrder::RemoveCommand(CTCLInterpreter& rInterp, 00724 CTCLResult& rResult, 00725 int nArgc, char** pArgv) 00726 { 00727 int nStatus = TCL_OK; 00728 00729 // Skip past the subcommand parameter: 00730 00731 nArgc--; 00732 pArgv++; 00733 00734 // The next parameter is a single module that will be deleted: 00735 00736 if(nArgc != 1) { 00737 nStatus = TCL_ERROR; 00738 rResult = "Too many parameters after module remove\n"; 00739 rResult += Usage(); 00740 } 00741 else { 00742 string Module(*pArgv); 00743 ModuleIterator p = readerfind(Module); 00744 if(p != readerend()) { 00745 Remove(p); 00746 } 00747 else { 00748 nStatus = TCL_ERROR; 00749 rResult = "Module "; 00750 rResult += Module; 00751 rResult += " not in the readout list"; 00752 } 00753 } 00754 return nStatus; 00755 } 00783 int 00784 CReadOrder::ListCommand(CTCLInterpreter& rInterp, 00785 CTCLResult& rResult, 00786 int nArgc, char** pArgv) 00787 { 00788 int nStatus = TCL_OK; 00789 00790 // Skip the subcommand parameter: 00791 00792 nArgc--; 00793 pArgv++; 00794 00795 // Validate the command parameter count and figure out 00796 // the match pattern. 00797 00798 if(nArgc > 1) { 00799 nStatus = TCL_ERROR; 00800 rResult = "Extra parameters following 'readout list' command\n"; 00801 rResult += Usage(); 00802 } 00803 else { 00804 string pattern("*"); 00805 if(nArgc) { 00806 pattern = *pArgv; 00807 } 00808 Lister visitor(rResult, pattern); 00809 for_each(readerbegin(), readerend(), visitor); 00810 00811 } 00812 return nStatus; 00813 } 00818 string 00819 CReadOrder::Usage() 00820 { 00821 00822 string result; 00823 string cmd = getCommandName(); 00824 result = CReadableObject::Usage(); // Base class usage too!! 00825 result +="\t"; 00826 result += cmd; 00827 result += " add module1 ?module2...?\n"; 00828 result +="\t"; 00829 result += cmd; 00830 result += " list ?glob-pattern?\n"; 00831 result +="\t"; 00832 result += cmd; 00833 result += " remove module\n"; 00834 00835 return result; 00836 } 00841 void 00842 CReadOrder::OnDelete() 00843 { 00844 ModuleIterator p = readerbegin(); 00845 for(; p != readerend(); p++) { 00846 (*p)->Unlink(); // They must be linked or they would not be in 00847 } // our module list! 00848 // Empty the list. 00849 00850 m_ReadoutList.erase(readerbegin(), readerend()); 00851 00852 } 00857 string 00858 CReadOrder::getType() const 00859 { 00860 return string("packet-container"); 00861 }