#include <Iguana/Studio/interface/IgDocumentData.h>
Public Types | |
typedef std::map< std::string, IgSimpleTwig * > | TwigMap |
Public Member Functions | |
IgSimpleTwig * | add (const std::string &name, const std::string &rootName="") |
TwigMap::const_iterator | begin (void) |
IgDocument * | document (void) |
TwigMap::const_iterator | end (void) |
IgTwig * | find (const std::string &name, const std::string &rootName="") |
IgDocumentData (IgState *state, IgDocument *owner) | |
void | root (IgSimpleTwig *twig, const std::string &rootName="") |
IgSimpleTwig * | root (const std::string &name="", bool create=false) |
~IgDocumentData (void) | |
Private Member Functions | |
IG_DECLARE_STATE_ELEMENT (IgDocumentData) | |
Private Attributes | |
IgDocument * | m_document |
TwigMap | m_rootMap |
IgState * | m_state |
Definition at line 22 of file IgDocumentData.h.
typedef std::map<std::string, IgSimpleTwig *> IgDocumentData::TwigMap |
Definition at line 41 of file IgDocumentData.h.
IgDocumentData::IgDocumentData | ( | IgState * | state, | |
IgDocument * | owner | |||
) |
Definition at line 20 of file IgDocumentData.cc.
References ASSERT, m_state, and IgState::put().
00021 : m_state (state), 00022 m_document (owner) 00023 { 00024 ASSERT (m_state); 00025 // FIXME: temporarly removing the check, until IgDocument returns 00026 // Qt free. 00027 // ASSERT (m_document); 00028 m_state->put (s_key, this); 00029 }
IgDocumentData::~IgDocumentData | ( | void | ) |
Definition at line 31 of file IgDocumentData.cc.
References ASSERT, IgState::detach(), i, m_rootMap, and m_state.
00032 { 00033 ASSERT (m_state); 00034 //FIXME: assertion not needed. 00035 //ASSERT (m_document); 00036 00037 for (TwigMap::iterator i = m_rootMap.begin (); 00038 i != m_rootMap.end (); 00039 i++) 00040 { 00041 delete i->second; 00042 } 00043 00044 m_state->detach (s_key); 00045 }
IgSimpleTwig * IgDocumentData::add | ( | const std::string & | name, | |
const std::string & | rootName = "" | |||
) |
Definition at line 97 of file IgDocumentData.cc.
References ASSERT, m_state, and root().
00098 { 00099 // FIXME: Create subtree paths (breaking at `/' letters)? 00100 // FIXME: Notify document about changes? 00101 ASSERT (m_state); 00102 // NOTE: assertion not needed. 00103 //ASSERT (m_document); 00104 00105 return new IgSimpleTwig (root (rootName, true), name); 00106 }
IgDocumentData::TwigMap::const_iterator IgDocumentData::begin | ( | void | ) |
Definition at line 130 of file IgDocumentData.cc.
References m_rootMap.
00131 { 00132 return m_rootMap.begin (); 00133 }
IgDocument * IgDocumentData::document | ( | void | ) |
Definition at line 48 of file IgDocumentData.cc.
References ASSERT, m_document, and m_state.
00049 { 00050 ASSERT (m_state); 00051 ASSERT (m_document); 00052 00053 return m_document; 00054 }
IgDocumentData::TwigMap::const_iterator IgDocumentData::end | ( | void | ) |
Definition at line 136 of file IgDocumentData.cc.
References m_rootMap.
00137 { 00138 return m_rootMap.end (); 00139 }
IgTwig * IgDocumentData::find | ( | const std::string & | name, | |
const std::string & | rootName = "" | |||
) |
Definition at line 109 of file IgDocumentData.cc.
References ASSERT, IgCompoundTwig::child(), IgCompoundTwig::children(), i, m_state, IgTwig::name(), dbtoconf::parent, and root().
00110 { 00111 // FIXME: Search subtree path (breaking at `/' letters)? 00112 // FIXME: Notify document about changes? 00113 // FIXME: Provide special root twig that always notifies 00114 // document about changes and add a protocol for twigs 00115 // to notify their parents when they add children. 00116 ASSERT (m_state); 00117 // NOTE: Assertion not needed? 00118 //ASSERT (m_document); 00119 IgSimpleTwig *parent = root (rootName, true); 00120 for (unsigned i = 0; i < parent->children (); ++i) 00121 { 00122 IgTwig *child = parent->child (i); 00123 if (child->name () == name) 00124 return child; 00125 } 00126 return 0; 00127 }
IgDocumentData::IG_DECLARE_STATE_ELEMENT | ( | IgDocumentData | ) | [private] |
void IgDocumentData::root | ( | IgSimpleTwig * | twig, | |
const std::string & | rootName = "" | |||
) |
Definition at line 86 of file IgDocumentData.cc.
References ASSERT, IgDocumentDataRoot::getCurrentRoot(), m_rootMap, and n.
00088 { 00089 ASSERT (twig); 00090 std::string n = rootName; 00091 if (n.size () == 0) 00092 n = IgDocumentDataRoot::getCurrentRoot (); 00093 m_rootMap[n] = twig; 00094 }
IgSimpleTwig * IgDocumentData::root | ( | const std::string & | name = "" , |
|
bool | create = false | |||
) |
Definition at line 58 of file IgDocumentData.cc.
References ASSERT, IgDocumentDataRoot::getCurrentRoot(), i, m_rootMap, m_state, and n.
Referenced by add(), IgWebRZService::browse(), IgWebLegoService::browse(), IgWebTreeService::browse(), VisWebRootService::browse(), IgWebRPhiService::browse(), IgWeb2DService::browse(), IgWeb3DService::browse(), VisWebFrameworkService::doInitSession(), find(), IgWebTreeService::getRepID(), VisApplicationMain::setup(), IgNTupleAppMain::setup(), VisSimMain::setup(), VisG4ExampleSetup::setup(), and VisMagFieldDemoMain::setup().
00059 { 00060 ASSERT (m_state); 00061 // FIXME: needs proper fixing. Document should be Qt-less and also 00062 // the web application should create one. 00063 // ASSERT (m_document); 00064 00065 std::string n = name; 00066 if (n.size () == 0) 00067 n = IgDocumentDataRoot::getCurrentRoot (); 00068 00069 TwigMap::iterator i = m_rootMap.find (n); 00070 00071 if (i == m_rootMap.end ()) 00072 { 00073 IgSimpleTwig *twig = 0; 00074 00075 if (create) 00076 { 00077 twig = new IgSimpleTwig ("Objects"); 00078 m_rootMap[n] = twig; 00079 } 00080 return twig; 00081 } 00082 return i->second; 00083 }
IgDocument* IgDocumentData::m_document [private] |
TwigMap IgDocumentData::m_rootMap [private] |
Definition at line 48 of file IgDocumentData.h.
Referenced by begin(), end(), root(), and ~IgDocumentData().
IgState* IgDocumentData::m_state [private] |
Definition at line 46 of file IgDocumentData.h.
Referenced by add(), document(), find(), IgDocumentData(), root(), and ~IgDocumentData().