COPASI API  4.16.103
Public Member Functions | Private Attributes | Friends | List of all members
CCopasiXMLInterface::DBL Class Reference

#include <CCopasiXMLInterface.h>

Public Member Functions

 DBL (const C_FLOAT64 &value=0.0)
 
 DBL (const char *value)
 
 operator const C_FLOAT64 & () const
 
 ~DBL ()
 

Private Attributes

C_FLOAT64 mValue
 

Friends

std::ostream & operator<< (std::ostream &os, const DBL &dbl)
 

Detailed Description

Definition at line 99 of file CCopasiXMLInterface.h.

Constructor & Destructor Documentation

CCopasiXMLInterface::DBL::DBL ( const C_FLOAT64 value = 0.0)

Definition at line 194 of file CCopasiXMLInterface.cpp.

References min, and mValue.

194  :
195  mValue(value)
196 {
198  mValue = 0.0;
199 }
#define min(a, b)
Definition: f2c.h:175
CCopasiXMLInterface::DBL::DBL ( const char *  value)

Definition at line 201 of file CCopasiXMLInterface.cpp.

References mValue.

201  :
202  mValue(std::numeric_limits<C_FLOAT64>::quiet_NaN())
203 {
204  if (!value || !*value) return;
205 
206  std::istringstream in;
207 
208  in.imbue(std::locale::classic());
209  in.str(value);
210 
211  in >> mValue;
212 
213  if (isnan(mValue))
214  {
215  if (!strcmp(value, "INF"))
216  mValue = std::numeric_limits<C_FLOAT64>::infinity();
217  else if (!strcmp(value, "-INF"))
218  mValue = - std::numeric_limits<C_FLOAT64>::infinity();
219  }
220 
221  return;
222 }
CCopasiXMLInterface::DBL::~DBL ( )

Definition at line 224 of file CCopasiXMLInterface.cpp.

224 {}

Member Function Documentation

CCopasiXMLInterface::DBL::operator const C_FLOAT64 & ( ) const

Definition at line 226 of file CCopasiXMLInterface.cpp.

227 {return mValue;}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const DBL dbl 
)
friend

Definition at line 229 of file CCopasiXMLInterface.cpp.

230 {
231  os.precision(16);
232 
233  if (isnan(dbl.mValue))
234  os << "NaN";
235  else if (finite(dbl.mValue))
236  os << dbl.mValue;
237  else if (dbl.mValue > 0.0)
238  os << "INF";
239  else if (dbl.mValue < 0.0)
240  os << "-INF";
241 
242  return os;
243 }

Member Data Documentation

C_FLOAT64 CCopasiXMLInterface::DBL::mValue
private

Definition at line 115 of file CCopasiXMLInterface.h.

Referenced by DBL(), and operator<<().


The documentation for this class was generated from the following files: