ESLA
Embeddable Scriting LAnguage
Stanford University, Rock Fracture Project research group
© 2003
00001 #ifndef ESLA_LANGUAGE_OUTPUT 00002 #define ESLA_LANGUAGE_OUTPUT 00003 00004 #include "../esla_namespace.h" 00005 #include <iostream> 00006 #include <string> 00007 #include <vector> 00008 #include <fstream> 00009 00010 00011 BEGIN_LIB_NAMESPACE 00012 00013 class Writer ; 00014 00015 // -------------------------------------------------------- 00016 class ESLAOutput { 00017 friend class Writer ; 00018 public: 00019 static void write(ESLAOutput&, const std::string&) ; 00020 static void write_endl(ESLAOutput&) ; 00021 static void write_beginl(ESLAOutput&) ; 00022 static ESLAOutput& instance() ; 00023 operator ESLAOutput() ; 00024 00025 struct endl{ 00026 endl() ; 00027 } ; 00028 00029 struct beginl{ 00030 beginl() ; 00031 } ; 00032 00033 private: 00034 static void bind(Writer* w) ; 00035 static void unbind(Writer* w) ; 00036 00037 ESLAOutput() ; 00038 ~ESLAOutput() ; 00039 00040 static ESLAOutput* instance_ ; 00041 static std::vector<Writer*> list_ ; 00042 00043 } ; 00044 00045 00046 00047 ESLAOutput& operator << (ESLAOutput&, const bool& t) ; 00048 ESLAOutput& operator << (ESLAOutput&, const char& t) ; 00049 ESLAOutput& operator << (ESLAOutput&, const short& t) ; 00050 ESLAOutput& operator << (ESLAOutput&, const int& t) ; 00051 ESLAOutput& operator << (ESLAOutput&, const unsigned int& t) ; 00052 ESLAOutput& operator << (ESLAOutput&, const long int& t) ; 00053 ESLAOutput& operator << (ESLAOutput&, const float& t) ; 00054 ESLAOutput& operator << (ESLAOutput&, const double& t) ; 00055 ESLAOutput& operator << (ESLAOutput&, const char* t) ; 00056 ESLAOutput& operator << (ESLAOutput&, const std::string& s) ; 00057 ESLAOutput& operator << (ESLAOutput&, const ESLAOutput::endl&) ; 00058 ESLAOutput& operator << (ESLAOutput&, const ESLAOutput::beginl&) ; 00059 00060 00061 00062 END_LIB_NAMESPACE 00063 00064 #endif