32#ifndef _util_group_mstate_h
33#define _util_group_mstate_h
35#include <util/state/state.h>
36#include <util/state/statein.h>
37#include <util/state/stateout.h>
38#include <util/group/message.h>
45class MsgStateSend:
public StateOut {
48 MsgStateSend(
const MsgStateSend&);
49 void operator=(
const MsgStateSend&);
59 int put_array_void(
const void*,
int);
62 virtual ~MsgStateSend();
75 int put(
unsigned int r);
79 int put(
const char*,
int);
80 int put(
const int*,
int);
81 int put(
const unsigned int*,
int);
82 int put(
const float*,
int);
83 int put(
const double*,
int);
89class MsgStateBufRecv:
public StateIn {
93 void operator=(
const MsgStateBufRecv&);
104 int get_array_void(
void*,
int);
114 virtual ~MsgStateBufRecv();
123class MsgStateRecv:
public MsgStateBufRecv {
126 MsgStateRecv(
const MsgStateRecv&);
127 void operator=(
const MsgStateRecv&);
132 virtual ~MsgStateRecv();
142 int get(
char&r,
const char *key = 0);
143 int get(
unsigned int&r,
const char *key = 0);
144 int get(
int&r,
const char *key = 0);
145 int get(
float&r,
const char *key = 0);
146 int get(
double&r,
const char *key = 0);
148 int get(
unsigned int*&);
157class StateSend:
public MsgStateSend {
160 StateSend(
const StateSend&);
161 void operator=(
const StateSend&);
178class StateRecv:
public MsgStateRecv {
181 StateRecv(
const StateRecv&);
182 void operator=(
const StateRecv&);
197class BcastStateSend:
public MsgStateSend {
200 BcastStateSend(
const BcastStateSend&);
201 void operator=(
const BcastStateSend&);
214class BcastStateRecv:
public MsgStateRecv {
217 BcastStateRecv(
const BcastStateRecv&);
218 void operator=(
const BcastStateRecv&);
246 void bcast(
double &);
247 void bcast(
int *&,
int);
248 void bcast(
double *&,
int);
274class BcastStateInBin:
public MsgStateBufRecv {
282 std::streambuf *buf_;
285 int get_array_void(
void*,
int);
294 virtual int open(
const char *name);
295 virtual void close();
void seek(int loc)
Set the current position in the file.
int use_directory()
Returns true of this object uses a directory.
BcastStateInBin(const Ref< KeyVal > &)
Create the BcastStateRecv using the default MessageGrp.
int seekable()
Return non-zero if seek does anything sensible.
void next_buffer()
Specializations must implement next_buffer().
int tell()
Return the current position in the file.
BcastStateInBin(const Ref< MessageGrp > &, const char *filename)
Create the BcastStateRecv.
BcastStateRecv does the receive part of a broadcast of an object to all nodes.
Definition mstate.h:214
BcastStateRecv(const Ref< MessageGrp > &, int source=0)
Create the BcastStateRecv.
void next_buffer()
Specializations must implement next_buffer().
void source(int s)
Set the source node.
BcastStateSend does the send part of a broadcast of an object to all nodes.
Definition mstate.h:197
void flush()
Flush the data remaining in the buffer.
BcastStateSend(const Ref< MessageGrp > &)
Create the BcastStateSend.
void flush()
Force data to be written.
void forget_references()
Call the StateOut or StateIn forget_references member.
void bcast(int &)
Broadcast data to all nodes.
void set_buffer_size(int)
Controls the amount of data that is buffered before it is sent.
BcastState(const Ref< MessageGrp > &, int source=0)
Create a BcastState object. The default source is node 0.
This class is used to contain information about classes.
Definition class.h:158
virtual void next_buffer()=0
Specializations must implement next_buffer().
MsgStateBufRecv(const Ref< MessageGrp > &)
MsgStateBufRecv can be initialized with a MessageGrp.
void set_buffer_size(int)
The buffer size of statein and stateout objects that communicate with each other must match.
MsgStateBufRecv()
Use the default MessageGrp.
int get(char *&)
These restore data saved with StateOut's put.
MsgStateRecv(const Ref< MessageGrp > &)
MsgStateRecv must be initialized with a MessageGrp.
int version(const ClassDesc *)
Returns the version of the ClassDesc.
int get(char &r, const char *key=0)
These restore data saved with StateOut's put. members.
int get(const ClassDesc **)
I only need to override get(ClassDesc**) but C++ will hide all of the other get's so I must override ...
int put(const char *, int)
Write the given array data.
int put(char r)
Write the given datum.
void set_buffer_size(int)
The buffer size of statein and stateout objects that communicate with each other must match.
virtual void flush()=0
Specializations must implement flush().
int put(const ClassDesc *)
I only need to override put(const ClassDesc*) but C++ will hide all of the other put's so I must over...
A template class that maintains references counts.
Definition ref.h:332
T * pointer() const
Returns a pointer the reference counted object.
Definition ref.h:383
static SavableState * restore_state(StateIn &si)
Restores objects saved with save_state.
void save_state(StateOut &)
Save the state of the object as specified by the StateOut object.
void source(int)
Specify the source node.
StateRecv(const Ref< MessageGrp > &)
Create a StateRecv given a MessageGrp.
void next_buffer()
Specializations must implement next_buffer().
void flush()
Flush the buffer.
StateSend(const Ref< MessageGrp > &)
Create a StateSend given a MessageGrp.
void target(int)
Specify the target node.