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