MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
BufferStreamDriveRaw Class Reference

#include <bufferstreamdrive.h>

Inheritance diagram for BufferStreamDriveRaw:
Collaboration diagram for BufferStreamDriveRaw:

Public Member Functions

 BufferStreamDriveRaw (unsigned int uL, const DriveHandler *pDH, integer nd, const std::vector< doublereal > &v0, StreamDrive::Modifier *pMod, unsigned int ie, StreamDriveEcho *pSDE, bool bOwnsMemory)
 
virtual ~BufferStreamDriveRaw (void)
 
bool bOwnsMemory (void) const
 
void SetBufRaw (integer n, const doublereal *p)
 
const doublerealGetBufRaw (void)
 
virtual std::ostream & Restart (std::ostream &out) const
 
- Public Member Functions inherited from BufferStreamDrive_base
 BufferStreamDrive_base (unsigned int uL, const DriveHandler *pDH, integer nd, const std::vector< doublereal > &v0, StreamDrive::Modifier *pMod, unsigned int ie, StreamDriveEcho *pSDE)
 
virtual ~BufferStreamDrive_base (void)
 
const integer GetBufSize (void) const
 
virtual void ServePending (const doublereal &t)
 
- Public Member Functions inherited from StreamDrive
 StreamDrive (unsigned int uL, const DriveHandler *pDH, const std::string &sFileName, integer nd, const std::vector< doublereal > &v0, bool c, StreamDrive::Modifier *pmod)
 
virtual ~StreamDrive (void)
 
void SetModifier (const Modifier *p)
 
const StreamDrive::ModifierpGetModifier (void) const
 
- Public Member Functions inherited from FileDrive
 FileDrive (unsigned int uL, const DriveHandler *pDH, const std::string &s, integer nd, const std::vector< doublereal > &v0)
 
virtual ~FileDrive (void)
 
virtual Drive::Type GetDriveType (void) const
 
virtual integer iGetNumDrives (void) const
 
virtual doublereal dGet (const doublereal &t, int i=1) const
 
- Public Member Functions inherited from Drive
 Drive (unsigned int uL, const DriveHandler *pDH)
 
virtual ~Drive (void)
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 

Protected Attributes

bool m_bOwnsMemory
 
const doublerealm_pBuffer
 
- Protected Attributes inherited from BufferStreamDrive_base
unsigned int InputEvery
 
unsigned int InputCounter
 
StreamDriveEchopSDE
 
- Protected Attributes inherited from StreamDrive
int size
 
std::vector< char > buf
 
bool create
 
const ModifierpMod
 
- Protected Attributes inherited from FileDrive
std::string sFileName
 
integer iNumDrives
 
doublerealpdVal
 
- Protected Attributes inherited from Drive
const DriveHandlerpDrvHdl
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 

Additional Inherited Members

- Public Types inherited from Drive
enum  Type { UNKNOWN = -1, FILEDRIVE = 0, LASTDRIVETYPE }
 
enum  Bailout { BO_NONE = 0x0, BO_UPPER = 0x1, BO_LOWER = 0x2, BO_ANY = (BO_UPPER | BO_LOWER) }
 
- Static Protected Attributes inherited from Drive
static doublereal dReturnValue = 0.
 

Detailed Description

Definition at line 93 of file bufferstreamdrive.h.

Constructor & Destructor Documentation

BufferStreamDriveRaw::BufferStreamDriveRaw ( unsigned int  uL,
const DriveHandler pDH,
integer  nd,
const std::vector< doublereal > &  v0,
StreamDrive::Modifier pMod,
unsigned int  ie,
StreamDriveEcho pSDE,
bool  bOwnsMemory 
)

Definition at line 148 of file bufferstreamdrive.cc.

References m_bOwnsMemory, and m_pBuffer.

155 : BufferStreamDrive_base(uL, pDH, nd, v0, pMod, ie, pSDE),
157 m_pBuffer(0)
158 {
159  if (m_bOwnsMemory) {
160  m_pBuffer = new doublereal[nd];
161  }
162 }
bool bOwnsMemory(void) const
const doublereal * m_pBuffer
static const std::vector< doublereal > v0
Definition: fixedstep.cc:45
double doublereal
Definition: colamd.c:52
BufferStreamDrive_base(unsigned int uL, const DriveHandler *pDH, integer nd, const std::vector< doublereal > &v0, StreamDrive::Modifier *pMod, unsigned int ie, StreamDriveEcho *pSDE)
BufferStreamDriveRaw::~BufferStreamDriveRaw ( void  )
virtual

Definition at line 164 of file bufferstreamdrive.cc.

References m_bOwnsMemory, and m_pBuffer.

165 {
166  if (m_bOwnsMemory) {
167  delete[] m_pBuffer;
168  }
169 }
const doublereal * m_pBuffer

Member Function Documentation

bool BufferStreamDriveRaw::bOwnsMemory ( void  ) const

Definition at line 172 of file bufferstreamdrive.cc.

References m_bOwnsMemory.

Referenced by DataManager::SetBufInRaw().

173 {
174  return m_bOwnsMemory;
175 }
const doublereal * BufferStreamDriveRaw::GetBufRaw ( void  )
virtual

Implements BufferStreamDrive_base.

Definition at line 201 of file bufferstreamdrive.cc.

References ASSERT, and m_pBuffer.

202 {
203  ASSERT(m_pBuffer != 0);
204 
205  return m_pBuffer;
206 }
#define ASSERT(expression)
Definition: colamd.c:977
const doublereal * m_pBuffer
std::ostream & BufferStreamDriveRaw::Restart ( std::ostream &  out) const
virtual

Implements FileDrive.

Definition at line 210 of file bufferstreamdrive.cc.

References FileDrive::iNumDrives, m_bOwnsMemory, and WithLabel::uLabel.

211 {
212  // input every, echo, ...
213  out << " file: " << uLabel << ", buffer stream, type, raw, owns memory, " << (m_bOwnsMemory ? "yes" : "no" ) << iNumDrives << ";" << std::endl;
214  return out;
215 }
integer iNumDrives
Definition: filedrv.h:47
unsigned int uLabel
Definition: withlab.h:44
void BufferStreamDriveRaw::SetBufRaw ( integer  n,
const doublereal p 
)

Definition at line 178 of file bufferstreamdrive.cc.

References FileDrive::iNumDrives, m_bOwnsMemory, m_pBuffer, and MBDYN_EXCEPT_ARGS.

Referenced by DataManager::SetBufInRaw().

179 {
180  if (n != iNumDrives) {
181  // error
182  std::ostringstream os;
183  os << "setting buffer pointer in BufferStreamDriveRaw of wrong size (original=" << iNumDrives << ", new=" << n << ")";
184  throw ErrGeneric(MBDYN_EXCEPT_ARGS, os.str());
185  }
186 
187  if (m_bOwnsMemory) {
188  // error
189  throw ErrGeneric(MBDYN_EXCEPT_ARGS, "setting buffer pointer in BufferStreamDriveRaw that owns its memory");
190  }
191 
192  if (m_pBuffer != 0) {
193  // error; maybe we could simply replace it, couldn't we?
194  throw ErrGeneric(MBDYN_EXCEPT_ARGS, "setting buffer pointer in BufferStreamDriveRaw that has already been set");
195  }
196 
197  m_pBuffer = p;
198 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iNumDrives
Definition: filedrv.h:47
const doublereal * m_pBuffer

Member Data Documentation

bool BufferStreamDriveRaw::m_bOwnsMemory
protected
const doublereal* BufferStreamDriveRaw::m_pBuffer
protected

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