DirectoryItemDefinition.h 3.49 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*=========================================================================

Copyright (c) 1998-2012 Kitware Inc. 28 Corporate Drive,
Clifton Park, NY, 12065, USA.

All rights reserved. No part of this software may be reproduced, distributed,
or modified, in any form or by any means, without permission in writing from
Kitware Inc.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
"AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME DirectoryItemDefinition.h -
// .SECTION Description
// .SECTION See Also

27 28
#ifndef __smtk_attribute_DirectoryItemDefinition_h
#define __smtk_attribute_DirectoryItemDefinition_h
29

30 31
#include "smtk/SMTKCoreExports.h"
#include "smtk/PublicPointerDefs.h"
32

33
#include "smtk/attribute/ItemDefinition.h"
34

35
namespace smtk
36 37 38 39 40
{
  namespace attribute
  {
    class Attribute;
    class Definition;
41
    class SMTKCORE_EXPORT DirectoryItemDefinition:
42 43 44
      public ItemDefinition
    {
    public:
45 46
      static smtk::DirectoryItemDefinitionPtr New(const std::string &myName)
      { return smtk::DirectoryItemDefinitionPtr(new DirectoryItemDefinition(myName));}
47 48 49 50 51

      // This method is for wrapping code.  C++ developers should use smtk::dynamicCastPointer
      static smtk::DirectoryItemDefinitionPtr CastTo(const smtk::AttributeItemDefinitionPtr &p)
      {return smtk::dynamic_pointer_cast<DirectoryItemDefinition>(p);}

52
      virtual ~DirectoryItemDefinition();
53

Bob Obara's avatar
Bob Obara committed
54
      virtual Item::Type type() const;
55 56
      bool isValueValid(const std::string &val) const;

57
      virtual smtk::AttributeItemPtr buildItem(Attribute *owningAttribute,
58
                                                int itemPosition) const;
59
      virtual smtk::AttributeItemPtr buildItem(Item *owningItem,
60 61
                                                int position,
                                                int subGroupPosition) const;
62 63 64
      int numberOfRequiredValues() const
      {return this->m_numberOfRequiredValues;}
      void setNumberOfRequiredValues(int esize);
65 66 67 68 69 70

      bool hasValueLabels() const
      {return this->m_valueLabels.size();}

      void setValueLabel(int element, const std::string &elabel);
      void setCommonValueLabel(const std::string &elabel);
71 72
      bool usingCommonLabel() const
      {return this->m_useCommonLabel;}
73 74 75 76 77 78 79 80 81 82 83
      std::string valueLabel(int element) const;
      bool shouldExist() const
      {return this->m_shouldExist;}
      void setShouldExist(bool val)
      { this->m_shouldExist = val;}
      bool shouldBeRelative() const
      {return this->m_shouldBeRelative;}
      void setShouldBeRelative(bool val)
      {this->m_shouldBeRelative = val;}

    protected:
84 85 86 87 88 89 90
      DirectoryItemDefinition(const std::string &myName);
      bool m_shouldExist;
      bool m_shouldBeRelative;
      bool m_useCommonLabel;
      std::vector<std::string> m_valueLabels;
      int m_numberOfRequiredValues;
    private:
91

92
    };
93 94
  }
}
95

96
#endif /* __smtk_attribute_DirectoryItemDefinition_h */