stid_t.cpp

00001 /*<std-header orig-src='shore'>
00002 
00003  $Id: stid_t.cpp,v 1.15 2010/09/15 18:35:36 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 const w_hashing::hash2 stid_t::_hash;
00049 
00050 ostream& operator<<(ostream& o, const stid_t& stid)
00051 {
00052     return o << "s(" << stid.vol << '.' << stid.store << ')';
00053 }
00054 
00055 istream& operator>>(istream& i, stid_t& stid)
00056 {
00057     char c[5];
00058     memset(c, '\0', sizeof(c));
00059     i >> c[0];
00060     if(i.good()) 
00061         i >> c[1];
00062     if(i.good()) 
00063         i >> stid.vol;
00064     if(i.good()) 
00065         i >> c[2];
00066     if(i.good()) 
00067         i >> stid.store;
00068     if(i.good()) 
00069         i >> c[3];
00070     c[4] = '\0';
00071     if (i) {
00072         if (strcmp(c, "s(.)")) {
00073             i.clear(ios::badbit|i.rdstate());  // error
00074         }
00075     }
00076     return i;
00077 }
00078 

Generated on Thu Dec 9 08:42:26 2010 for Shore Storage Manager by  doxygen 1.4.7