(file) Return to UintArgs.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/UintArgs.cpp between version 1.1 and 1.1.2.6

version 1.1, 2013/06/13 11:25:16 version 1.1.2.6, 2014/06/01 19:26:52
Line 28 
Line 28 
 ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
 // //
 //%//////////////////////////////////////////////////////////////////////////// //%////////////////////////////////////////////////////////////////////////////
   #include "UintArgsRep.h"
 #include <Pegasus/Common/UintArgs.h>  #include "UintArgs.h"
 #include <Pegasus/Common/StringConversion.h>  #include "StringConversion.h"
   #include "AtomicInt.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 //  template<class REP>
   inline void Ref(REP* rep)
   {
           rep->_refCounter++;
   }
   
   template<class REP>
   inline void Unref(REP* rep)
   {
       if (rep->_refCounter.decAndTestIfZero())
           delete rep;
   }
   
   //////////////////////////////////////////////////////////////////
 // Uint32Arg Integer Class used for parameters that // Uint32Arg Integer Class used for parameters that
 // require Uint32 on input or output. Provides for NULL as well as // require Uint32 on input or output. Provides for NULL as well as
 // all Uint32 values // all Uint32 values
 //  //////////////////////////////////////////////////////////////////
 Uint32Arg::Uint32Arg() : _value(0), _null(true)  
   Uint32Arg::Uint32Arg()
 { {
       _rep = new Uint32ArgRep();
 } }
  
 Uint32Arg::Uint32Arg(const Uint32Arg& x) :  Uint32Arg::Uint32Arg(const Uint32Arg& x)
     _value(x._value), _null(x._null)  
 { {
   
       _rep = x._rep;
       Ref(_rep);
 } }
  
 Uint32Arg::Uint32Arg(Uint32 x) : _value(x), _null(false)  Uint32Arg::Uint32Arg(Uint32 x)
   {
       _rep = new Uint32ArgRep();
       _rep->_value = x;
       _rep->_null = false;
   }
   
   static inline Uint32ArgRep* _copyOnWriteUint32ArgRep(
       Uint32ArgRep* rep)
   {
       if (rep->_refCounter.get() > 1)
 { {
           Uint32ArgRep* tmpRep= new Uint32ArgRep(*rep);
           Unref(rep);
           return tmpRep;
       }
       else
       {
           return rep;
       }
 } }
  
 Uint32Arg::~Uint32Arg() Uint32Arg::~Uint32Arg()
 { {
       Unref(_rep);
 } }
  
 Uint32Arg& Uint32Arg::operator=(const Uint32Arg& x) Uint32Arg& Uint32Arg::operator=(const Uint32Arg& x)
 { {
     if (&x != this)      if (x._rep != _rep)
     {     {
         _value = x._value;          Unref(_rep);
         _null = x._null;          _rep = x._rep;
           Ref(_rep);
     }     }
   
     return *this;     return *this;
 } }
  
  
 const Uint32& Uint32Arg::getValue() const const Uint32& Uint32Arg::getValue() const
 { {
     return _value;      return _rep->_value;
 } }
  
 void Uint32Arg::setValue(Uint32 x) void Uint32Arg::setValue(Uint32 x)
 { {
     _value = x;  
     _null = false;      _rep = _copyOnWriteUint32ArgRep(_rep);
       _rep->_value = x;
       _rep->_null = false;
 } }
  
 Boolean Uint32Arg::isNull() const Boolean Uint32Arg::isNull() const
 { {
     return _null;      return _rep->_null;
 } }
  
 void Uint32Arg::setNullValue() void Uint32Arg::setNullValue()
 { {
     _value = 0;      _rep = _copyOnWriteUint32ArgRep(_rep);
     _null = true;      _rep->_value = 0;
       _rep->_null = true;
 } }
  
 String Uint32Arg::toString() String Uint32Arg::toString()
 { {
     String s;     String s;
     if (_null)      if (_rep->_null)
     {     {
         s = "NULL";         s = "NULL";
     }     }
Line 101 
Line 141 
     {     {
         char buffer[22];         char buffer[22];
         Uint32 size;         Uint32 size;
         const char* rtn = Uint32ToString(buffer, _value, size);          const char* rtn = Uint32ToString(buffer, _rep->_value, size);
         s = rtn;         s = rtn;
     }     }
     return s;     return s;
 } }
   
 Boolean Uint32Arg::equal(const Uint32Arg& x) const Boolean Uint32Arg::equal(const Uint32Arg& x) const
 { {
     if ((_null != x._null))      if ((_rep->_null != x._rep->_null))
     {     {
         return false;         return false;
     }     }
     return _null? true : (_value == x._value);      return _rep->_null? true : (_rep->_value == x._rep->_value);
 } }
  
 Boolean operator==(const Uint32Arg& x, const Uint32Arg& y) Boolean operator==(const Uint32Arg& x, const Uint32Arg& y)
 { {
     return x.equal(y);     return x.equal(y);
 } }
   
   //////////////////////////////////////////////////////////////
 // Uint64 Class Used for handling of Uint64 // Uint64 Class Used for handling of Uint64
 // parameters on Client input and output // parameters on Client input and output
 //  /////////////////////////////////////////////////////////////
  
 Uint64Arg::Uint64Arg() : _value(0), _null(true)  Uint64Arg::Uint64Arg()
 { {
       _rep = new Uint64ArgRep();
 } }
  
 Uint64Arg::Uint64Arg(const Uint64Arg& x) :  Uint64Arg::Uint64Arg(const Uint64Arg& x)
     _value(x._value), _null(x._null)  
 { {
   
       _rep = x._rep;
       Ref(_rep);
 } }
  
 Uint64Arg::Uint64Arg(Uint64 x) : _value(x), _null(false)  Uint64Arg::Uint64Arg(Uint64 x)
 { {
       _rep = new Uint64ArgRep();
       _rep->_value = x;
       _rep->_null = false;
   }
   
   static inline Uint64ArgRep* _copyOnWriteUint64ArgRep(
       Uint64ArgRep* rep)
   {
       if (rep->_refCounter.get() > 1)
       {
           Uint64ArgRep* tmpRep= new Uint64ArgRep(*rep);
           Unref(rep);
           return tmpRep;
       }
       else
       {
           return rep;
       }
 } }
  
 Uint64Arg::~Uint64Arg() Uint64Arg::~Uint64Arg()
 { {
       Unref(_rep);
 } }
  
 Uint64Arg& Uint64Arg::operator=(const Uint64Arg& x) Uint64Arg& Uint64Arg::operator=(const Uint64Arg& x)
 { {
     if (&x != this)      if (x._rep != _rep)
     {     {
         _value = x._value;          Unref(_rep);
         _null = x._null;          _rep = x._rep;
           Ref(_rep);
     }     }
   
     return *this;     return *this;
 } }
  
   
 const Uint64& Uint64Arg::getValue() const const Uint64& Uint64Arg::getValue() const
 { {
     return _value;      return _rep->_value;
 } }
  
 void Uint64Arg::setValue(Uint64 x) void Uint64Arg::setValue(Uint64 x)
 { {
     _value = x;  
     _null = false;      _rep = _copyOnWriteUint64ArgRep(_rep);
       _rep->_value = x;
       _rep->_null = false;
 } }
  
 Boolean Uint64Arg::isNull() const Boolean Uint64Arg::isNull() const
 { {
     return _null;      return _rep->_null;
 } }
  
 void Uint64Arg::setNullValue() void Uint64Arg::setNullValue()
 { {
     _value = 0;      _rep = _copyOnWriteUint64ArgRep(_rep);
     _null = true;      _rep->_value = 0;
       _rep->_null = true;
 } }
   
 String Uint64Arg::toString() String Uint64Arg::toString()
 { {
     String s;     String s;
     if (_null)      if (_rep->_null)
     {     {
         s = "NULL";         s = "NULL";
     }     }
Line 184 
Line 252 
     {     {
         char buffer[22];         char buffer[22];
         Uint32 size;         Uint32 size;
         const char* rtn = Uint64ToString(buffer, _value, size);          const char* rtn = Uint64ToString(buffer, _rep->_value, size);
         s = rtn;         s = rtn;
     }     }
     return s;     return s;
Line 192 
Line 260 
  
 Boolean Uint64Arg::equal(const Uint64Arg& x) const Boolean Uint64Arg::equal(const Uint64Arg& x) const
 { {
     if ((_null != x._null))      if ((_rep->_null != x._rep->_null))
     {     {
         return false;         return false;
     }     }
     return _null? true : (_value == x._value);      return _rep->_null? true : (_rep->_value == x._rep->_value);
 } }
   
 Boolean operator==(const Uint64Arg& x, const Uint64Arg& y) Boolean operator==(const Uint64Arg& x, const Uint64Arg& y)
 { {
     return x.equal(y);     return x.equal(y);
 } }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.6

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2