include/session.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  * Copyright 2002 Jeff Rush <jrush@taupro.com>
00003  * Original Copyright 1979-2002 Udanax.com
00004  *
00005  * This file is part of the Udanax xanalogical storage system.
00006  *
00007  * Udanax is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * Udanax is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with Udanax; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  **********************************************************************/
00021 
00030 /* Modification History:
00031  * $Log: session.h,v $
00032  * Revision 1.9  2002/05/28 03:51:13  jrush
00033  * Updated sources to comply with a GPL licensing.
00034  *
00035  * Revision 1.8  2002/04/12 11:46:25  jrush
00036  * Major rearrangement of include contents, to reflect a hopefully more
00037  * logical layout as we refactor Udanax into classes.
00038  *
00039  * Revision 1.7  2002/04/10 18:01:54  jrush
00040  * Renamed class typeisa to IStreamAddr.
00041  *
00042  * Revision 1.6  2002/04/09 21:45:46  jrush
00043  * Renamed class 'tumbler' to 'Tumbler', for consistency with Python sources,
00044  * and changed typeisa from typedef to a subclass, in preparation for cleaning
00045  * up the type/class tree.
00046  *
00047  * Revision 1.5  2002/04/07 14:02:55  jrush
00048  * Added errorcode and reason enums to Session object, so that more than a
00049  * pass/fail indicator for Udanax API calls can be passed back to the client
00050  * program.
00051  *
00052  * Revision 1.4  2002/04/06 20:42:50  jrush
00053  * Switch from sess->alloc() style to new(sess) Object parameterized allocator.
00054  *
00055  * Revision 1.3  2002/04/06 17:05:57  jrush
00056  * Switched from referring to 'task' for a client connection to 'session',
00057  * and converted the typetask typedef/struct into a Session C++ class.
00058  *
00059  * Revision 1.6  2002/04/06 15:22:53  jrush
00060  * Broke out tumbler struct/typedef as a C++ class.
00061  *
00062  * Revision 1.5  2002/04/06 15:00:34  jrush
00063  * Changed INT to just 'int'.
00064  *
00065  * Revision 1.4  2002/02/14 05:40:42  jrush
00066  * Cleaned up source:
00067  *
00068  * 1. ran thru the indent tool to achieve a standard look,
00069  * 2. added structured comments at top for use with DOxygen reporting
00070  *    as well as CVS keywords,
00071  * 3. added #ifndef/#defines to prevent duplicate inclusions,
00072  * 4. insured all struct/union defs have names,
00073  * 5. centralized prototypes in protos.h, removing incomplete ones,
00074  * 6. cleaned up use of bool/BOOLEAN type to suit C++ type,
00075  * 7. fixed initializer nesting in tumbler constants.
00076  *
00077  */
00078 
00079 #ifndef __UDANAX_SESSION_H__
00080 #define __UDANAX_SESSION_H__
00081 
00082 #include <stdio.h>
00083 
00084 union typeitem;
00085 typedef typeitem *typeitemset;
00086 
00087 enum ErrorCode {
00088     ERR_CLOSE_WO_OPEN = 1,  // Attempted close of a document that was never opened
00089     ERR_OPEN_COPY     = 2,  // Attempt to make a copy to open failed
00090 };
00091 
00092 class Session {
00093 public:
00094     struct typetthingheader { // Private Structure
00095         typetthingheader *tlast;
00096         typetthingheader *tnext;
00097     };
00098 public:
00099     Session();
00100     bool getaccount(IStreamAddr *accountptr);
00101     void free();
00102     void freeexplicit(char *ptr);
00103     void freeitemset(typeitemset itemset);
00104 
00105     FILE              *inp;
00106     FILE              *outp;
00107     FILE              *errp;
00108     typetthingheader  *tempspacehead;    /* doubly linked talloc space so */
00109     typetthingheader  *tempspacetail;    /* that single items can be freed */
00110     IStreamAddr        account;
00111     bool               charinbuff;
00112     char               charbuff;
00113     ErrorCode          errorcode;
00114 
00115 private:
00116     friend void *operator new(size_t nbytes, Session *sess);
00117     int *alloc(int nbytes);
00118 };
00119 
00120 #endif /* !__UDANAX_SESSION_H__*/

Generated on Sun Aug 21 04:18:13 2005 for Udanax-Green by doxygen1.3.4