argumentDescription.h

Go to the documentation of this file.
00001 
00016 #ifndef _DLR_COMMON_ARGUMENTDESCRIPTION_H_
00017 #define _DLR_COMMON_ARGUMENTDESCRIPTION_H_
00018 
00019 #include <ostream>
00020 
00021 namespace dlr {
00022 
00023   namespace common {
00024   
00039     template <class Type>
00040     std::ostream&
00041     addArgumentDescription(std::ostream& outputStream, const Type& argument)
00042     {
00043       outputStream << argument;
00044       return outputStream;
00045     }
00046 
00047   } // namespace common
00048   
00049 } // namespace dlr
00050 
00051 
00052 #ifdef _DLRCOMMON_USE_TRACEABLE_
00053 
00054 #include <map>
00055 #include <vector>
00056 
00057 namespace dlr {
00058 
00059   namespace common {
00060   
00061     template <class TYPE>
00062     std::ostream&
00063     addArgumentDescription(std::ostream& outputStream,
00064                            const std::vector<TYPE>& argument)
00065     {
00066       outputStream << "std::vector([";
00067       if(argument.empty() == false) {
00068         outputStream << argument[0];
00069       }
00070       for(size_t index0 = 0; index0 < argument.size(); ++index0) {
00071         outputStream << "," << argument[index0];
00072       }
00073       outputStream << "])";
00074       return outputStream;
00075     }
00076 
00077 
00078     template <class TYPE0, class TYPE1>
00079     std::ostream&
00080     addArgumentDescription(std::ostream& outputStream,
00081                            const std::pair<TYPE0, TYPE1>& argument)
00082     {
00083       outputStream << "std::pair(" << argument.first << ", "
00084                    << argument.second << ")";
00085       return outputStream;
00086     }
00087 
00088   } // namespace common
00089   
00090 } // namespace dlr
00091 
00092 #endif /* #ifdef _DLRCOMMON_USE_TRACEABLE_ */
00093 
00094 
00095 /* ======= Declarations to maintain compatibility with legacy code. ======= */
00096 
00097 namespace dlr {
00098 
00099   using common::addArgumentDescription;
00100   
00101 } // namespace dlr
00102 
00103 #endif /* #ifndef _DLR_COMMON_ARGUMENTDESCRIPTION_H_ */

Generated on Mon Jul 9 20:34:02 2007 for dlrLibs Utility Libraries by  doxygen 1.5.2