Attribute.hh

Go to the documentation of this file.
00001 #ifndef ATTRIBUTE_HH
00002 #define ATTRIBUTE_HH
00003 
00004 //---------------------------------------------------------------------------
00005 // Copyright (c) 2004-2005 Clifton Labs, Inc. All Rights Reserved.
00006 
00007 // You may modify, distribute, and use the software contained in this package
00008 // under the terms of the "GNU LIBRARY GENERAL PUBLIC LICENSE" version 2,
00009 // June 1991. A copy of this license agreement can be found in the file
00010 // "LGPL", distributed with this archive.
00011 
00012 //---------------------------------------------------------------------------
00013 
00014 class SignalBase;
00015 
00016 enum AttribType { LAST_EVENT, EVENT, ACTIVE, LAST_ACTIVE, LAST_VALUE, 
00017                   DRIVING, DRIVING_VALUE, QUIET, STABLE, TRANSACTION,
00018                   INVALID};
00019 
00020 class Attribute {
00021 public:
00022   Attribute( AttribType initType, SignalBase &initSignal ) :
00023     myAttrib( initType ), mySignal( initSignal ){}
00024 
00025   SignalBase &getSignal() const { return mySignal; }
00026   AttribType getType() const { return myAttrib; }
00027 
00028 private:
00029   AttribType myAttrib;
00030   SignalBase &mySignal;
00031 };
00032 
00033 inline ostream & 
00034 operator << (ostream &os, const Attribute &at) {
00035   switch( at.getType() ) {
00036   case EVENT:
00037   case ACTIVE:
00038   case LAST_VALUE:
00039   case DRIVING:
00040   case DRIVING_VALUE:
00041     os << "Driving_Value Attribute";
00042     break;
00043   case LAST_ACTIVE:
00044   case LAST_EVENT:
00045     os << "Last_Event attribute";;
00046     break;
00047   case STABLE:
00048   case QUIET:
00049   case TRANSACTION:
00050     break;
00051   default:
00052     os << "(invalid attribute)";
00053     break;
00054   }
00055   return os;
00056 }
00057 
00058 inline ostream &
00059 operator << (ostream &os, const AttribType &at) {
00060   switch(at) {
00061   case EVENT:
00062     os << "EVENT";
00063     break;
00064   case ACTIVE:
00065     os << "ACTIVE";
00066     break;
00067   case LAST_EVENT:
00068     os << "LAST_EVENT";
00069     break;
00070   case LAST_ACTIVE:
00071     os << "LAST_ACTIVE";
00072     break;
00073   case LAST_VALUE:
00074     os << "LAST_VALUE";
00075     break;
00076   case DRIVING:
00077     os << "DRIVING";
00078     break;
00079   case DRIVING_VALUE:
00080     os << "DRIVING_VALUE";
00081     break;
00082   case STABLE:
00083     os << "STABLE";
00084     break;
00085   case QUIET:
00086     os << "QUIET";
00087     break;
00088   case TRANSACTION:
00089     os << "TRANSACTION";
00090     break;
00091   default:
00092     os << "(invalid attribute type)";
00093     break;
00094   }
00095   return os;
00096 }
00097 
00098 #endif

Generated on Fri Mar 31 11:05:08 2006 for Tyvis by  doxygen 1.4.6