39#ifndef INCLUDED_DISTI_METADATA_H
40#define INCLUDED_DISTI_METADATA_H
43# pragma warning( push )
44# pragma warning( disable : 4786 )
45# pragma warning( disable : 4251 )
70#if GLS_DEBUG_ATTRIBUTE_NAMES
71# define IF_GLS_DEBUG_ATTRIBUTE_NAMES( x ) x
73# define IF_GLS_DEBUG_ATTRIBUTE_NAMES( x )
78class CallbackMethodCallerBase;
109 : _stringIndex( other._stringIndex )
119 _stringIndex = other._stringIndex;
128 DISTI_EXPORT
operator std::string()
const;
139 void Initialize(
const char* name );
167 return !( attr1 == attr2 );
197class DistiAttributeBase;
214class DistiAttributeObserverList;
330 virtual std::ostream&
WriteValue( std::ostream& outstr ) = 0;
341 virtual std::istream&
ReadValue( std::istream& instr ) = 0;
354 template<
class valType>
370 template<
class valType>
485 ( *objAttr ) << attr.ValueString();
507 const char* attributeName )
534 if( newValue != property )
537 object->NotifyAttributeChanged( name );
544class DistiAttribDict;
649 return ReadValueImpl( instr );
696 std::istream& ReadValueImpl( std::istream& instr )
711inline std::istream& DistiAttribute<float>::ReadValueImpl( std::istream& instr )
715 *_attribPtr =
static_cast<float>( atof( instrBuf ) );
722inline std::istream& DistiAttribute<double>::ReadValueImpl( std::istream& instr )
726 *_attribPtr = atof( instrBuf );
740 typedef std::multimap<long, Attr_t>
Map_t;
751#if defined( DISTI_HAS_RVAL_REFS )
756 *
this = std::move( other );
766 _list = std::move( other._list );
767 _map = std::move( other._map );
798 DISTI_DEPRECATED(
"Renamed to CopyCommonValues() to better represent the action taken by this function." )
858 DISTI_EXPORT
void Write( std::ostream& outstr,
bool changedDataOnly =
false );
863 DISTI_EXPORT
bool Read( std::istream& instr );
934 static DISTI_EXPORT
bool ScanToken( std::istream& instr, std::string& result );
995 virtual DISTI_EXPORT
int EnumToInt(
const std::string&
string );
1003template<
class containerClass,
class setType,
class getType>
1070 bool foundIt =
false;
1072 DistiAttributeEnumDefList::iterator item =
_pairList->begin();
1073 while( item !=
_pairList->end() && *item )
1075 if( ( *item )->_enum == value )
1077 outstr << ( *item )->_string;
1097 DistiAttributeEnumDefList::iterator item =
_pairList->begin();
1099 while( item !=
_pairList->end() && *item )
1101 if( strcmp( ( *item )->_string,
string.c_str() ) == 0 )
1103 returnVal = ( *item )->_enum;
1119 bool foundIt =
false;
1120 DistiAttributeEnumDefList::iterator item =
_pairList->begin();
1123 while( item !=
_pairList->end() && *item )
1125 if( strcmp( ( *item )->_string, value ) == 0 )
1147# pragma warning( pop )
Definition: disti_metadata.h:514
virtual void NotifyAttributeChanged(const AttributeName &name)=0
virtual ~AttributeChangedNotifier()
Definition: disti_metadata.h:522
Definition: disti_metadata.h:417
AttributeMethodCallback(T *object, Callback method)
Definition: disti_metadata.h:424
WeakRef< T > _object
The underlying object containing the callback method.
Definition: disti_metadata.h:447
Callback _method
Method to call back when invoked.
Definition: disti_metadata.h:446
virtual bool IsValid() const override
Definition: disti_metadata.h:440
void(T::* Callback)(DistiAttributeBase &attr)
Typedef for the callback function pointer.
Definition: disti_metadata.h:419
void Call(DistiAttributeBase &ev) override
Definition: disti_metadata.h:432
Definition: disti_metadata.h:87
AttributeName & operator=(const AttributeName &other)
Definition: disti_metadata.h:117
AttributeName(const AttributeName &other)
Definition: disti_metadata.h:108
long StringIndex() const
Definition: disti_metadata.h:125
AttributeName(const std::string &name)
Definition: disti_metadata.h:201
virtual void Call(DistiAttributeBase &attr)=0
virtual bool IsValid() const =0
Definition: disti_metadata.h:467
WeakRef< T > _object
The object containing the attribute.
Definition: disti_metadata.h:497
AttributeName _attributeName
The attribute to set when invoked.
Definition: disti_metadata.h:496
virtual bool IsValid() const override
Definition: disti_metadata.h:490
void Call(DistiAttributeBase &attr) override
Definition: disti_metadata.h:479
AttributeResourceCallback(T *object, const AttributeName &attributeName)
Definition: disti_metadata.h:472
Definition: callback_caller_base.h:56
Definition: disti_metadata.h:734
static bool ScanToken(std::istream &instr, std::string &result)
bool Read(std::istream &instr)
List_t::const_iterator const_iterator
Shorthand for List_t::const_iterator.
Definition: disti_metadata.h:742
std::multimap< long, Attr_t > Map_t
Typedef for a map ot attribute pointers.
Definition: disti_metadata.h:740
static long _currentFileVersionSecondary
Definition: disti_metadata.h:791
iterator Begin()
Definition: disti_metadata.h:828
bool IsEqual(const AttributeName &name, const long val) const
void CopyCommonValues(const DistiAttribDict &dict)
void Write(std::ostream &outstr, bool changedDataOnly=false)
iterator End()
Definition: disti_metadata.h:831
std::istream & ReadValue(const AttributeName &name, std::istream &instr)
List_t::iterator iterator
Shorthand for List_t::iterator.
Definition: disti_metadata.h:743
DistiAttribDict & operator=(DistiAttribDict &&other)
Definition: disti_metadata.h:762
static unsigned int _currentFileVersionMinor
Definition: disti_metadata.h:784
DistiAttributeBase * Get(const AttributeName &name) const
std::list< Attr_t > List_t
Typedef for a list of attribute pointers.
Definition: disti_metadata.h:739
std::string ValueString(const AttributeName &name) const
void Add(DistiAttributeBase *attr)
const_iterator End() const
Definition: disti_metadata.h:825
DistiAttributeBase * Attr_t
Definition: disti_metadata.h:737
void ReadStrings(std::istream &instr)
static void SpacingZero()
void Remove(const AttributeName &name)
long ValueInt(const AttributeName &name) const
std::ostream & WriteValue(const AttributeName &name, std::ostream &outstr)
static unsigned int _currentFileVersionMajor
Definition: disti_metadata.h:782
static int currentOutputSpacing
Definition: disti_metadata.h:914
bool ReadAndCaptureMissing(std::istream &instr, std::stringstream *missingStream)
static unsigned int _currentFileVersionBuild
Definition: disti_metadata.h:786
const_iterator Begin() const
Definition: disti_metadata.h:822
static double _currentFileVersionPrimary
Definition: disti_metadata.h:789
static std::string SpacingString()
bool operator==(const DistiAttribDict &other)
void Delete(const AttributeName &name)
Definition: disti_metadata.h:220
virtual bool ValueChanged()
bool LocalStorage() const
bool _localStorage
Definition: disti_metadata.h:237
const AttributeName & Name() const
virtual double ValueFloat()
virtual void NotifyObservers()
virtual CallbackID RegisterObserver(AttributeObserver *observer)
virtual std::string ValueString()
ScopedPtr< DistiAttributeObserverList > _observerList
Definition: disti_metadata.h:231
virtual bool operator==(const DistiAttributeBase &r)
CallbackMethodCallerBase * _callback
Definition: disti_metadata.h:228
virtual std::ostream & WriteValue(std::ostream &outstr)=0
virtual bool OkToWrite() const
virtual void CallCallback()
Calls callback CallType3 if it has been set.
virtual void ResetValueChanged()
virtual bool Copyable() const
virtual void UnregisterObserver(CallbackID id)
DistiAttributeBase & operator>>(valType &val)
Definition: disti_metadata.h:371
DistiAttributeBase & operator<<(const valType &val)
Definition: disti_metadata.h:355
AttributeName _name
Definition: disti_metadata.h:226
virtual DistiAttributeBase & operator=(const DistiAttributeBase &oldClass)
virtual std::istream & ReadValue(std::istream &instr)=0
unsigned int CallbackID
Type for unique identifiers.
Definition: disti_metadata.h:394
Definition: disti_metadata.h:986
DistiAttributeEnumDefList(char *stringVal,...)
virtual int EnumToInt(const std::string &string)
Definition: disti_metadata.h:1005
DistiAttributeEnum(containerClass *object, SetMethodType setMethod, GetMethodType getMethod, const AttributeName &name)
Definition: disti_metadata.h:1021
virtual void ValueInt(long val) override
Definition: disti_metadata.h:1043
void(containerClass::* SetMethodType)(setType)
Typedef for the set method function pointer.
Definition: disti_metadata.h:1007
GetMethodType _getMethod
Get method member function pointer.
Definition: disti_metadata.h:1014
int EnumToInt(std::string &string)
Definition: disti_metadata.h:1094
DistiAttributeEnumDefList * _pairList
A list of name value pairs describing the enumeration.
Definition: disti_metadata.h:1010
SetMethodType _setMethod
Set method member function pointer.
Definition: disti_metadata.h:1013
getType(containerClass::* GetMethodType)()
Typedef for the get method function pointer.
Definition: disti_metadata.h:1008
virtual std::istream & ReadValue(std::istream &instr) override
Definition: disti_metadata.h:1114
virtual long ValueInt() override
Definition: disti_metadata.h:1036
virtual DistiAttributeBase & operator=(const DistiAttributeBase &oldClass) override
Definition: disti_metadata.h:1051
containerClass * _object
Object that contains the attribute.
Definition: disti_metadata.h:1011
virtual std::ostream & WriteValue(std::ostream &outstr) override
Definition: disti_metadata.h:1068
Definition: disti_metadata.h:547
void ValueFloat(double val) override
Definition: disti_metadata.h:607
DistiAttribute(CallbackMethodCallerBase *callback, const AttributeName &name, T *attribPtr)
Definition: disti_metadata.h:562
T * _attribPtr
Definition: disti_metadata.h:550
virtual T Value()
Definition: disti_metadata.h:654
std::istream & ReadValue(std::istream &instr) override
Definition: disti_metadata.h:647
std::ostream & WriteValue(std::ostream &outstr) override
Definition: disti_metadata.h:634
long ValueInt() override
Definition: disti_metadata.h:587
DistiAttributeBase & operator=(const DistiAttributeBase &oldClass) override
Definition: disti_metadata.h:615
void ValueInt(long val) override
Definition: disti_metadata.h:594
~DistiAttribute() override
Definition: disti_metadata.h:685
bool operator==(const DistiAttributeBase &rArg) override
Definition: disti_metadata.h:671
bool Copyable() const override
Definition: disti_metadata.h:584
virtual void Value(const T &val)
Definition: disti_metadata.h:661
int _precision
Definition: disti_metadata.h:552
double ValueFloat() override
Definition: disti_metadata.h:600
DistiAttribute(CallbackMethodCallerBase *callback, const AttributeName &name, const T &initialValue)
Definition: disti_metadata.h:576
Definition: weak_reference.h:92
Definition: weak_referenceable_mixin.h:53
#define GLS_ASSERT(exp)
Definition: disti_assert.h:150
#define GLS_VERIFY(exp)
Definition: disti_assert.h:170
A file for all GL Studio files to include.
The disti::DynamicArray class. A templated array of objects capable of dynamically growing.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_IF_HAS_USER_DEFINED_LITERAL(x)
Macro to wrap user defined literals, removed on compilers that don't support them.
Definition: gls_cpp_lang_support.h:247
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:235
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:457
#define DISTI_FINAL
Macro to wrap the final keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:216
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:214
#define DISTI_FUNC_NOEXCEPT
Macro to wrap the noexcept keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:229
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47
DistiAttribDict::const_iterator begin(const DistiAttribDict &dict)
Definition: disti_metadata.h:954
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
bool operator!=(const AttributeName &attr1, const AttributeName &attr2)
Definition: disti_metadata.h:165
AttributeObserver * CreateAttributeMethodCallback(Class *const obj, const typename AttributeMethodCallback< Class >::Callback method)
Definition: disti_metadata.h:455
bool operator==(const AttributeName &attr1, const AttributeName &attr2)
Definition: disti_metadata.h:154
void SetAndNotifyIfChanged(AttributeChangedNotifier *object, T &property, const T &newValue, const AttributeName &name)
Definition: disti_metadata.h:532
DistiAttribDict::const_iterator end(const DistiAttribDict &dict)
Definition: disti_metadata.h:959
const int MAX_ATTRIBUTE_NAME_LENGTH
Unused, remains for backward compatibility.
Definition: disti_metadata.h:79
AttributeObserver * CreateAttributeResourceCallback(Class *const obj, const char *attributeName)
Definition: disti_metadata.h:505
A smart pointer with unique ownership – poor man's std::unique_ptr.
Definition: disti_metadata.h:979
int _enum
Integer value for enumeration.
Definition: disti_metadata.h:981
Definition: gls_cpp_lang_support.h:468
The DistiUnhideGlobalsDummyClass class.
weak reference and related classes
weak reference and related classes