Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData
In directory sc8-pr-cvs1:/tmp/cvs-serv6390/Include/SimData
Modified Files:
Tag: b0_4_0
Composite.h
Log Message:
Index: Composite.h
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/Attic/Composite.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** Composite.h 6 Sep 2003 07:06:30 -0000 1.1.2.2
--- Composite.h 6 Sep 2003 08:52:06 -0000 1.1.2.3
***************
*** 35,38 ****
--- 35,39 ----
#include <vector>
#include <SimData/Ref.h>
+ #include <SimData/Log.h>
***************
*** 238,242 ****
*/
virtual bool addChild(Node *node) {
! if (containsNode(node)) return false;
_children.push_back(node);
node->addParent(this);
--- 239,258 ----
*/
virtual bool addChild(Node *node) {
! if (!isContainer()) {
! SIMDATA_LOG(LOG_ALL, LOG_WARNING, "simdata::Composite<>::addChild() to non-container.");
! return false;
! }
! if (!node) {
! SIMDATA_LOG(LOG_ALL, LOG_WARNING, "simdata::Composite<>::addChild() null node.");
! return false;
! }
! if (!node->canBeAdded()) {
! SIMDATA_LOG(LOG_ALL, LOG_WARNING, "simdata::Composite<>::addChild() cannot be added.");
! return false;
! }
! if (containsNode(node)) {
! SIMDATA_LOG(LOG_ALL, LOG_WARNING, "simdata::Composite<>::addChild() duplicate node.");
! return false;
! }
_children.push_back(node);
node->addParent(this);
***************
*** 263,267 ****
unsigned int end = pos + count;
if (end > _children.size()) {
! // TODO log warning
end = _children.size();
}
--- 279,283 ----
unsigned int end = pos + count;
if (end > _children.size()) {
! SIMDATA_LOG(LOG_ALL, LOG_WARNING, "simdata::Composite<>::removeChild() index range truncated.");
end = _children.size();
}
***************
*** 360,363 ****
--- 376,382 ----
*/
inline unsigned int getNumParents() const { return _parents.size(); }
+
+ virtual bool isContainer() const { return true; }
+ virtual bool canBeAdded() const { return true; }
protected:
|