Skip to content

Commit

Permalink
types: added missing dtors, added Input and Output types
Browse files Browse the repository at this point in the history
  • Loading branch information
AmkG committed Aug 13, 2008
1 parent 40513dc commit af9e252
Showing 1 changed file with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion inc/types.hpp
Expand Up @@ -264,10 +264,10 @@ class Sym : public Generic{
virtual Generic* car(void);
virtual Generic* cdr(void);

/*new stuff*/
Sym(boost::shared_ptr<Atom> const& na) : Generic(), a(na){};
virtual ~Sym(){};

/*new stuff*/
Atom& atom(void){return *a;};
boost::shared_ptr<Atom> a;
};
Expand Down Expand Up @@ -387,6 +387,8 @@ class Integer : public Generic {
int val;
int integer(void){return val;}
Integer(int x) : Generic(), val(x) {}

virtual ~Integer(){}
};

class BytecodeSequence;
Expand Down Expand Up @@ -418,6 +420,8 @@ class ArcBytecodeSequence : public Generic {
void append(Bytecode* b);
boost::shared_ptr<BytecodeSequence> seq;
ArcBytecodeSequence(void);

virtual ~ArcBytecodeSequence(){}
};

/*created by 'annotate*/
Expand Down Expand Up @@ -456,6 +460,8 @@ class Tagged : public Generic {
Generic* type_o;
Generic* rep_o;
Tagged(void) : Generic() {}

virtual ~Tagged(){}
};

class SharedVar : public Generic {
Expand All @@ -479,6 +485,8 @@ class SharedVar : public Generic {
/*new stuff*/
Generic* val;
SharedVar(void) : Generic() {}

virtual ~SharedVar(){}
};

class ProcessHandle;
Expand Down Expand Up @@ -510,6 +518,8 @@ class Pid : public Generic {
boost::shared_ptr<ProcessHandle> hproc;
Pid(boost::shared_ptr<ProcessHandle> p)
: Generic(), hproc(p) {}

virtual ~Pid(){}
};

class BinaryBlob : public Generic{
Expand Down Expand Up @@ -555,6 +565,8 @@ class BinaryBlob : public Generic{
unsigned char const& operator[](size_t i) const{
return (*pdat)[i];
}

virtual ~BinaryBlob(){}
};

/*object that conceptually contains an object that may be
Expand All @@ -579,6 +591,68 @@ class SemispacePackage : public Generic{
Generic* gp; //NOTE! Should point within the attached semispace
SemispacePackage(boost::shared_ptr<Semispace> nns, Generic* ngp)
: Generic(), ns(nns), gp(ngp) {}

virtual ~SemispacePackage(){}
};

/*Opaque datatype to be used internally by
central I/O process
*/
class PortData;

class Input : public Generic {
protected:
Input(Input const & o)
: Generic(), impl(o.impl) {}
public:
virtual size_t hash(void) const {
return (size_t) impl.get();
}
GENERIC_STANDARD_DEFINITIONS(Input)
virtual boost::shared_ptr<Atom> type_atom(void) const {
return INPUTATOM;
};
virtual void probe(size_t);

/*overrideable stuff*/
virtual bool is(Generic const* gp){
if(gp == this) return 1;
Input* ip = dynamic_cast<Input*>(gp);
if(ip == NULL) return 0;
return ip->impl == impl;
}

/*new stuff*/
boost::shared_ptr<PortData> impl;
virtual ~Input(){}
};

class Output : public Generic {
protected:
Output(Output const & o)
: Generic(), impl(o.impl) {}
public:
virtual size_t hash(void) const {
return (size_t) impl.get();
}
GENERIC_STANDARD_DEFINITIONS(Output)
virtual boost::shared_ptr<Atom> type_atom(void) const {
return OUTPUTATOM;
}
virtual void probe(size_t);

/*overrideable stuff*/
virtual bool is(Generic const* gp){
if(gp == this) return 1;
Output* op = dynamic_cast<Output*>(gp);
if(op == NULL) return 0;
return op->impl == impl;
}

/*new stuff*/
boost::shared_ptr<PortData> impl;
virtual ~Output(){}

};

#endif //TYPES_H
Expand Down

0 comments on commit af9e252

Please sign in to comment.