stid_t.cpp

00001 /*<std-header orig-src='shore'>
00002 
00003  $Id: stid_t.cpp,v 1.14 2010/05/26 01:20:12 nhall Exp $
00004 
00005 SHORE -- Scalable Heterogeneous Object REpository
00006 
00007 Copyright (c) 1994-99 Computer Sciences Department, University of
00008                       Wisconsin -- Madison
00009 All Rights Reserved.
00010 
00011 Permission to use, copy, modify and distribute this software and its
00012 documentation is hereby granted, provided that both the copyright
00013 notice and this permission notice appear in all copies of the
00014 software, derivative works or modified versions, and any portions
00015 thereof, and that both notices appear in supporting documentation.
00016 
00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY
00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS
00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND
00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00021 
00022 This software was developed with support by the Advanced Research
00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by
00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.
00025 Further funding for this work was provided by DARPA through
00026 Rome Research Laboratory Contract No. F30602-97-2-0247.
00027 
00028 */
00029 
00030 #include "w_defines.h"
00031 
00032 /*  -- do not edit anything above this line --   </std-header>*/
00033 
00034 #ifdef __GNUC__
00035 #pragma implementation "stid_t.h"
00036 #endif
00037 
00038 #define VEC_T_C
00039 #include <cstdlib>
00040 #include <cstring>
00041 #include <w_stream.h>
00042 #include <w_base.h>
00043 #include <w_minmax.h>
00044 #include "basics.h"
00045 #include "stid_t.h"
00046 
00047 const stid_t stid_t::null;
00048 
00049 ostream& operator<<(ostream& o, const stid_t& stid)
00050 {
00051     return o << "s(" << stid.vol << '.' << stid.store << ')';
00052 }
00053 
00054 istream& operator>>(istream& i, stid_t& stid)
00055 {
00056     char c[5];
00057     memset(c, '\0', sizeof(c));
00058     i >> c[0];
00059     if(i.good()) 
00060         i >> c[1];
00061     if(i.good()) 
00062         i >> stid.vol;
00063     if(i.good()) 
00064         i >> c[2];
00065     if(i.good()) 
00066         i >> stid.store;
00067     if(i.good()) 
00068         i >> c[3];
00069     c[4] = '\0';
00070     if (i) {
00071         if (strcmp(c, "s(.)")) {
00072             i.clear(ios::badbit|i.rdstate());  // error
00073         }
00074     }
00075     return i;
00076 }
00077 

Generated on Wed Jul 7 17:22:32 2010 for Shore Storage Manager by  doxygen 1.4.7