ConcatParms.h and ConcatParms.C


#ifndef _CONCAT_PARMS_H__
#define _CONCAT_PARMS_H__

#include < hpcxx_rts.h>
#include 

class ConcatParms {
private:
  string stringValue;
  long numOfTimes;

public:
  ConcatParms();
  ConcatParms(string stringValue, long _numOfTimes);
  ConcatParms(ConcatParms &concatParms);

  string getValue() const;
  void setValue(string _source);

  long getNumOfTimes() const;
  void setNumOfTimes(long _numOfTimes);
  friend std::ostream& operator<<(std::ostream &out, ConcatParms &myString);

  friend void hpcxx_pack(HPCxx_Buffer& b, ConcatParms* concatParms, int count);
  friend void hpcxx_unpack(HPCxx_Buffer& b, ConcatParms* concatParms, int count);
};

#endif // _CONCAT_PARMS_H__

The implementation of the class ConcatParms is provided in the file ConcatParms.C. The relevant code is as follows:


#include "ConcatParms.h"

// empty constructor. Has to be
// provided for every object that
// you want to serialize

ConcatParms::ConcatParms() {
  value = string("DEFAULT");
  numOfTimes = 0;
}
ConcatParms::ConcatParms(string _value, long _numOfTimes) {
  value = _value;
  numOfTimes = _numOfTimes;
}

// copy constructor.
// This will be called from the
// stub/skeleton

ConcatParms::ConcatParms(ConcatParms &val) {
  value = val.value;
  numOfTimes = val.numOfTimes;
}

string ConcatParms::getValue() const {
  return value;
}

void ConcatParms::setValue(string _value) {
  value = _value;
}

long ConcatParms::getNumOfTimes() const {
  return numOfTimes;
}

void ConcatParms:: setNumOfTimes(long _numOfTimes) {
  numOfTimes = _numOfTimes;
}

}

std::ostream& operator <<(std::ostream &out, ConcatParms &e) {
  out << "   "
      << std::endl;
  return out;
}

void hpcxx_pack(HPCxx_Buffer& b, ConcatParms* p, int count){
  for(int i = 0; i < count; i++){
    // pack the string value
    HPCxx_String valueName((char *) p[i].getValue().c_str());
    hpcxx_pack(b, &valueName, 1);

    // pack the string numOfTimesName
    hpcxx_pack(b, &(p->numOfTimesName), 1);
  }
}

void hpcxx_unpack(HPCxx_Buffer& b, ConcatParms* p, int count){
  for(int i = 0; i < count; i++){
 
    HPCxx_String valueName;
    long noOfTimes;

    hpcxx_unpack(b, &valueName, 1);
    hpcxx_unpack(b, &noOfTimes, 1);

    string name((char *) valueName);
    p->setValue(name);
    p->setNumOfTimes(noOfTimes);
  }
}

Back to CCA Compliant HPC++ based CCAT Components
mgovinda@cs.indiana.edu
Last modified: Tue Jan 25 17:26:09 EST 2000