creaImageIO_lib
|
Node of an attributed Tree structure. More...
#include <creaImageIOTreeNode.h>
Public Types | |
typedef std::map< std::string, std::string > | AttributeMapType |
typedef std::vector< Node * > | ChildrenListType |
The type of children container. More... | |
Public Member Functions | |
Node (Node *parent) | |
Ctor with parent. More... | |
Node (Node *parent, const AttributeMapType &) | |
Ctor with parent and attributes map. More... | |
virtual | ~Node () |
Virtual destructor. More... | |
void | InitializeAttributeMap () |
Initializes the attribute map i.e. creates the entries. More... | |
const LevelDescriptor & | GetLevelDescriptor () const |
Returns the level descriptor of the node. More... | |
virtual Tree * | GetTree () |
Returns the tree to which the node belongs. More... | |
virtual const Tree * | GetTree () const |
Returns the tree to which the node belongs. More... | |
virtual int | GetLevel () const |
Returns the level of the node in the tree. More... | |
Node * | GetParent () const |
Returns the parent of the node. More... | |
unsigned int | GetNumberOfChildren () const |
bool | GetChildrenLoaded () const |
Returns true iff the node's children are loaded. More... | |
void | SetChildrenLoaded (bool l) |
Sets the node's children. More... | |
ChildrenListType & | GetChildrenList () |
Returns the list of children. More... | |
const ChildrenListType & | GetChildrenList () const |
Returns the list of children (const) More... | |
int | RemoveChildrenFromList (Node *) |
Remove the given children from the children list. More... | |
AttributeMapType & | GetAttributeMap () |
Get the Attributes Map. More... | |
const AttributeMapType & | GetAttributeMap () const |
Get the Attributes Map. More... | |
const std::string & | GetAttribute (const std::string &k) const |
Get the Attribute for a specific key. More... | |
const std::string & | GetCleanAttribute (const std::string &k) const |
Get the Attribute for a specific key without OS dependance (not implemented) More... | |
void | SetAttribute (const std::string &k, const std::string &v) |
Set an Attribute for a specific key. More... | |
void | UnsafeSetAttribute (const std::string &k, const std::string &v) |
Set an Attribute for a specific key(unsafe mode) More... | |
const AttributeDescriptor & | GetAttributeDescriptor (const std::string &k) const |
Get Descriptor for an Attribute. More... | |
bool | Matches (const AttributeMapType &) const |
Returns true if the KEY attributes of the node match those of the map provided. More... | |
template<class T > | |
T | GetData () const |
Returns the node data casted into the type T. More... | |
void | SetData (boost::shared_ptr< NodeData > d) |
Sets the node data. Deletes existing data if any. More... | |
void | SortChildren (const LexicographicalComparator &) |
Sorts the children of the node. More... | |
virtual void | Print () const |
Print the node. More... | |
std::string | GetLabel () const |
Get the Label of the node. More... | |
Private Attributes | |
Node * | mParent |
The parent of the node. More... | |
ChildrenListType | mChildren |
The list of children. More... | |
AttributeMapType | mAttributeMap |
The map of attributes. More... | |
boost::shared_ptr< NodeData > | mData |
User data. More... | |
bool | mChildrenLoaded |
Are the children loaded ? More... | |
Node of an attributed Tree structure.
Definition at line 64 of file creaImageIOTreeNode.h.
typedef std::map<std::string,std::string> creaImageIO::tree::Node::AttributeMapType |
Definition at line 67 of file creaImageIOTreeNode.h.
typedef std::vector<Node*> creaImageIO::tree::Node::ChildrenListType |
The type of children container.
Definition at line 108 of file creaImageIOTreeNode.h.
creaImageIO::tree::Node::Node | ( | Node * | parent | ) |
Ctor with parent.
Definition at line 41 of file creaImageIOTreeNode.cpp.
References GetChildrenList(), GetLevel(), GimmickDebugMessage, InitializeAttributeMap(), and mData.
creaImageIO::tree::Node::Node | ( | Node * | parent, |
const AttributeMapType & | attr | ||
) |
Ctor with parent and attributes map.
Definition at line 64 of file creaImageIOTreeNode.cpp.
References creaImageIO::tree::Tree::GetAttributeDescriptorList(), GetChildrenList(), GetLevel(), GetTree(), GimmickDebugMessage, mData, and UnsafeSetAttribute().
|
virtual |
Virtual destructor.
Definition at line 99 of file creaImageIOTreeNode.cpp.
References GetChildrenList(), GimmickDebugMessage, and mData.
const std::string & creaImageIO::tree::Node::GetAttribute | ( | const std::string & | k | ) | const |
Get the Attribute for a specific key.
Definition at line 172 of file creaImageIOTreeNode.cpp.
References mAttributeMap.
Referenced by creaImageIO::WxGimmickView::CreateTreeView(), creaImageIO::SQLiteTreeHandler::DBGraftToParent(), creaImageIO::SQLiteTreeHandler::DBLoadChildren(), creaImageIO::SQLiteTreeHandler::DBRecursiveRemoveNode(), creaImageIO::SQLiteTreeHandler::DBSetAttribute(), creaImageIO::TreeHandlerImageAdder::FindNode(), creaImageIO::TreeHandlerImageAdder::FindNodePartial(), creaImageIO::SQLiteTreeHandler::GetNumberOfChildren(), creaImageIO::WxEditFieldsPanel::OnComboChange(), creaImageIO::WxTreeView::OnDumpTags(), creaImageIO::WxTreeView::OnPopupFilter(), creaImageIO::TreeHandlerImageAdder::remove(), creaImageIO::TimestampDatabaseHandler::RemoveNode(), creaImageIO::GimmickView::RequestReading(), and creaImageIO::WxEditFieldsPanel::WxEditFieldsPanel().
const AttributeDescriptor & creaImageIO::tree::Node::GetAttributeDescriptor | ( | const std::string & | k | ) | const |
Get Descriptor for an Attribute.
Returns the attribute descriptor of the passed parameter.
Definition at line 139 of file creaImageIOTreeNode.cpp.
References creaImageIO::tree::Tree::GetAttributeDescriptorList(), GetLevel(), and GetTree().
Referenced by creaImageIO::WxTreeView::SortLevel().
|
inline |
Get the Attributes Map.
Definition at line 119 of file creaImageIOTreeNode.h.
References mAttributeMap.
Referenced by creaImageIO::SQLiteTreeHandler::SQLAppendAttributesValues().
|
inline |
Get the Attributes Map.
Definition at line 122 of file creaImageIOTreeNode.h.
References mAttributeMap.
|
inline |
Returns the list of children.
Definition at line 110 of file creaImageIOTreeNode.h.
References mChildren.
Referenced by creaImageIO::SQLiteTreeHandler::DBGetParent(), creaImageIO::SQLiteTreeHandler::DBLoadChildren(), creaImageIO::SQLiteTreeHandler::DBRecursiveRemoveNode(), creaImageIO::TreeHandlerImageAdder::DeleteDriveFromMainDB(), creaImageIO::TreeHandlerImageAdder::FindNode(), creaImageIO::TreeHandlerImageAdder::FindNodePartial(), Node(), creaImageIO::tree::Tree::Print(), Print(), RemoveChildrenFromList(), creaImageIO::TreeHandlerImageAdder::RemoveFile(), creaImageIO::TimestampDatabaseHandler::RemoveNode(), creaImageIO::TreeHandlerImageAdder::Synchronize(), and ~Node().
|
inline |
Returns the list of children (const)
Definition at line 112 of file creaImageIOTreeNode.h.
References mChildren.
|
inline |
Returns true iff the node's children are loaded.
Definition at line 102 of file creaImageIOTreeNode.h.
References mChildrenLoaded.
Referenced by creaImageIO::SQLiteTreeHandler::DBLoadChildren().
const std::string& creaImageIO::tree::Node::GetCleanAttribute | ( | const std::string & | k | ) | const |
Get the Attribute for a specific key without OS dependance (not implemented)
|
inline |
Returns the node data casted into the type T.
Definition at line 145 of file creaImageIOTreeNode.h.
References mData.
std::string creaImageIO::tree::Node::GetLabel | ( | ) | const |
Get the Label of the node.
Definition at line 239 of file creaImageIOTreeNode.cpp.
References creaImageIO::tree::LevelDescriptor::GetLabelList(), GetLevelDescriptor(), GimmickDebugMessage, GimmickError, and mAttributeMap.
Referenced by creaImageIO::WxGimmickView::CreateEditFieldsDialog(), creaImageIO::SQLiteTreeHandler::DBInsert(), creaImageIO::SQLiteTreeHandler::DBLoadChildren(), creaImageIO::SQLiteTreeHandler::DBSetAttribute(), Matches(), creaImageIO::tree::Tree::Print(), and Print().
|
inlinevirtual |
Returns the level of the node in the tree.
Reimplemented in creaImageIO::tree::Tree.
Definition at line 89 of file creaImageIOTreeNode.h.
References GetLevel(), and mParent.
Referenced by creaImageIO::SQLiteTreeHandler::AddBranch(), creaImageIO::SQLiteTreeHandler::DBGraftToParent(), creaImageIO::SQLiteTreeHandler::DBInsert(), creaImageIO::SQLiteTreeHandler::DBLoadChildren(), creaImageIO::SQLiteTreeHandler::DBRecursiveRemoveNode(), creaImageIO::SQLiteTreeHandler::DBSetAttribute(), GetAttributeDescriptor(), GetLevel(), GetLevelDescriptor(), creaImageIO::SQLiteTreeHandler::GetNumberOfChildren(), InitializeAttributeMap(), Node(), Print(), creaImageIO::SQLiteTreeHandler::Remove(), and creaImageIO::TimestampDatabaseHandler::RemoveNode().
const LevelDescriptor & creaImageIO::tree::Node::GetLevelDescriptor | ( | ) | const |
Returns the level descriptor of the node.
Definition at line 130 of file creaImageIOTreeNode.cpp.
References GetLevel(), creaImageIO::tree::Tree::GetLevelDescriptor(), and GetTree().
Referenced by GetLabel(), and Matches().
|
inline |
Returns the number of children of the node. Warning : if the children are not loaded then might return 0 even if the node has children ! see TreeHandler::GetNumberOfChildren
Definition at line 99 of file creaImageIOTreeNode.h.
References mChildren.
Referenced by creaImageIO::SQLiteTreeHandler::DBRecursiveRemoveNode(), creaImageIO::TreeHandlerImageAdder::RemoveFile(), and creaImageIO::TimestampDatabaseHandler::RemoveNode().
|
inline |
Returns the parent of the node.
Definition at line 93 of file creaImageIOTreeNode.h.
References mParent.
Referenced by creaImageIO::SQLiteTreeHandler::Remove().
|
inlinevirtual |
Returns the tree to which the node belongs.
Reimplemented in creaImageIO::tree::Tree.
Definition at line 85 of file creaImageIOTreeNode.h.
References GetTree(), and mParent.
Referenced by creaImageIO::SQLiteTreeHandler::DBLoadChildren(), GetAttributeDescriptor(), GetLevelDescriptor(), GetTree(), InitializeAttributeMap(), and Node().
|
inlinevirtual |
Returns the tree to which the node belongs.
Reimplemented in creaImageIO::tree::Tree.
Definition at line 87 of file creaImageIOTreeNode.h.
References GetTree(), and mParent.
void creaImageIO::tree::Node::InitializeAttributeMap | ( | ) |
Initializes the attribute map i.e. creates the entries.
Definition at line 115 of file creaImageIOTreeNode.cpp.
References creaImageIO::tree::Tree::GetAttributeDescriptorList(), GetLevel(), GetTree(), and UnsafeSetAttribute().
Referenced by creaImageIO::SQLiteTreeHandler::DBCreate(), and Node().
bool creaImageIO::tree::Node::Matches | ( | const AttributeMapType & | m | ) | const |
Returns true if the KEY attributes of the node match those of the map provided.
Definition at line 204 of file creaImageIOTreeNode.cpp.
References creaImageIO::tree::LevelDescriptor::GetIdentifierList(), GetLabel(), GetLevelDescriptor(), GimmickDebugMessage, and mAttributeMap.
|
virtual |
Print the node.
Reimplemented in creaImageIO::tree::Tree.
Definition at line 224 of file creaImageIOTreeNode.cpp.
References GetChildrenList(), GetLabel(), GetLevel(), and GimmickMessage.
int creaImageIO::tree::Node::RemoveChildrenFromList | ( | Node * | node | ) |
Remove the given children from the children list.
Definition at line 158 of file creaImageIOTreeNode.cpp.
References GetChildrenList().
Referenced by creaImageIO::SQLiteTreeHandler::Remove().
void creaImageIO::tree::Node::SetAttribute | ( | const std::string & | k, |
const std::string & | v | ||
) |
Set an Attribute for a specific key.
Definition at line 188 of file creaImageIOTreeNode.cpp.
References mAttributeMap.
Referenced by creaImageIO::SQLiteTreeHandler::DBGraftToParent(), creaImageIO::SQLiteTreeHandler::DBInsert(), creaImageIO::SQLiteTreeHandler::DBSetAttribute(), and creaImageIO::TreeHandlerImageAdder::EditField().
|
inline |
Sets the node's children.
Definition at line 105 of file creaImageIOTreeNode.h.
References mChildrenLoaded.
Referenced by creaImageIO::SQLiteTreeHandler::DBCreate(), creaImageIO::SQLiteTreeHandler::DBGraftToParent(), and creaImageIO::SQLiteTreeHandler::DBLoadChildren().
|
inline |
Sets the node data. Deletes existing data if any.
Definition at line 149 of file creaImageIOTreeNode.h.
References mData.
void creaImageIO::tree::Node::SortChildren | ( | const LexicographicalComparator & | ) |
Sorts the children of the node.
|
inline |
Set an Attribute for a specific key(unsafe mode)
Definition at line 135 of file creaImageIOTreeNode.h.
References mAttributeMap.
Referenced by creaImageIO::SQLiteTreeHandler::DBImportTreeDescription(), creaImageIO::SQLiteTreeHandler::DBLoadChildren(), InitializeAttributeMap(), and Node().
|
private |
The map of attributes.
Definition at line 167 of file creaImageIOTreeNode.h.
Referenced by GetAttribute(), GetAttributeMap(), GetLabel(), Matches(), SetAttribute(), and UnsafeSetAttribute().
|
private |
The list of children.
Definition at line 165 of file creaImageIOTreeNode.h.
Referenced by GetChildrenList(), and GetNumberOfChildren().
|
private |
Are the children loaded ?
Definition at line 171 of file creaImageIOTreeNode.h.
Referenced by GetChildrenLoaded(), and SetChildrenLoaded().
|
private |
|
private |
The parent of the node.
Definition at line 163 of file creaImageIOTreeNode.h.
Referenced by GetLevel(), GetParent(), and GetTree().