# TMCStreamBased Class Reference
[MCCore]

List of all members.

## Public Types
enum | { kStreamKeyWord_List = '****', kStreamKeyWord_Default = '@@@@' }
## Public Member Functions
| TMCStreamBased ()
virtual void | InitOnNew ()
virtual void | TopLevelRead (TMCiostream &stream)
virtual void | Read (TMCiostream &stream)
virtual void | ReadAttribute (int32 keyword, TMCiostream &stream)
virtual void | ReadListAttribute (int32 keyword, TMCiostream &stream, TMCPtrArray< void > *list)
virtual void | ReadListElement (int32 keyword, TMCiostream &stream, TMCPtrArray< void > *list)
virtual void | Write (TMCiostream &stream) const
virtual void | WriteAttributes (TMCiostream &stream) const
virtual void | WriteListAttribute (int32 keyword, TMCiostream &stream, TMCPtrArray< void > *list) const
virtual void | WriteListElement (int32 listKeyword, TMCiostream &stream, TMCPtrArray< void > *list, int32 index) const
virtual void | WriteListNbAttribute (int32 keyword, TMCiostream &stream, int32 numElements) const
void | DoWriteWithKeyword (TMCiostream &stream, int32 keyword) const
void | DoReadSkipKeyword (TMCiostream &stream)
virtual FourCharT | GetKeyword () const
## Static Public Attributes
static boolean | sDidSkip
static boolean | sDoSkip
## Protected Member Functions
| ~TMCStreamBased ()

## Detailed Description

TMCStreamBased handles all the I/O grammar. You must at least override ReadAttribute() and WriteAttributes(). Override GetKeyword() if you want to use Write() (see note below). Override InitOnNew() if needed. Call ReadListAttribute() and WriteListAttribute(), and override ReadListElement() and WriteListElement() if you have a list of abjects as a field.

Using Write() or DoWriteWithKeyword(): Write() is to be used when an object 'knows' its own keyword. However, it is generaly more convenient to use DoWriteWithKeyword(), for the following reason. Say you have an object that has another object as a field. In ReadAttribute(), you catch the field's keyword, instance the object, and call fSubObject->Read(). Fine. In WriteAttributes() you have two choices. If you want to use Write(), you will have to override the GetKeyword() method of the sub-object. The problem with this is that you end up with the field keyword defined at two different places: in the main object's ReadAttribute(), and in the sub-object's GetKeyword(). For this reason, it is better to call DoWriteWithKeyword() instead, so the sub-object's keyword is at the same level: in ReadAttribute() and WriteAttributes() of the main object.

## Member Enumeration Documentation

anonymous enum

Enumerator:

  kStreamKeyWord_List |
  kStreamKeyWord_Default |

## Constructor & Destructor Documentation

TMCStreamBased::TMCStreamBased | ( |  | ) |

TMCStreamBased::~TMCStreamBased | ( |  | ) | `[protected]`

## Member Function Documentation

void TMCStreamBased::DoReadSkipKeyword | ( | TMCiostream & | stream | ) |

void TMCStreamBased::DoWriteWithKeyword | ( | TMCiostream & | stream,
|  | int32 | keyword |
| ) |  |  | const

virtual FourCharT TMCStreamBased::GetKeyword | ( |  | ) | const`[virtual]`

virtual void TMCStreamBased::InitOnNew | ( |  | ) | `[virtual]`

virtual void TMCStreamBased::Read | ( | TMCiostream & | stream | ) | `[virtual]`

virtual void TMCStreamBased::ReadAttribute | ( | int32 | keyword,
|  | TMCiostream & | stream |
| ) |  |  | `[virtual]`

virtual void TMCStreamBased::ReadListAttribute | ( | int32 | keyword,
|  | TMCiostream & | stream,
|  | TMCPtrArray< void > * | list |
| ) |  |  | `[virtual]`

virtual void TMCStreamBased::ReadListElement | ( | int32 | keyword,
|  | TMCiostream & | stream,
|  | TMCPtrArray< void > * | list |
| ) |  |  | `[virtual]`

virtual void TMCStreamBased::TopLevelRead | ( | TMCiostream & | stream | ) | `[virtual]`

Use this to read the top level of file that don't have begin and end tokens around them

virtual void TMCStreamBased::Write | ( | TMCiostream & | stream | ) | const`[virtual]`

virtual void TMCStreamBased::WriteAttributes | ( | TMCiostream & | stream | ) | const`[virtual]`

virtual void TMCStreamBased::WriteListAttribute | ( | int32 | keyword,
|  | TMCiostream & | stream,
|  | TMCPtrArray< void > * | list |
| ) |  |  | const`[virtual]`

virtual void TMCStreamBased::WriteListElement | ( | int32 | listKeyword,
|  | TMCiostream & | stream,
|  | TMCPtrArray< void > * | list,
|  | int32 | index |
| ) |  |  | const`[virtual]`

virtual void TMCStreamBased::WriteListNbAttribute | ( | int32 | keyword,
|  | TMCiostream & | stream,
|  | int32 | numElements |
| ) |  |  | const`[virtual]`

## Member Data Documentation

boolean TMCStreamBased::sDidSkip`[static]`

boolean TMCStreamBased::sDoSkip`[static]`

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

- MCStreamBased.h