From ec05778d5718a7912e506764d443a78d6a6179e3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Nov 2012 22:41:51 +0000 Subject: Converted tabs to spaces with tabconv. --- src/stable/atom.h | 254 +++++++++++++++++++++++++++--------------------------- 1 file changed, 127 insertions(+), 127 deletions(-) (limited to 'src/stable/atom.h') diff --git a/src/stable/atom.h b/src/stable/atom.h index 105c29a..9679ab6 100644 --- a/src/stable/atom.h +++ b/src/stable/atom.h @@ -15,133 +15,133 @@ namespace Bu { - /** - * - *@ingroup Containers - */ - template > - class Atom - { - private: - typedef struct Atom MyType; - - public: - Atom() : - pData( NULL ) - { - } - - Atom( const MyType &oth ) : - pData( NULL ) - { - if( oth.pData ) - set( *oth.pData ); - } - - Atom( const t &oth ) : - pData( NULL ) - { - set( oth ); - } - - virtual ~Atom() - { - clear(); - } - - bool has() const - { - return (pData != NULL); - } - - void set( const t &val ) - { - clear(); - pData = ta.allocate( 1 ); - ta.construct( pData, val ); - } - - t &get() - { - if( !pData ) - throw Bu::ExceptionBase("Not set"); - return *pData; - } - - const t &get() const - { - if( !pData ) - throw Bu::ExceptionBase("Not set"); - return *pData; - } - - void clear() - { - if( pData ) - { - ta.destroy( pData ); - ta.deallocate( pData, 1 ); - pData = NULL; - } - } - - operator const t &() const - { - if( !pData ) - throw Bu::ExceptionBase("Not set"); - return *pData; - } - - operator t &() - { - if( !pData ) - throw Bu::ExceptionBase("Not set"); - return *pData; - } - - MyType &operator =( const t &oth ) - { - set( oth ); - - return *this; - } - - MyType &operator =( const MyType &oth ) - { - if( oth.pData ) - set( *oth.pData ); - - return *this; - } - - bool operator ==( const MyType &oth ) - { - return (*pData) == (*oth.pData); - } - - bool operator ==( const t &oth ) - { - return (*pData) == oth; - } - - t *operator ->() - { - if( !pData ) - throw Bu::ExceptionBase("Not set"); - return pData; - } - - t &operator *() - { - if( !pData ) - throw Bu::ExceptionBase("Not set"); - return *pData; - } - - private: - t *pData; - talloc ta; - }; + /** + * + *@ingroup Containers + */ + template > + class Atom + { + private: + typedef struct Atom MyType; + + public: + Atom() : + pData( NULL ) + { + } + + Atom( const MyType &oth ) : + pData( NULL ) + { + if( oth.pData ) + set( *oth.pData ); + } + + Atom( const t &oth ) : + pData( NULL ) + { + set( oth ); + } + + virtual ~Atom() + { + clear(); + } + + bool has() const + { + return (pData != NULL); + } + + void set( const t &val ) + { + clear(); + pData = ta.allocate( 1 ); + ta.construct( pData, val ); + } + + t &get() + { + if( !pData ) + throw Bu::ExceptionBase("Not set"); + return *pData; + } + + const t &get() const + { + if( !pData ) + throw Bu::ExceptionBase("Not set"); + return *pData; + } + + void clear() + { + if( pData ) + { + ta.destroy( pData ); + ta.deallocate( pData, 1 ); + pData = NULL; + } + } + + operator const t &() const + { + if( !pData ) + throw Bu::ExceptionBase("Not set"); + return *pData; + } + + operator t &() + { + if( !pData ) + throw Bu::ExceptionBase("Not set"); + return *pData; + } + + MyType &operator =( const t &oth ) + { + set( oth ); + + return *this; + } + + MyType &operator =( const MyType &oth ) + { + if( oth.pData ) + set( *oth.pData ); + + return *this; + } + + bool operator ==( const MyType &oth ) + { + return (*pData) == (*oth.pData); + } + + bool operator ==( const t &oth ) + { + return (*pData) == oth; + } + + t *operator ->() + { + if( !pData ) + throw Bu::ExceptionBase("Not set"); + return pData; + } + + t &operator *() + { + if( !pData ) + throw Bu::ExceptionBase("Not set"); + return *pData; + } + + private: + t *pData; + talloc ta; + }; } #endif -- cgit v1.2.3