head	1.4;
access;
symbols
	Ver1-1:1.3
	Validate1:1.2
	OdysseyMatch2:1.1;
locks; strict;
comment	@# @;


1.4
date	2000.01.16.18.51.14;	author oreilly;	state dead;
branches;
next	1.3;

1.3
date	2000.01.12.22.12.04;	author oreilly;	state Exp;
branches;
next	1.2;

1.2
date	2000.01.10.23.54.55;	author oreilly;	state Exp;
branches;
next	1.1;

1.1
date	99.11.22.19.16.47;	author oreilly;	state Exp;
branches;
next	;


desc
@@


1.4
log
@Moved to utils
@
text
@#!/bin/csh
# This script automatically generates most of the code for a subclass
# of SharedData (which uses shared memory as the underlying IPC mechanism)
# 

if ($#argv != 1) then
  echo usage: $0 classname
  exit 1
endif


set classname = $argv[1]

cat > ${classname}.h << EndHeader

#ifndef _${classname}_H
#define _${classname}_H

#include "SharedData.h"

#define ${classname}Name "${classname}_ShmemName"

/*
CLASS 
$classname

DESCRIPTION
!!!FILL IN CLASS DESCRIPTION HERE!!!

AUTHOR
!!!FILL IN AUTHOR HERE!!!
*/
class $classname : public SharedData {

public:

  struct Data {
    // DEFINE STRUCTURE ELEMENTS HERE
  };

  $classname(Access access = NoAccess, Boolean init = False);

  ~$classname();

  ////////////////////////////////////////////////////////////////////
  // Read from shared memory to this object's Data::data element
  void read();

  ////////////////////////////////////////////////////////////////////
  // Write from this object's Data::data element to shared memory
  void write();

  Data data;

};

#endif
EndHeader


cat > ${classname}.cc << Endcc

#include "${classname}.h"
#include "Syslog.h"

${classname}::${classname}(Access access, Boolean init)
  : SharedData(${classname}Name, 
               sizeof(${classname}::Data),
               access, init)
{
}


${classname}::~${classname}()
{
}


void ${classname}::read()
{
  SharedData::read((void *)&data);
}

void ${classname}::write()
{
  SharedData::write((void *)&data);
}



Endcc

echo Generated files ${classname}.h and ${classname}.cc
echo NOTE: You must define ${classname}::Data structure in ${classname}.h

exit 0


@


1.3
log
@*** empty log message ***
@
text
@@


1.2
log
@Support both forms of read() and write()
@
text
@a45 8
  // Read from shared memory to Data argument
  void read(Data *data);

  ////////////////////////////////////////////////////////////////////
  // Write from Data argument to shared memory
  void write(Data *data);

  ////////////////////////////////////////////////////////////////////
a75 12
}


void ${classname}::read(${classname}::Data *data)
{
  SharedData::read((void *)data);
}


void ${classname}::write(${classname}::Data *data)
{
  SharedData::write((void *)data);
@


1.1
log
@*** empty log message ***
@
text
@d46 1
a46 1
  // Read Data from shared memory
d50 1
a50 1
  // Write Data to shared memory
d52 11
d96 11
@
