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;
345 virtual std::string
Type()
const
361 template<
class valType>
377 template<
class valType>
492 ( *objAttr ) << attr.ValueString();
514 const char* attributeName )
541 if( newValue != property )
544 object->NotifyAttributeChanged( name );
551class DistiAttribDict;
656 return ReadValueImpl( instr );
665 return Demangle<T>();
712 std::istream& ReadValueImpl( std::istream& instr )
727inline std::istream& DistiAttribute<float>::ReadValueImpl( std::istream& instr )
731 *_attribPtr =
static_cast<float>( atof( instrBuf ) );
738inline std::istream& DistiAttribute<double>::ReadValueImpl( std::istream& instr )
742 *_attribPtr = atof( instrBuf );
756 typedef std::multimap<long, Attr_t>
Map_t;
767#if defined( DISTI_HAS_RVAL_REFS )
772 *
this = std::move( other );
782 _list = std::move( other._list );
783 _map = std::move( other._map );
814 DISTI_DEPRECATED(
"Renamed to CopyCommonValues() to better represent the action taken by this function." )
874 DISTI_EXPORT
void Write( std::ostream& outstr,
bool changedDataOnly =
false );
879 DISTI_EXPORT
bool Read( std::istream& instr );
950 static DISTI_EXPORT
bool ScanToken( std::istream& instr, std::string& result );
1011 virtual DISTI_EXPORT
int EnumToInt(
const std::string&
string );
1019template<
class containerClass,
class setType,
class getType>
1086 bool foundIt =
false;
1088 DistiAttributeEnumDefList::iterator item =
_pairList->begin();
1089 while( item !=
_pairList->end() && *item )
1091 if( ( *item )->_enum == value )
1093 outstr << ( *item )->_string;
1113 DistiAttributeEnumDefList::iterator item =
_pairList->begin();
1115 while( item !=
_pairList->end() && *item )
1117 if( strcmp( ( *item )->_string,
string.c_str() ) == 0 )
1119 returnVal = ( *item )->_enum;
1135 bool foundIt =
false;
1136 DistiAttributeEnumDefList::iterator item =
_pairList->begin();
1139 while( item !=
_pairList->end() && *item )
1141 if( strcmp( ( *item )->_string, value ) == 0 )
1163# pragma warning( pop )
Definition: disti_metadata.h:521
virtual void NotifyAttributeChanged(const AttributeName &name)=0
virtual ~AttributeChangedNotifier()
Definition: disti_metadata.h:529
Definition: disti_metadata.h:424
AttributeMethodCallback(T *object, Callback method)
Definition: disti_metadata.h:431
WeakRef< T > _object
The underlying object containing the callback method.
Definition: disti_metadata.h:454
Callback _method
Method to call back when invoked.
Definition: disti_metadata.h:453
virtual bool IsValid() const override
Definition: disti_metadata.h:447
void(T::* Callback)(DistiAttributeBase &attr)
Typedef for the callback function pointer.
Definition: disti_metadata.h:426
void Call(DistiAttributeBase &ev) override
Definition: disti_metadata.h:439
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:474
WeakRef< T > _object
The object containing the attribute.
Definition: disti_metadata.h:504
AttributeName _attributeName
The attribute to set when invoked.
Definition: disti_metadata.h:503
virtual bool IsValid() const override
Definition: disti_metadata.h:497
void Call(DistiAttributeBase &attr) override
Definition: disti_metadata.h:486
AttributeResourceCallback(T *object, const AttributeName &attributeName)
Definition: disti_metadata.h:479
Definition: callback_caller_base.h:56
Definition: disti_metadata.h:750
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:758
std::multimap< long, Attr_t > Map_t
Typedef for a map ot attribute pointers.
Definition: disti_metadata.h:756
static long _currentFileVersionSecondary
Definition: disti_metadata.h:807
iterator Begin()
Definition: disti_metadata.h:844
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:847
std::istream & ReadValue(const AttributeName &name, std::istream &instr)
List_t::iterator iterator
Shorthand for List_t::iterator.
Definition: disti_metadata.h:759
DistiAttribDict & operator=(DistiAttribDict &&other)
Definition: disti_metadata.h:778
static unsigned int _currentFileVersionMinor
Definition: disti_metadata.h:800
DistiAttributeBase * Get(const AttributeName &name) const
std::list< Attr_t > List_t
Typedef for a list of attribute pointers.
Definition: disti_metadata.h:755
std::string ValueString(const AttributeName &name) const
void Add(DistiAttributeBase *attr)
const_iterator End() const
Definition: disti_metadata.h:841
DistiAttributeBase * Attr_t
Definition: disti_metadata.h:753
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:798
static int currentOutputSpacing
Definition: disti_metadata.h:930
bool ReadAndCaptureMissing(std::istream &instr, std::stringstream *missingStream)
static unsigned int _currentFileVersionBuild
Definition: disti_metadata.h:802
const_iterator Begin() const
Definition: disti_metadata.h:838
static double _currentFileVersionPrimary
Definition: disti_metadata.h:805
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:378
DistiAttributeBase & operator<<(const valType &val)
Definition: disti_metadata.h:362
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:401
virtual std::string Type() const
Definition: disti_metadata.h:345
Definition: disti_metadata.h:1002
DistiAttributeEnumDefList(char *stringVal,...)
virtual int EnumToInt(const std::string &string)
Definition: disti_metadata.h:1021
DistiAttributeEnum(containerClass *object, SetMethodType setMethod, GetMethodType getMethod, const AttributeName &name)
Definition: disti_metadata.h:1037
virtual void ValueInt(long val) override
Definition: disti_metadata.h:1059
void(containerClass::* SetMethodType)(setType)
Typedef for the set method function pointer.
Definition: disti_metadata.h:1023
GetMethodType _getMethod
Get method member function pointer.
Definition: disti_metadata.h:1030
int EnumToInt(std::string &string)
Definition: disti_metadata.h:1110
DistiAttributeEnumDefList * _pairList
A list of name value pairs describing the enumeration.
Definition: disti_metadata.h:1026
SetMethodType _setMethod
Set method member function pointer.
Definition: disti_metadata.h:1029
getType(containerClass::* GetMethodType)()
Typedef for the get method function pointer.
Definition: disti_metadata.h:1024
virtual std::istream & ReadValue(std::istream &instr) override
Definition: disti_metadata.h:1130
virtual long ValueInt() override
Definition: disti_metadata.h:1052
virtual DistiAttributeBase & operator=(const DistiAttributeBase &oldClass) override
Definition: disti_metadata.h:1067
containerClass * _object
Object that contains the attribute.
Definition: disti_metadata.h:1027
virtual std::ostream & WriteValue(std::ostream &outstr) override
Definition: disti_metadata.h:1084
Definition: disti_metadata.h:554
void ValueFloat(double val) override
Definition: disti_metadata.h:614
DistiAttribute(CallbackMethodCallerBase *callback, const AttributeName &name, T *attribPtr)
Definition: disti_metadata.h:569
T * _attribPtr
Definition: disti_metadata.h:557
virtual T Value()
Definition: disti_metadata.h:670
std::istream & ReadValue(std::istream &instr) override
Definition: disti_metadata.h:654
std::string Type() const override
Definition: disti_metadata.h:663
std::ostream & WriteValue(std::ostream &outstr) override
Definition: disti_metadata.h:641
long ValueInt() override
Definition: disti_metadata.h:594
DistiAttributeBase & operator=(const DistiAttributeBase &oldClass) override
Definition: disti_metadata.h:622
void ValueInt(long val) override
Definition: disti_metadata.h:601
~DistiAttribute() override
Definition: disti_metadata.h:701
bool operator==(const DistiAttributeBase &rArg) override
Definition: disti_metadata.h:687
bool Copyable() const override
Definition: disti_metadata.h:591
virtual void Value(const T &val)
Definition: disti_metadata.h:677
int _precision
Definition: disti_metadata.h:559
double ValueFloat() override
Definition: disti_metadata.h:607
DistiAttribute(CallbackMethodCallerBase *callback, const AttributeName &name, const T &initialValue)
Definition: disti_metadata.h:583
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:970
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:462
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:539
DistiAttribDict::const_iterator end(const DistiAttribDict &dict)
Definition: disti_metadata.h:975
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:512
A smart pointer with unique ownership – poor man's std::unique_ptr.
Definition: disti_metadata.h:995
int _enum
Integer value for enumeration.
Definition: disti_metadata.h:997
Definition: gls_cpp_lang_support.h:468
The DistiUnhideGlobalsDummyClass class.
weak reference and related classes
weak reference and related classes