head	1.2;
access;
symbols
	Ver1-1:1.1;
locks; strict;
comment	@# @;


1.2
date	2000.01.16.18.51.15;	author oreilly;	state dead;
branches;
next	1.1;

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


desc
@@


1.2
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 {

    // Indicates that device is initialized and ready
    Boolean deviceReady;

    // 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.1
log
@*** empty log message ***
@
text
@@

