Commit 13e9ef18 authored by Bob Obara's avatar Bob Obara

ENH: Renamed Component to Item

parent 124ef41a
......@@ -40,23 +40,23 @@ namespace slctk
namespace attribute
{
class Attribute;
class AttributeReferenceComponent;
class AttributeReferenceComponentDefinition;
class AttributeReferenceItem;
class AttributeReferenceItemDefinition;
class Definition;
class Cluster;
class Component;
class ComponentDefinition;
class DoubleComponent;
class DoubleComponentDefinition;
class GroupComponent;
class GroupComponentDefinition;
class IntegerComponent;
class IntegerComponentDefinition;
class Item;
class ItemDefinition;
class DoubleItem;
class DoubleItemDefinition;
class GroupItem;
class GroupItemDefinition;
class IntegerItem;
class IntegerItemDefinition;
class Manager;
class StringComponent;
class StringComponentDefinition;
class ValueComponent;
class ValueComponentDefinition;
class StringItem;
class StringItemDefinition;
class ValueItem;
class ValueItemDefinition;
};
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::Attribute> AttributePtr;
......@@ -65,23 +65,23 @@ namespace slctk
typedef @POINTER_NAMESPACE@::shared_ptr<const attribute::Definition> ConstAttributeDefinitionPtr;
typedef @POINTER_NAMESPACE@::weak_ptr<attribute::Definition> WeakAttributeDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::AttributeReferenceComponent> AttributeReferenceComponentPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::AttributeReferenceComponentDefinition> AttributeReferenceComponentDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::AttributeReferenceItem> AttributeReferenceItemPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::AttributeReferenceItemDefinition> AttributeReferenceItemDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::Cluster> AttributeClusterPtr;
typedef @POINTER_NAMESPACE@::weak_ptr<attribute::Cluster> WeakAttributeClusterPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::Component> AttributeComponentPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<const attribute::Component> ConstAttributeComponentPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::ComponentDefinition> AttributeComponentDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<const attribute::ComponentDefinition> ConstAttributeComponentDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::ValueComponent> ValueComponentPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::DoubleComponent> DoubleComponentPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::DoubleComponentDefinition> DoubleComponentDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::IntegerComponent> IntegerComponentPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::IntegerComponentDefinition> IntegerComponentDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::StringComponent> StringComponentPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::StringComponentDefinition> StringComponentDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::Item> AttributeItemPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<const attribute::Item> ConstAttributeItemPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::ItemDefinition> AttributeItemDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<const attribute::ItemDefinition> ConstAttributeItemDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::ValueItem> ValueItemPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::DoubleItem> DoubleItemPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::DoubleItemDefinition> DoubleItemDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::IntegerItem> IntegerItemPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::IntegerItemDefinition> IntegerItemDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::StringItem> StringItemPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::StringItemDefinition> StringItemDefinitionPtr;
typedef @POINTER_NAMESPACE@::shared_ptr<attribute::Manager> AttributeManagerPtr;
......
......@@ -23,9 +23,9 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "attribute/Attribute.h"
#include "attribute/AttributeReferenceComponent.h"
#include "attribute/AttributeReferenceItem.h"
#include "attribute/Cluster.h"
#include "attribute/Component.h"
#include "attribute/Item.h"
#include "attribute/Definition.h"
#include <iostream>
using namespace slctk::attribute;
......@@ -41,12 +41,12 @@ Attribute::~Attribute()
{
std::cout << "Deleting Attribute " << this->name() << "\n";
this->removeAllAssociations();
this->removeAllComponents();
this->removeAllItems();
}
//----------------------------------------------------------------------------
void Attribute::removeAllComponents()
void Attribute::removeAllItems()
{
this->m_components.clear();
this->m_items.clear();
}
//----------------------------------------------------------------------------
const std::string &Attribute::type() const
......@@ -119,20 +119,20 @@ void Attribute::removeAllAssociations()
}
}
//----------------------------------------------------------------------------
slctk::ConstAttributeComponentPtr Attribute::find(const std::string &name) const
slctk::ConstAttributeItemPtr Attribute::find(const std::string &name) const
{
int i = this->definition()->findComponentPosition(name);
int i = this->definition()->findItemPosition(name);
if (i < 0)
{
return slctk::ConstAttributeComponentPtr();
return slctk::ConstAttributeItemPtr();
}
return this->m_components[i];
return this->m_items[i];
}
//----------------------------------------------------------------------------
slctk::AttributeComponentPtr Attribute::find(const std::string &name)
slctk::AttributeItemPtr Attribute::find(const std::string &name)
{
int i = this->definition()->findComponentPosition(name);
return (i < 0) ? slctk::AttributeComponentPtr() : this->m_components[i];
int i = this->definition()->findItemPosition(name);
return (i < 0) ? slctk::AttributeItemPtr() : this->m_items[i];
}
//----------------------------------------------------------------------------
......@@ -42,15 +42,15 @@ namespace slctk
namespace attribute
{
class AttributeReferenceComponent;
class Component;
class AttributeReferenceItem;
class Item;
class Definition;
class Cluster;
class Manager;
class SLCTKATTRIBUTE_EXPORT Attribute
{
friend class slctk::attribute::AttributeReferenceComponent;
friend class slctk::attribute::AttributeReferenceItem;
friend class slctk::attribute::Cluster;
friend class slctk::attribute::Definition;
public:
......@@ -72,17 +72,17 @@ namespace slctk
bool isMemberOf(const std::string &catagory) const;
bool isMemberOf(const std::vector<std::string> &catagories) const;
slctk::AttributeComponentPtr component(int ith) const
slctk::AttributeItemPtr item(int ith) const
{
return (ith < 0) ? slctk::AttributeComponentPtr() :
(ith >= this->m_components.size() ?
slctk::AttributeComponentPtr() : this->m_components[ith]);
return (ith < 0) ? slctk::AttributeItemPtr() :
(ith >= this->m_items.size() ?
slctk::AttributeItemPtr() : this->m_items[ith]);
}
slctk::AttributeComponentPtr find(const std::string &name) ;
slctk::ConstAttributeComponentPtr find(const std::string &name) const;
std::size_t numberOfComponents() const
{return this->m_components.size();}
slctk::AttributeItemPtr find(const std::string &name) ;
slctk::ConstAttributeItemPtr find(const std::string &name) const;
std::size_t numberOfItems() const
{return this->m_items.size();}
std::size_t numberOfAssociatedEntities() const
{ return this->m_entities.size();}
......@@ -111,14 +111,14 @@ namespace slctk
{return this->m_cluster.lock();}
protected:
void removeAllComponents();
void addComponent(slctk::AttributeComponentPtr component)
{this->m_components.push_back(component);}
void removeAllItems();
void addItem(slctk::AttributeItemPtr item)
{this->m_items.push_back(item);}
void setName(const std::string &newname)
{this->m_name = newname;}
std::string m_name;
std::vector<slctk::AttributeComponentPtr> m_components;
std::vector<slctk::AttributeItemPtr> m_items;
unsigned long m_id;
slctk::WeakAttributeClusterPtr m_cluster;
std::set<slctk::ModelEntity *> m_entities;
......
......@@ -22,30 +22,30 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
#include "attribute/AttributeReferenceComponent.h"
#include "attribute/AttributeReferenceComponentDefinition.h"
#include "attribute/AttributeReferenceItem.h"
#include "attribute/AttributeReferenceItemDefinition.h"
#include "attribute/Attribute.h"
#include <iostream>
using namespace slctk::attribute;
//----------------------------------------------------------------------------
AttributeReferenceComponent::AttributeReferenceComponent()
AttributeReferenceItem::AttributeReferenceItem()
{
}
//----------------------------------------------------------------------------
bool AttributeReferenceComponent::
setDefinition(slctk::ConstAttributeComponentDefinitionPtr adef)
bool AttributeReferenceItem::
setDefinition(slctk::ConstAttributeItemDefinitionPtr adef)
{
// Note that we do a dynamic cast here since we don't
// know if the proper definition is being passed
const AttributeReferenceComponentDefinition *def =
dynamic_cast<const AttributeReferenceComponentDefinition *>(adef.get());
const AttributeReferenceItemDefinition *def =
dynamic_cast<const AttributeReferenceItemDefinition *>(adef.get());
// Call the parent's set definition - similar to constructor calls
// we call from base to derived
if ((def == NULL) || (!Component::setDefinition(adef)))
if ((def == NULL) || (!Item::setDefinition(adef)))
{
return false;
}
......@@ -58,20 +58,20 @@ setDefinition(slctk::ConstAttributeComponentDefinitionPtr adef)
}
//----------------------------------------------------------------------------
AttributeReferenceComponent::~AttributeReferenceComponent()
AttributeReferenceItem::~AttributeReferenceItem()
{
}
//----------------------------------------------------------------------------
Component::Type AttributeReferenceComponent::type() const
Item::Type AttributeReferenceItem::type() const
{
return ATTRIBUTE_REFERENCE;
}
//----------------------------------------------------------------------------
bool AttributeReferenceComponent::setValue(int element, slctk::AttributePtr att)
bool AttributeReferenceItem::setValue(int element, slctk::AttributePtr att)
{
const AttributeReferenceComponentDefinition *def =
static_cast<const AttributeReferenceComponentDefinition *>(this->definition().get());
const AttributeReferenceItemDefinition *def =
static_cast<const AttributeReferenceItemDefinition *>(this->definition().get());
if (def->isValueValid(att))
{
this->m_values[element] = att;
......@@ -81,7 +81,7 @@ bool AttributeReferenceComponent::setValue(int element, slctk::AttributePtr att)
}
//----------------------------------------------------------------------------
std::string
AttributeReferenceComponent::valueAsString(int element,
AttributeReferenceItem::valueAsString(int element,
const std::string &format) const
{
// For the initial design we will use sprintf and force a limit of 300 char
......@@ -98,11 +98,11 @@ AttributeReferenceComponent::valueAsString(int element,
}
//----------------------------------------------------------------------------
bool
AttributeReferenceComponent::appendValue(slctk::AttributePtr val)
AttributeReferenceItem::appendValue(slctk::AttributePtr val)
{
//First - are we allowed to change the number of values?
const AttributeReferenceComponentDefinition *def =
static_cast<const AttributeReferenceComponentDefinition *>(this->definition().get());
const AttributeReferenceItemDefinition *def =
static_cast<const AttributeReferenceItemDefinition *>(this->definition().get());
int n = def->numberOfValues();
if (n)
{
......@@ -118,11 +118,11 @@ AttributeReferenceComponent::appendValue(slctk::AttributePtr val)
}
//----------------------------------------------------------------------------
bool
AttributeReferenceComponent::removeValue(int element)
AttributeReferenceItem::removeValue(int element)
{
//First - are we allowed to change the number of values?
const AttributeReferenceComponentDefinition *def =
static_cast<const AttributeReferenceComponentDefinition *>(this->definition().get());
const AttributeReferenceItemDefinition *def =
static_cast<const AttributeReferenceItemDefinition *>(this->definition().get());
int n = def->numberOfValues();
if (n)
{
......@@ -133,10 +133,10 @@ AttributeReferenceComponent::removeValue(int element)
}
//----------------------------------------------------------------------------
void
AttributeReferenceComponent::reset()
AttributeReferenceItem::reset()
{
const AttributeReferenceComponentDefinition *def
= static_cast<const AttributeReferenceComponentDefinition *>(this->definition().get());
const AttributeReferenceItemDefinition *def
= static_cast<const AttributeReferenceItemDefinition *>(this->definition().get());
// Was the initial size 0?
int i, n = def->numberOfValues();
if (!n)
......
......@@ -20,16 +20,16 @@ PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME AttributeReferenceComponent.h -
// .NAME AttributeReferenceItem.h -
// .SECTION Description
// .SECTION See Also
#ifndef __slctk_attribute_AttributeReferenceComponent_h
#define __slctk_attribute_AttributeReferenceComponent_h
#ifndef __slctk_attribute_AttributeReferenceItem_h
#define __slctk_attribute_AttributeReferenceItem_h
#include "AttributeExports.h"
#include "attribute/PublicPointerDefs.h"
#include "attribute/Component.h"
#include "attribute/Item.h"
#include <vector>
namespace slctk
......@@ -37,14 +37,14 @@ namespace slctk
namespace attribute
{
class Attribute;
class AttributeReferenceComponentDefinition;
class SLCTKATTRIBUTE_EXPORT AttributeReferenceComponent : public Component
class AttributeReferenceItemDefinition;
class SLCTKATTRIBUTE_EXPORT AttributeReferenceItem : public Item
{
public:
AttributeReferenceComponent();
virtual ~AttributeReferenceComponent();
virtual Component::Type type() const;
virtual bool setDefinition(slctk::ConstAttributeComponentDefinitionPtr def);
AttributeReferenceItem();
virtual ~AttributeReferenceItem();
virtual Item::Type type() const;
virtual bool setDefinition(slctk::ConstAttributeItemDefinitionPtr def);
slctk::AttributePtr value(int element=0) const
{return this->m_values[element].lock();}
bool setValue( slctk::AttributePtr val)
......@@ -69,4 +69,4 @@ namespace slctk
};
#endif /* __slctk_attribute_AttributeReferenceComponent_h */
#endif /* __slctk_attribute_AttributeReferenceItem_h */
......@@ -22,28 +22,28 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
#include "attribute/AttributeReferenceComponentDefinition.h"
#include "attribute/AttributeReferenceItemDefinition.h"
#include "attribute/Attribute.h"
#include "attribute/AttributeReferenceComponent.h"
#include "attribute/AttributeReferenceItem.h"
using namespace slctk::attribute;
//----------------------------------------------------------------------------
AttributeReferenceComponentDefinition::
AttributeReferenceComponentDefinition(const std::string &myName):
ComponentDefinition(myName), m_definition()
AttributeReferenceItemDefinition::
AttributeReferenceItemDefinition(const std::string &myName):
ItemDefinition(myName), m_definition()
{
this->m_useCommonLabel = false;
this->m_numberOfValues = 0;
}
//----------------------------------------------------------------------------
AttributeReferenceComponentDefinition::~AttributeReferenceComponentDefinition()
AttributeReferenceItemDefinition::~AttributeReferenceItemDefinition()
{
}
//----------------------------------------------------------------------------
bool
AttributeReferenceComponentDefinition::isValueValid(slctk::AttributePtr att) const
AttributeReferenceItemDefinition::isValueValid(slctk::AttributePtr att) const
{
if (att == NULL)
{
......@@ -56,12 +56,12 @@ AttributeReferenceComponentDefinition::isValueValid(slctk::AttributePtr att) con
return true;
}
//----------------------------------------------------------------------------
slctk::AttributeComponentPtr AttributeReferenceComponentDefinition::buildComponent() const
slctk::AttributeItemPtr AttributeReferenceItemDefinition::buildItem() const
{
return slctk::AttributeComponentPtr(new AttributeReferenceComponent());
return slctk::AttributeItemPtr(new AttributeReferenceItem());
}
//----------------------------------------------------------------------------
void AttributeReferenceComponentDefinition::setNumberOfValues(int esize)
void AttributeReferenceItemDefinition::setNumberOfValues(int esize)
{
if (esize == this->m_numberOfValues)
{
......@@ -74,7 +74,7 @@ void AttributeReferenceComponentDefinition::setNumberOfValues(int esize)
}
}
//----------------------------------------------------------------------------
void AttributeReferenceComponentDefinition::setValueLabel(int element, const std::string &elabel)
void AttributeReferenceItemDefinition::setValueLabel(int element, const std::string &elabel)
{
if (this->m_numberOfValues == 0)
{
......@@ -88,7 +88,7 @@ void AttributeReferenceComponentDefinition::setValueLabel(int element, const std
this->m_valueLabels[element] = elabel;
}
//----------------------------------------------------------------------------
void AttributeReferenceComponentDefinition::setCommonValueLabel(const std::string &elabel)
void AttributeReferenceItemDefinition::setCommonValueLabel(const std::string &elabel)
{
if (this->m_valueLabels.size() != 1)
{
......@@ -99,7 +99,7 @@ void AttributeReferenceComponentDefinition::setCommonValueLabel(const std::strin
}
//----------------------------------------------------------------------------
std::string AttributeReferenceComponentDefinition::valueLabel(int element) const
std::string AttributeReferenceItemDefinition::valueLabel(int element) const
{
if (this->m_useCommonLabel)
{
......
......@@ -20,17 +20,17 @@ PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME AttributeReferenceComponentDefinition.h -
// .NAME AttributeReferenceItemDefinition.h -
// .SECTION Description
// .SECTION See Also
#ifndef __slctk_attribute_AttributeReferenceComponentDefinition_h
#define __slctk_attribute_AttributeReferenceComponentDefinition_h
#ifndef __slctk_attribute_AttributeReferenceItemDefinition_h
#define __slctk_attribute_AttributeReferenceItemDefinition_h
#include "AttributeExports.h"
#include "attribute/PublicPointerDefs.h"
#include "ComponentDefinition.h"
#include "ItemDefinition.h"
namespace slctk
{
......@@ -38,12 +38,12 @@ namespace slctk
{
class Attribute;
class Definition;
class SLCTKATTRIBUTE_EXPORT AttributeReferenceComponentDefinition:
public ComponentDefinition
class SLCTKATTRIBUTE_EXPORT AttributeReferenceItemDefinition:
public ItemDefinition
{
public:
AttributeReferenceComponentDefinition(const std::string &myName);
virtual ~AttributeReferenceComponentDefinition();
AttributeReferenceItemDefinition(const std::string &myName);
virtual ~AttributeReferenceItemDefinition();
slctk::AttributeDefinitionPtr attributeDefinition() const
{return this->m_definition.lock();}
......@@ -53,7 +53,7 @@ namespace slctk
bool isValueValid(slctk::AttributePtr att) const;
virtual slctk::AttributeComponentPtr buildComponent() const;
virtual slctk::AttributeItemPtr buildItem() const;
int numberOfValues() const
{return this->m_numberOfValues;}
void setNumberOfValues(int esize);
......@@ -75,4 +75,4 @@ namespace slctk
};
};
#endif /* __slctk_attribute_AttributeReferenceComponentDefinition_h */
#endif /* __slctk_attribute_AttributeReferenceItemDefinition_h */
......@@ -2,46 +2,46 @@ project(Slctk_Attribute)
set(headers
Attribute.h
AttributeReferenceComponent.h
AttributeReferenceComponentDefinition.h
AttributeReferenceItem.h
AttributeReferenceItemDefinition.h
Cluster.h
Component.h
ComponentDefinition.h
Item.h
ItemDefinition.h
Definition.h
DoubleComponent.h
DoubleComponentDefinition.h
GroupComponent.h
GroupComponentDefinition.h
IntegerComponent.h
IntegerComponentDefinition.h
DoubleItem.h
DoubleItemDefinition.h
GroupItem.h
GroupItemDefinition.h
IntegerItem.h
IntegerItemDefinition.h
Manager.h
StringComponent.h
StringComponentDefinition.h
ValueComponent.h
ValueComponentDefinition.h
ValueComponentDefinitionTemplate.h
ValueComponentTemplate.h
StringItem.h
StringItemDefinition.h
ValueItem.h
ValueItemDefinition.h
ValueItemDefinitionTemplate.h
ValueItemTemplate.h
)
set(attribute_srcs
Attribute.cxx
AttributeReferenceComponent.cxx
AttributeReferenceComponentDefinition.cxx
AttributeReferenceItem.cxx
AttributeReferenceItemDefinition.cxx
Cluster.cxx
Component.cxx
ComponentDefinition.cxx
Item.cxx
ItemDefinition.cxx
Definition.cxx
DoubleComponent.cxx
DoubleComponentDefinition.cxx
GroupComponent.cxx
GroupComponentDefinition.cxx
IntegerComponent.cxx
IntegerComponentDefinition.cxx
DoubleItem.cxx
DoubleItemDefinition.cxx
GroupItem.cxx
GroupItemDefinition.cxx
IntegerItem.cxx
IntegerItemDefinition.cxx
Manager.cxx
StringComponent.cxx
StringComponentDefinition.cxx
ValueComponent.cxx
ValueComponentDefinition.cxx
StringItem.cxx
StringItemDefinition.cxx
ValueItem.cxx
ValueItemDefinition.cxx
)
add_library(SlctkAttribute ${attribute_srcs} ${headers})
......
......@@ -26,8 +26,8 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "attribute/Attribute.h"
#include "attribute/Cluster.h"
#include "attribute/Component.h"
#include "attribute/ComponentDefinition.h"
#include "attribute/Item.h"
#include "attribute/ItemDefinition.h"
#include <iostream>
using namespace slctk::attribute;
......@@ -138,7 +138,7 @@ Definition::canBeAssociated(slctk::ModelEntity *entity,
//----------------------------------------------------------------------------
void Definition::buildAttribute(AttributePtr att) const
{
// If there is a super definition have it prep the attribute and add its components
// If there is a super definition have it prep the attribute and add its items
const Definition *bdef = this->baseDefinition().get();
if (bdef)
{
......@@ -147,19 +147,19 @@ void Definition::buildAttribute(AttributePtr att) const
else
{
// This is the "base definition" so first we should make sure the attribute
// is "empty" of components
att->removeAllComponents();
// is "empty" of items
att->removeAllItems();
}
// Next - for each component definition we have build and add the appropriate
// component to the attribute
slctk::AttributeComponentPtr comp;
std::size_t i, n = this->m_componentDefs.size();
// Next - for each item definition we have build and add the appropriate
// item to the attribute
slctk::AttributeItemPtr comp;
std::size_t i, n = this->m_itemDefs.size();
for (i = 0; i < n; i++)
{
comp = this->m_componentDefs[i]->buildComponent();
comp->setDefinition(this->m_componentDefs[i]);
att->addComponent(comp);
comp = this->m_itemDefs[i]->buildItem();
comp->setDefinition(this->m_itemDefs[i]);
att->addItem(comp);
}
}
//----------------------------------------------------------------------------
......@@ -174,16 +174,16 @@ bool Definition::isMemberOf(const std::vector<std::string> &catagories) const
return false;
}
//----------------------------------------------------------------------------
bool Definition::addComponentDefinition(slctk::AttributeComponentDefinitionPtr cdef)
bool Definition::addItemDefinition(slctk::AttributeItemDefinitionPtr cdef)
{
// First see if there is a component by the same name
if (this->findComponentPosition(cdef->name()) >= 0)
// First see if there is a item by the same name
if (this->findItemPosition(cdef->name()) >= 0)
{
return false;
}
std::size_t n = this->m_componentDefs.size();
this->m_componentDefs.push_back(cdef);
this->m_componentDefPositions[cdef->name()] = n;
std::size_t n = this->m_itemDefs.size();
this->m_itemDefs.push_back(cdef);
this->m_itemDefPositions[cdef->name()] = n;
return true;
}
//----------------------------------------------------------------------------
......@@ -41,7 +41,7 @@ namespace slctk
{
class Attribute;
class Cluster;
class ComponentDefinition;
class ItemDefinition;
class Manager;
class SLCTKATTRIBUTE_EXPORT Definition
......@@ -132,26 +132,26 @@ namespace slctk
bool canBeAssociated(slctk::ModelEntity *entity,
std::vector<slctk::attribute::Attribute *>*conflicts) const;
bool conflicts(slctk::AttributeDefinitionPtr definition) const;
std::size_t numberOfComponentDefinitions() const
{return this->m_componentDefs.size();}
slctk::AttributeComponentDefinitionPtr componentDefinition(int ith) const
std::size_t numberOfItemDefinitions() const
{return this->m_itemDefs.size();}
slctk::AttributeItemDefinitionPtr itemDefinition(int ith) const
{
return (ith < 0) ? slctk::AttributeComponentDefinitionPtr()
: (ith >= this->m_componentDefs.size() ?
slctk::AttributeComponentDefinitionPtr() : this->m_componentDefs[ith]);
return (ith < 0) ? slctk::AttributeItemDefinitionPtr()
: (ith >= this->m_itemDefs.size() ?
slctk::AttributeItemDefinitionPtr() : this->m_itemDefs[ith]);
}
bool addComponentDefinition(slctk::AttributeComponentDefinitionPtr cdef);
bool addItemDefinition(slctk::AttributeItemDefinitionPtr cdef);
template<typename T>
typename slctk::shared_ptr_type<T>::type addDef(const std::string &name)
{
typedef slctk::shared_ptr_type<T> SharedTypes;
typename SharedTypes::type comp(new typename SharedTypes::T_Type(name));
this->m_componentDefs.push_back(comp);
this->m_itemDefs.push_back(comp);
return comp;
}
int findComponentPosition(const std::string &name) const;
int findItemPosition(const std::string &name) const;
const char *detailedDescription() const
{return this->m_detailedDescription.c_str();}
......@@ -178,8 +178,8 @@ namespace slctk
bool m_isNodal;
std::set<std::string> m_catagories;
int m_advanceLevel;
std::vector<slctk::AttributeComponentDefinitionPtr> m_componentDefs;
std::map<std::string, int> m_componentDefPositions;
std::vector<slctk::AttributeItemDefinitionPtr> m_itemDefs;
std::map<std::string, int> m_itemDefPositions;
//Is Unique indicates if more than one attribute of this type can be assigned to a
// model entity - NOTE This can be inherited meaning that if the definition's Super definition
// has isUnique = true it will also prevent an attribute from this definition being assigned if the
......@@ -193,13 +193,13 @@ namespace slctk
};
//----------------------------------------------------------------------------
inline int Definition::findComponentPosition(const std::string &name) const
inline int Definition::findItemPosition(const std::string &name) const
{
std::map<std::string, int>::const_iterator it;
it = this->m_componentDefPositions.find(name);
if (it == this->m_componentDefPositions.end())
it = this->m_itemDefPositions.find(name);
if (it == this->m_itemDefPositions.end())
{
return -1; // named component doesn't exist
return -1; // named item doesn't exist
}
return it->second;
}
......
......@@ -22,22 +22,22 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/