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 of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 00239 00240 Each version is given a distinguishing version number. If the Program 00241 specifies a version number of this License which applies to it and "any 00242 later version", you have the option of following the terms and conditions 00243 either of that version or of any later version published by the Free Software 00244 Foundation. If the Program does not specify a version number of this License, 00245 you may choose any version ever published by the Free Software Foundation. 00246 00247 10. If you wish to incorporate parts of the Program into other free 00248 programs whose distribution conditions are different, write to the author to 00249 ask for permission. For software which is copyrighted by the Free Software 00250 Foundation, write to the Free Software Foundation; we sometimes make 00251 exceptions for this. Our decision will be guided by the two goals of 00252 preserving the free status of all derivatives of our free software and of 00253 promoting the sharing and reuse of software generally. 00254 00255 NO WARRANTY 00256 00257 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR 00258 THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 00259 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE 00260 THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 00261 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00262 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 00263 PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, 00264 YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 00265 00266 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 00267 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 00268 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 00269 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 00270 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO 00271 LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR 00272 THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 00273 EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 00274 DAMAGES. 00275 00276 END OF TERMS AND CONDITIONS 00277 */ 00278 /* 00279 \class CVME 00280 \file CVME.h 00281 00282 Encapsulates a CVME object. CVMEs purpose for existence is so that 00283 CVMEptr's wont cause memory leaks. A CVME contains a reference counted 00284 pointer which points to a CVMEptr object which holds the actual mapped 00285 address and performs the actual reads and writes. When a CVME is 00286 constructed, its reference count is incremented, and when one is 00287 destructed, its reference count is decremented. When the reference count 00288 falls to zero, the object is deleted. This way, the object wont be 00289 deleted before we are done with it. 00290 00291 Author: 00292 Jason Venema 00293 NSCL 00294 Michigan State University 00295 East Lansing, MI 48824-1321 00296 mailto: venemaja@msu.edu 00297 */ 00298 00299 #ifndef __CVME_H 00300 #define __CVME_H 00301 00302 #ifndef __CVMEPTR_H 00303 #include <CVMEptr.h> 00304 #endif 00305 00306 #ifndef __REFPTR_H 00307 #include <Refptr.h> 00308 #endif 00309 00310 template<class T> 00311 class CVME 00312 { 00313 CRefcountedPtr<CVMEptr<T> > m_pRCptr; // a reference counted pointer to the 00314 // CVMEptr which holds the mapping. 00315 00316 public: 00317 // Enumeration of possible Vme devices to access 00318 enum VmeSpace { 00319 a16d16, 00320 a24d16, 00321 a24d32, 00322 a32d32 00323 }; 00324 00325 // Default constructor 00326 CVME<T>(VmeSpace space, UInt_t base, UInt_t length); 00327 CVME<T>(); 00328 CVME<T>(CVMEptr<T>& aCVMEptr); 00329 // Copy constructor 00330 CVME<T>(const CVME& aCVME); 00331 // Operator= assignment operator 00332 CVME<T>& operator= (const CVME<T>& aCVME); 00333 00334 // Operator== equality operator 00335 int operator== (const CVME<T>& aCVME) const 00336 { 00337 CVME<T>& t((CVME<T>&) *this); 00338 CVME<T>& r((CVME<T>& )aCVME); 00339 return (t.m_pRCptr == r.m_pRCptr); 00340 } 00341 00342 // Mutator functions 00343 protected: 00344 void setRCptr(CVMEptr<T> aRCptr) { m_pRCptr = aRCptr; } 00345 00346 // Public accessor functions 00347 public: 00348 UInt_t getOffset() { return m_pRCptr.operator*().getOffset(); } 00349 UInt_t getLength() { return m_pRCptr.operator*().getLength(); } 00350 Address_t getStart() { return m_pRCptr.operator*().getStart(); } 00351 Address_t getgenptr(UInt_t nOffset); 00352 00353 // Public member functions 00354 public: 00355 // Pointer dereference/indexing 00356 T& operator*(); 00357 T* operator->(); 00358 T& operator[] (UInt_t nOffset); 00359 T& operator[] (UInt_t nOffset) const; 00360 00361 // Pointer addition/subtraction 00362 CVME<T>& operator+(UInt_t nOffset); 00363 CVME<T>& operator-(UInt_t nOffset); 00364 CVME<T>& operator+=(UInt_t nOffset); 00365 CVME<T>& operator-=(UInt_t nOffset); 00366 00367 // Pointer pre-increment/decrement 00368 CVME<T>& operator++(); 00369 CVME<T>& operator--(); 00370 00371 // Pointer post-increment/decrement 00372 CVME<T>& operator++(Int_t); 00373 CVME<T>& operator--(Int_t); 00374 00375 // Type conversion operators 00376 public: 00377 CVME<UChar_t> asChar(); 00378 CVME<UShort_t> asShort(); 00379 CVME<ULong_t> asLong(); 00380 }; 00381 00382 #endif 00383 00384 /* 00385 \fn CVME<T>::CVME<T>(VmeSpace space, UInt_t base, UInt_t length) 00386 00387 Operation Type: 00388 Constructor 00389 00390 Purpose: 00391 Construct a CVME<T> by newing into existence a 00392 CVMEptr<T> and encapsulating it in a RefcountedPtr. 00393 00394 \param VmeSpace space - indicates the vme device to map 00395 UInt_t base - the base address of the module 00396 UInt_t length - the length of the mapping (bytes) 00397 */ 00398 template<class T> 00399 CVME<T>::CVME<T>(VmeSpace space, UInt_t base, UInt_t length) 00400 { 00401 CRefcountedPtr<CVMEptr<T> > p(new CVMEptr<T>(space, base, length)); 00402 m_pRCptr = p; 00403 } 00404 00405 /* 00406 \fn CVME<T>::CVME<T>() 00407 00408 Operation Type: 00409 Constructor 00410 00411 Purpose: 00412 Construct a CVME<T> which points to nothing. 00413 */ 00414 template<class T> 00415 CVME<T>::CVME<T>() 00416 { 00417 m_pRCptr = 0; 00418 } 00419 00420 /* 00421 CVME<T>::CVME<T>(CVMEptr<T>& aCVMEptr) 00422 00423 Operation Type: 00424 Constructor 00425 00426 Purpose: 00427 Constructs an object of type CVME<T> given a CVMEptr object. 00428 00429 \param CVMEptr<T>& aCVMEptr - the CVMEptr from which to construct this 00430 */ 00431 template<class T> 00432 CVME<T>::CVME<T>(CVMEptr<T>& aCVMEptr) 00433 { 00434 m_pRCptr = CRefcountedPtr<CVMEptr<T> >(aCVMEptr); 00435 } 00436 00437 /* 00438 \fn CVME<T>::CVME<T>(const CVME<T>& aCVME) 00439 00440 Operation Type: 00441 Copy Constructor 00442 00443 Purpose: 00444 Construct a CVME<T> by copying one. 00445 */ 00446 template<class T> 00447 CVME<T>::CVME<T>(const CVME<T>& aCVME) 00448 { 00449 m_pRCptr = aCVME.m_pRCptr; 00450 } 00451 00452 /* 00453 \fn CVME<T>& CVME<T>::operator=(const CVME<T>& aCVME) 00454 00455 Operation Type: 00456 Assignment 00457 00458 Purpose: 00459 Assign another CVME to this 00460 */ 00461 template<class T> 00462 CVME<T>& 00463 CVME<T>::operator=(const CVME<T>& aCVME) 00464 { 00465 if(this == &aCVME) return *this; 00466 00467 m_pRCptr = aCVME.m_pRCptr; 00468 return *this; 00469 } 00470 00471 /* 00472 \fn T& CVME<T>::operator*() 00473 00474 Operation Type: 00475 Pointer dereference 00476 00477 Purpose: 00478 Returns the value stored by the encapsulated CVMEptr at its 00479 current offset. Throws a CRangeError exception if it catches one. 00480 */ 00481 template<class T> 00482 T& 00483 CVME<T>::operator*() 00484 { 00485 try { 00486 return m_pRCptr.operator*().operator*(); 00487 } 00488 catch(CRangeError& re) { 00489 throw re; 00490 } 00491 } 00492 00493 /* 00494 \fn T* CVME<T>::operator->() 00495 00496 Operation Type: 00497 Pointer dereference 00498 00499 Purpose: 00500 Returns a pointer to the value stored by the encapsulated CVMEptr at 00501 its current offset. Throws a CRangeError exception if it catches one. 00502 */ 00503 template<class T> 00504 T* 00505 CVME<T>::operator->() 00506 { 00507 try { 00508 return m_pRCptr.operator*().operator->(); 00509 } 00510 catch(CRangeError& re) { 00511 throw re; 00512 } 00513 } 00514 00515 /* 00516 \fn T& CVME<T>::operator[](UInt_t nOffset) 00517 00518 Operation Type: 00519 Indexing(read/write) 00520 00521 Purpose: 00522 Returns the value stored in the encapsulated CVMEptr at 00523 index nOffset. Throws a CRangeError exception if it catches one. 00524 00525 \param UInt_t nOffset - the offset at which the value is stored. 00526 */ 00527 template<class T> 00528 T& 00529 CVME<T>::operator[](UInt_t nOffset) 00530 { 00531 try { 00532 return m_pRCptr.operator*().operator[](nOffset); 00533 } 00534 catch(CRangeError& re) { 00535 throw re; 00536 } 00537 } 00538 00539 /* 00540 \fn T& CVME<T>::operator[](UInt_t nOffset) const 00541 00542 Operation Type: 00543 Indexing(read/write) 00544 00545 Purpose: 00546 Returns the value stored in the encapsulated CVMEptr at 00547 index nOffset. Throws a CRangeError exception if it catches one. 00548 00549 \param UInt_t nOffset - the offset at which the value is stored. 00550 */ 00551 template<class T> 00552 T& 00553 CVME<T>::operator[](UInt_t nOffset) const 00554 { 00555 try { 00556 return m_pRCptr.operator*().operator[](nOffset); 00557 } 00558 catch(CRangeError& re) { 00559 throw re; 00560 } 00561 } 00562 00563 /* 00564 \fn CVME<T>& CVME<T>::operator+(UInt_t nOffset) 00565 00566 Operation Type: 00567 Mutator 00568 00569 Purpose: 00570 Add a value to the encapsulated CVMEptr<T>'s current 00571 offset. Returns the new 'pointer' or throws a CRangeError 00572 exception if it catches one. 00573 00574 \param UInt_t nOffset - the value to add to the current offset 00575 */ 00576 template<class T> 00577 CVME<T>& 00578 CVME<T>::operator+(UInt_t nOffset) 00579 { 00580 try { 00581 m_pRCptr.operator*().operator+(nOffset); 00582 } 00583 catch(CRangeError& re) { 00584 throw re; 00585 } 00586 return *this; 00587 } 00588 00589 /* 00590 \fn CVME<T>& CVME<T>::operator-(UInt_t nOffset) 00591 00592 Operation Type: 00593 Mutator 00594 00595 Purpose: 00596 Subtracts a value from the encapsulated CVMEptr<T>'s current 00597 offset. Returns the new 'pointer' or throws a CRangeError 00598 exception if it catches one. 00599 00600 \param UInt_t nOffset - the value to add to the current offset 00601 */ 00602 template<class T> 00603 CVME<T>& 00604 CVME<T>::operator-(UInt_t nOffset) 00605 { 00606 try { 00607 m_pRCptr.operator*().operator-(nOffset); 00608 } 00609 catch(CRangeError& re) { 00610 throw re; 00611 } 00612 return *this; 00613 } 00614 00615 /* 00616 \fn CVME<T>& CVME<T>::operator+=(UInt_t nOffset) 00617 00618 Operation Type: 00619 Mutator 00620 00621 Purpose: 00622 Add a value to the encapsulated CVMEptr<T>'s current 00623 offset. Returns the new 'pointer' or throws a CRangeError 00624 exception if it catches one. 00625 00626 \param UInt_t nOffset - the value to add to the current offset 00627 */ 00628 template<class T> 00629 CVME<T>& 00630 CVME<T>::operator+=(UInt_t nOffset) 00631 { 00632 try { 00633 m_pRCptr.operator*().operator+=(nOffset); 00634 return *this; 00635 } 00636 catch(CRangeError& re) { 00637 throw re; 00638 } 00639 } 00640 00641 /* 00642 \fn CVME<T>& CVME<T>::operator-=(UInt_t nOffset) 00643 00644 Operation Type: 00645 Mutator 00646 00647 Purpose: 00648 Subtracts a value from the encapsulated CVMEptr<T>'s current 00649 offset. Returns the new 'pointer' or throws a CRangeError 00650 exception if it catches one. 00651 00652 \param UInt_t nOffset - the value to add to the current offset 00653 */ 00654 template<class T> 00655 CVME<T>& 00656 CVME<T>::operator-=(UInt_t nOffset) 00657 { 00658 try { 00659 m_pRCptr.operator*().operator-=(nOffset); 00660 return *this; 00661 } 00662 catch(CRangeError& re) { 00663 throw re; 00664 } 00665 } 00666 00667 /* 00668 \fn CVME<T>& CVME<T>::operator++() 00669 00670 Operation Type: 00671 Mutator 00672 00673 Purpose: 00674 (Pre)Increment the current offset into the encapsulated CVME<T>. 00675 Throws a CRangeError exception if it catches one. 00676 */ 00677 template<class T> 00678 CVME<T>& 00679 CVME<T>::operator++() 00680 { 00681 try { 00682 m_pRCptr.operator*().operator++(); 00683 return *this; 00684 } 00685 catch(CRangeError& re) { 00686 throw re; 00687 } 00688 } 00689 00690 /* 00691 \fn CVME<T>& CVME<T>::operator--() 00692 00693 Operation Type: 00694 Mutator 00695 00696 Purpose: 00697 (Pre)Decrement the current offset into the encapsulated CVME<T>. 00698 Throws a CRangeError exception if it catches one. 00699 */ 00700 template<class T> 00701 CVME<T>& 00702 CVME<T>::operator--() 00703 { 00704 try { 00705 m_pRCptr.operator*().operator--(); 00706 return *this; 00707 } 00708 catch(CRangeError& re) { 00709 throw re; 00710 } 00711 } 00712 00713 /* 00714 \fn CVME<T>& CVME<T>::operator++(Int_t n) 00715 00716 Operation Type: 00717 Mutator 00718 00719 Purpose: 00720 (Post)Increment the current offset into the encapsulated CVME<T>. 00721 Throws a CRangeError exception if it catches one. 00722 00723 \param Int_t n - dummy parameter to indicate this is a 00724 post-increment operator. 00725 */ 00726 template<class T> 00727 CVME<T>& 00728 CVME<T>::operator++(Int_t n) 00729 { 00730 try { 00731 m_pRCptr.operator*().operator++(n); 00732 return *this; 00733 } 00734 catch(CRangeError& re) { 00735 throw re; 00736 } 00737 } 00738 00739 /* 00740 \fn CVME<T>& CVME<T>::operator--(Int_t n) 00741 00742 Operation Type: 00743 Mutator 00744 00745 Purpose: 00746 (Post)Decrement the current offset into the encapsulated CVME<T>. 00747 Throws a CRangeError exception if it catches one. 00748 00749 \param Int_t n - dummy parameter to indicate this is a 00750 post-decrement operator. 00751 */ 00752 template<class T> 00753 CVME<T>& 00754 CVME<T>::operator--(Int_t n) 00755 { 00756 try { 00757 m_pRCptr.operator*().operator--(n); 00758 return *this; 00759 } 00760 catch(CRangeError& re) { 00761 throw re; 00762 } 00763 } 00764 00765 /* 00766 \fn Address_t CVME<T>::getgenptr(UInt_t nOffset) 00767 00768 Operation Type: 00769 Selector 00770 00771 Purpose: 00772 Return a pointer to the current address+offset into the module 00773 (via the encapsulated CVMEptr<T>). 00774 00775 \param UInt_t nOffset - an offset to use to determine the pointer 00776 */ 00777 template<class T> 00778 Address_t 00779 CVME<T>::getgenptr(UInt_t nOffset) 00780 { 00781 Address_t p = m_pRCptr.operator*().getgenptr(nOffset); 00782 if(p) return p; 00783 else return (Address_t)-1; 00784 } 00785 00786 /* 00787 \fn CVME<UChar_t> CVME<T>::asChar() 00788 00789 Operation Type: 00790 Type conversion operator 00791 00792 Purpose: 00793 Returns this as a CVME which maps m_pStart to an address space 00794 containing data of type UChar_t. 00795 */ 00796 template<class T> 00797 CVME<UChar_t> 00798 CVME<T>::asChar() 00799 { 00800 //CVME<UChar_t> c(m_pRCptr->asChar()); 00801 //return c; 00802 return CVME<UChar_t>(m_pRCptr->asChar()); 00803 } 00804 00805 /* 00806 \fn CVME<UShort_t> CVME<T>::asShort() 00807 00808 Operation Type: 00809 Type conversion operator 00810 00811 Purpose: 00812 Returns this as a CVME which maps m_pStart to an address space 00813 containing data of type UShort_t. 00814 */ 00815 template<class T> 00816 CVME<UShort_t> 00817 CVME<T>::asShort() 00818 { 00819 return CVME<UShort_t>(m_pRCptr->asShort()); 00820 } 00821 00822 /* 00823 \fn CVME<ULong_t> CVME<T>::asLong() 00824 00825 Operation Type: 00826 Type conversion operator 00827 00828 Purpose: 00829 Returns this as a CVME which maps m_pStart to an address space 00830 containing data of type ULong_t. 00831 */ 00832 template<class T> 00833 CVME<ULong_t> 00834 CVME<T>::asLong() 00835 { 00836 return CVME<ULong_t>(m_pRCptr->asLong()); 00837 }