35 #ifndef IECORE_TYPEDDATAINTERNALS_H
36 #define IECORE_TYPEDDATAINTERNALS_H
38 #include "IECore/MurmurHash.h"
44 class SimpleDataHolder
54 SimpleDataHolder(
const T &data )
59 const T &readable()
const
69 bool operator == (
const SimpleDataHolder<T> &other )
const
71 return m_data == other.m_data;
74 void hash( MurmurHash &h )
const
76 h.append( readable() );
86 class SharedDataHolder
92 : m_data( new Shareable )
96 SharedDataHolder(
const T &data )
97 : m_data( new Shareable( data ) )
101 const T &readable()
const
110 if( m_data->refCount() > 1 )
113 m_data =
new Shareable( m_data->data );
115 m_data->hashValid =
false;
119 bool operator == (
const SharedDataHolder<T> &other )
const
121 if( m_data==other.m_data )
127 return readable()==other.readable();
135 void hash( MurmurHash &h )
const
137 if( !m_data->hashValid )
139 m_data->hash = hash();
140 m_data->hashValid =
true;
142 h.append( m_data->hash );
147 MurmurHash hash()
const
150 result.append( &(readable()[0]), readable().size() );
156 class Shareable :
public RefCounted
160 Shareable() : data(), hashValid( false ) {}
161 Shareable(
const T &initData ) : data( initData ), hashValid( false ) {}
165 volatile bool hashValid;
169 IE_CORE_DECLAREPTR( Shareable )
175 class TypedDataTraits
178 typedef void BaseType;
184 typedef void DataHolder;
189 #endif // IECORE_TYPEDDATAINTERNALS_H
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43