Altri files modificati per cause spurie (fmkmk problematici) git-svn-id: svn://10.65.10.50/trunk@802 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			65 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//      $Id: value.h,v 1.2 1994-12-29 14:51:40 villa Exp $   
 | 
						|
// language types for Simulation and SimulationManager  
 | 
						|
// -------------------------------------------------------------------------
 | 
						|
 | 
						|
 | 
						|
#ifndef __VALUE_H
 | 
						|
#define __VALUE_H
 | 
						|
 | 
						|
#ifndef _string_h
 | 
						|
#include <string.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef _iostream_h
 | 
						|
#include <iostream.h>
 | 
						|
#endif
 | 
						|
 | 
						|
 | 
						|
enum basetype
 | 
						|
{
 | 
						|
  UNDEFINED, VOID, INT, LONG, CHAR, DOUBLE, STRING
 | 
						|
  };
 | 
						|
 | 
						|
class Value
 | 
						|
{
 | 
						|
  basetype _type;
 | 
						|
  char _buf[20];
 | 
						|
  union {
 | 
						|
    char   c;
 | 
						|
    int    i;
 | 
						|
    long   l;
 | 
						|
    double d;
 | 
						|
  } v;
 | 
						|
  char* _s;
 | 
						|
 | 
						|
public:
 | 
						|
 | 
						|
  Value()         { _buf[0] = '\0';        _type = VOID; }
 | 
						|
  Value(long l)   { sprintf(_buf,"%ld",l); _type = LONG; }
 | 
						|
  Value(char* s)  { _s = s;               _type = STRING; }
 | 
						|
  Value(int i)    { sprintf(_buf,"%d",i);  _type = INT; }
 | 
						|
  Value(char c)   { sprintf(_buf,"%c",c);  _type = CHAR; }
 | 
						|
  Value(double d) { sprintf(_buf,"%lf",d); _type = DOUBLE; }
 | 
						|
  Value(Value& vl){ strcpy(_buf,vl._buf);  v = vl.v; _s = vl._s; 
 | 
						|
                    _type = vl._type; } 
 | 
						|
 | 
						|
  enum basetype type() { return _type; }
 | 
						|
 | 
						|
  operator int()    { sscanf(_type == STRING ? _s : _buf,"%d",&(v.i)); 
 | 
						|
                      return v.i; }
 | 
						|
  operator double() { sscanf(_type == STRING ? _s : _buf,"%lf",&(v.d));
 | 
						|
                      return v.d; }
 | 
						|
  operator char*()  { return _type == STRING ? _s : _buf;  }
 | 
						|
  operator long()   { sscanf(_type == STRING ? _s : _buf,"%ld",&(v.l));
 | 
						|
                      return v.l; }
 | 
						|
  operator char()   { sscanf(_type == STRING ? _s : _buf,"%c",&(v.c));
 | 
						|
                      return v.c; }
 | 
						|
 | 
						|
  Value& operator=(const Value& val);
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
#endif
 | 
						|
 | 
						|
// EOF langtypes.H
 |