Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

schsymb.hpp

Go to the documentation of this file.
00001 // +-------------------------------------------------------------------------+
00002 // |               I__n__t__e__L__i__b           0.6.10 development          |
00003 // | Copyright (c) Andrey Vikt. Stolyarov <crocodil_AT_croco.net> 2000-2007. |
00004 // |                                                                         |
00005 // | This is free software. The library part is available under              |
00006 // |                               GNU LESSER GENERAL PUBLIC LICENSE v.2.1.  |
00007 // | GNU LGPL v2.1 is found in docs/gnu_gpl2.txt,  or at  http://www.gnu.org |
00008 // |     Please see also docs/readme.txt and visit http://www.intelib.org    |
00009 // |                                                                         |
00010 // | !!! THERE IS NO WARRANTY OF ANY KIND, NEITHER EXPRESSED NOR IMPLIED !!! |
00011 // +-------------------------------------------------------------------------+
00012 
00013 
00014 
00015 
00023 #ifndef INTELIB_SCHSYMB_HPP_SENTRY
00024 #define INTELIB_SCHSYMB_HPP_SENTRY
00025 
00026 #include "../sexpress/gensref.hpp"
00027 #include "../sexpress/sexpress.hpp"
00028 
00030 
00036 class SchExpressionSymbol : public SExpressionLabel {
00037     SReference value;
00038 protected:
00040     SchExpressionSymbol(const char *a_name, const IntelibTypeId &t) 
00041         : SExpressionLabel(t, a_name), value() {}
00042     ~SchExpressionSymbol() {}
00043 
00044 public:
00046     static IntelibTypeId TypeId;
00048     SchExpressionSymbol(const char *a_name) 
00049         : SExpressionLabel(TypeId, a_name), value() {}
00050 
00052     const SReference& GetGlobalValue() const { return value; } 
00054     SReference& GetGlobalValue() { return value; } 
00056     void SetGlobalValue(const SReference &val) { value = val; }
00057 };
00058 
00060 class IntelibX_scheme_not_a_symbol : public IntelibX {
00061 public:
00062     IntelibX_scheme_not_a_symbol(SReference a_param);
00063 };
00064 
00066 typedef GenericSReference<SchExpressionSymbol,IntelibX_scheme_not_a_symbol>
00067 SchSymbolRef;
00068 
00070 
00075 class SchSymbol : public SchSymbolRef {
00076 public:
00078     SchSymbol(const char *s) 
00079         : SchSymbolRef(new SchExpressionSymbol(s)) {}
00080 
00082     SchSymbol(const char *s, const SReference& val)
00083         : SchSymbolRef(new SchExpressionSymbol(s))
00084     {
00085         (*this)->SetGlobalValue(val);
00086     }
00087 
00089     ~SchSymbol() {}
00090 
00091 private:
00092     // made private to prevent the user from mistakes and
00093     //   to make sure this always points to SchExpressionSymbol object.
00094     void operator =(const SchSymbol& ref) {}
00095     SchSymbol(const SchSymbol&) {}
00096 };
00097 
00099 class SchSymbolQuote : public SchSymbol {
00100 public:
00101     SchSymbolQuote();
00102 };
00103 
00105 class SchLabelTrue : public SLabel {
00106 public:
00107     SchLabelTrue();
00108 };
00109 
00111 class SchLabelFalse : public SLabel {
00112 public:
00113     SchLabelFalse();
00114 };
00115 
00117 class SchLabelEmptyList : public SLabel {
00118 public:
00119     SchLabelEmptyList();
00120 };
00121 
00123 extern struct SchLibraryProvidedSymbols {
00124     SchSymbolQuote Quote;
00125     SchLabelTrue True;
00126     SchLabelFalse False;
00127     SchLabelEmptyList EmptyList;
00128 } TheSchLibraryProvidedSymbols;
00129 
00130 extern SchSymbol &QUOTE;
00131 
00132 #endif

Generated on Tue Dec 18 00:39:44 2007 for InteLib by  doxygen 1.4.1