tape_odbc/odbctapestream.h

00001 /*  ODBCTapeStream.h
00002  *  Header for ODBC-based tape streams.
00003  *  Should be "interesting".
00004  *
00005  *  author: Matt Hauer, matthew.hauer@pnl.gov, 5/30/07 - ***
00006  */
00007 
00008 #ifndef _CODBCTAPESTREAM_H
00009 #define _CODBCTAPESTREAM_H
00010 
00011 #include <list>
00012 
00013 #include <stdio.h>
00014 #include <string.h>
00015 #include <iostream>
00016 
00017 #include <odbc++/preparedstatement.h>
00018 #include <odbc++/resultset.h>
00019 
00020 using namespace odbc;
00021 
00022 #include "ODBCConnHandle.h"
00023 #include "ODBCConnMgr.h"
00024 #include "TapeStream.h"
00025 
00026 using namespace std;
00027 
00028 class ODBCConnHandle;
00029 
00030 class ODBCTapeStream : public TapeStream{
00031 public:
00032     ODBCTapeStream();
00033     ODBCTapeStream(char *, char *);
00034     ODBCTapeStream(char *, char *, char *);
00035     ODBCTapeStream(char *, char *, char *, char *, char *);
00036     virtual ~ODBCTapeStream();
00037 
00038     int Open(char *, char *, char *);
00039     int Open(char *, char *, char *, char *, char *);
00040 
00041  // virtual char *Read();
00042     virtual char *ReadLine(char *, unsigned int);
00043     virtual char *ReadLine();
00044     virtual int ReadShape(char *, float *);
00045     virtual int Write(char*);
00046     virtual int Write(char*, char*);
00047     //int Write(int, OBJECT *);
00048     virtual void Close();
00049     void HardClose();
00050     virtual int Rewind();
00051     void Reset();
00052 
00053     virtual void PrintHeader(char *, char *, char *, char *, char *, char *, long, long);
00054 
00055     static TapeStream *OpenStream(void *, char *, char *);
00056     static void CloseStream(void *);
00057     static void CloseAllStream();
00058 protected:
00059     int                 line_cur, line_max;
00060     odbc::ResultSet     *lines;
00061     ODBCConnHandle *    dbconn;
00062     char                objectname[64];
00063     static list<tapepair *> tslist;
00064 };
00065 
00066 #endif

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy