Download | Plain Text | Line Numbers
/**
* @module cdatset
* @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
* @brief Datatype template and datatype definition for CCPU and CMem
* @date 26.05.2009
*/
#ifndef CDATSET_H
#define CDATSET_H 1
#include <iostream>
#include "cdat.h"
/**
* @class CDatSet
*
* Datatype template for CCPU and CMem.
*/
class CDatSet
: public CDat<int>, public boost::operators<CDatSet>
{
public:
/**
* @method CDatSet
* @brief Default ctor
* @param -
* @return -
* @globalvars none
* @exception bad_alloc
* @pre none
* @post none
*/
CDatSet()
{}
/**
* @method CDatSet
* @brief Copy constructor for int
* @param newval new value for CDatSet
* @return -
* @globalvars none
* @exception none
* @pre none
* @post none
*/
CDatSet(const int newval)
: CDat<int>(newval)
{}
/**
* @method operator>>
* @brief Shift/read operator for inputstream
* @param stream reference to inputstream
* @param cdat reference to object which will be read from stream
* @return reference to inputstream
* @globalvars none
* @exception none
* @pre stream != null
* @post cdat.m_value = count of char 'o'
*/
friend std::istream& operator>>(std::istream & stream, CDatSet& cdat)
{
unsigned count = 0;
while(stream.good() && !stream.eof())
{
int val = stream.get();
if (val != 'o')
break;
++count;
}
stream.clear();
cdat.m_value = count;
return stream;
}
};
#endif
/* vim: set et sw=2 ts=2: */