summaryrefslogtreecommitdiff
path: root/src/cstore
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-11-09 18:38:49 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2010-11-09 18:38:49 -0800
commit1e615a4e3f3681f8bd02d49d688001d61aa8b815 (patch)
treeed5ce2367d540d5414a283e1e2b9c2e20d0239cd /src/cstore
parentb8f85d2744a42eb18ac78451c29dc6de7bab5fea (diff)
downloadvyatta-cfg-1e615a4e3f3681f8bd02d49d688001d61aa8b815.tar.gz
vyatta-cfg-1e615a4e3f3681f8bd02d49d688001d61aa8b815.zip
initial rework of config output framework
* separate data from algorithm. * prepare for unified input/output framework.
Diffstat (limited to 'src/cstore')
-rw-r--r--src/cstore/cstore.hpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/cstore/cstore.hpp b/src/cstore/cstore.hpp
index c7f179b..267dabe 100644
--- a/src/cstore/cstore.hpp
+++ b/src/cstore/cstore.hpp
@@ -78,6 +78,14 @@ public:
static const size_t MAX_CMD_OUTPUT_SIZE = 4096;
+ // for sorting
+ /* apparently unordered_map template does not work with "enum" type, so
+ * change this to simply unsigned ints to allow unifying all map types,
+ * i.e., "Cstore::MapT".
+ */
+ static const unsigned int SORT_DEFAULT;
+ static const unsigned int SORT_DEB_VERSION;
+ static const unsigned int SORT_NONE;
////// the public cstore interface
//// functions implemented in this base class
@@ -273,6 +281,11 @@ public:
get_child_nodes_status_da(path_comps, cmap, &sorted_keys);
};
+ // util functions
+ static void sortNodes(vector<string>& nvec,
+ unsigned int sort_alg = SORT_DEFAULT) {
+ sort_nodes(nvec, sort_alg);
+ };
/* these are internal API functions and operate on current cfg and
* tmpl paths during cstore operations. they are only used to work around
@@ -377,18 +390,12 @@ private:
////// implemented
// for sorting
- /* apparently unordered_map template does not work with "enum" type, so
- * change this to simply unsigned ints to allow unifying all map types,
- * i.e., "Cstore::MapT".
- */
- static const unsigned int SORT_DEFAULT;
- static const unsigned int SORT_DEB_VERSION;
- static const unsigned int SORT_NONE;
typedef bool (*SortFuncT)(std::string, std::string);
static MapT<unsigned int, SortFuncT> _sort_func_map;
static bool sort_func_deb_version(string a, string b);
- void sort_nodes(vector<string>& nvec, unsigned int sort_alg = SORT_DEFAULT);
+ static void sort_nodes(vector<string>& nvec,
+ unsigned int sort_alg = SORT_DEFAULT);
// init
static bool _init;