00001
00002
00037
00038
00039
00040 #include <vector>
00041
00042
00043 #include <iterator>
00044
00045
00046 #include "pbori_defs.h"
00047
00048
00049 #include "pbori_func.h"
00050 #include "pbori_algo.h"
00051
00052 #include "CStringLiteral.h"
00053 #include "CPrintOperation.h"
00054
00055 #include "CIdxVariable.h"
00056
00057 #ifndef CIdxPath_h_
00058 #define CIdxPath_h_
00059
00064 BEGIN_NAMESPACE_PBORI
00065
00066 template <class IdxType = CIdxVariable<CTypes::idx_type>,
00067 class SeparatorType = CStringLiteral<CLiteralCodes::list_separator> >
00068 class CIdxPath:
00069 public std::vector<IdxType> {
00070
00071 public:
00073
00074 typedef IdxType idx_type;
00075 typedef CTypes::ostream_type ostream_type;
00077
00079 typedef std::vector<idx_type> base;
00080
00082 typedef SeparatorType separator_type;
00083
00085
00086
00088 typedef CIdxPath<idx_type, separator_type> self;
00089
00091 typedef typename base::size_type size_type;
00092
00094 CIdxPath(): base() {}
00095
00097 CIdxPath(size_type nlen): base(nlen) {};
00098
00100 CIdxPath(const self& rhs): base(rhs) {};
00101
00103 ~CIdxPath() {};
00104
00106 ostream_type& print(ostream_type& os) const {
00107
00108 if (base::begin() == base::end()) {
00109 os << 1;
00110 }
00111
00112 special_first_transform( base::begin(), base::end(),
00113 std::ostream_iterator<idx_type>(os),
00114 CPrintOperation<idx_type, separator_type>(os),
00115 project_ith<1>() );
00116
00117 return os;
00118 }
00119
00120 };
00121
00123 template <class IdxType, class SeparatorType>
00124 inline typename CIdxPath<IdxType, SeparatorType>::ostream_type&
00125 operator<<(typename CIdxPath<IdxType, SeparatorType>::ostream_type& os,
00126 const CIdxPath<IdxType, SeparatorType>& storage){
00127
00128 return storage.print(os);
00129 }
00130
00131 END_NAMESPACE_PBORI
00132
00133 #endif