35#include "BESCatalogList.h"
37#include "CatalogNode.h"
38#include "CatalogItem.h"
43CatalogNode::~CatalogNode()
46 for (std::vector<CatalogItem*>::iterator i = d_items.begin(), e = d_items.end(); i != e; ++i)
52 for (std::vector<CatalogItem*>::iterator i = d_nodes.begin(), e = d_nodes.end(); i != e; ++i)
56 for (std::vector<CatalogItem*>::iterator i = d_leaves.begin(), e = d_leaves.end(); i != e; ++i)
60 delete d_no_really_im_a_leaf;
61 d_no_really_im_a_leaf = 0;;
81 map<string, string, std::less<>> props;
89 if(
get_catalog_name() != BESCatalogList::TheCatalogList()->default_catalog_name())
95 props[
"lastModified"] =
get_lmt();
97 oss << get_item_count();
98 props[
"count"] = oss.str();
100 info->begin_tag(
"node", &props);
104 for (CatalogNode::item_citer i = nodes_begin(), e = nodes_end(); i != e; ++i) {
105 assert((*i)->get_type() == CatalogItem::node);
106 (*i)->encode_item(info);
110 for (CatalogNode::item_citer i = leaves_begin(), e = leaves_end(); i != e; ++i) {
111 assert((*i)->get_type() == CatalogItem::leaf);
112 (*i)->encode_item(info);
114 info->end_tag(
"node");
125 strm << BESIndent::LMarg <<
"CatalogNode::dump - (" << (
void *)
this <<
")" << endl;
128 strm << BESIndent::LMarg <<
"name: " << d_name << endl;
129 strm << BESIndent::LMarg <<
"catalog_name: " << d_catalog_name << endl;
130 strm << BESIndent::LMarg <<
"last modified time: " << d_lmt<< endl;
133 if(d_no_really_im_a_leaf){
134 d_no_really_im_a_leaf->dump(strm);
139 strm << BESIndent::LMarg <<
"item count: " << d_items.size() << endl;
143 strm << BESIndent::LMarg <<
"item count: " << d_nodes.size() + d_leaves.size() << endl;
146 strm << BESIndent::LMarg <<
"items: ";
147 if (d_nodes.size() + d_leaves.size()) {
153 for (; i != e; ++i) {
154 strm << BESIndent::LMarg << (*i) << endl;
160 for (; i != e; ++i) {
161 strm << BESIndent::LMarg << (*i) << endl;
164 i = d_leaves.begin();
166 for (; i != e; ++i) {
167 strm << BESIndent::LMarg << (*i) << endl;
170 BESIndent::UnIndent();
173 BESIndent::UnIndent();
informational response object
static std::string assemblePath(const std::string &firstPart, const std::string &secondPart, bool leadingSlash=false, bool trailingSlash=false)
Assemble path fragments making sure that they are separated by a single '/' character.
void encode_item(BESInfo *info) const
Encode this CatalogItem in an info object.
std::string get_lmt() const
Get the last modified time for this node.
void encode_node(BESInfo *info)
Encode this CatalogNode in an info object.
std::string get_catalog_name() const
The name of the catalog.
virtual void dump(std::ostream &strm) const
std::string get_name() const
The name of this node in the catalog.