Savarese Software Research Corporation
types.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2009 Savarese Software Research Corporation
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     https://www.savarese.com/software/ApacheLicense-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00022 #ifndef __SSRC_WSPR_TYPES_H
00023 #define __SSRC_WSPR_TYPES_H
00024 
00025 #include <ssrc/wispers-packages.h>
00026 #include <ssrc/wisp/utility/TimeValue.h>
00027 
00028 #include <string>
00029 
00030 __BEGIN_NS_SSRC_WSPR
00031 
00032 using NS_SSRC_WISP_UTILITY::TimeValue;
00033 using NS_SSRC_WISP_UTILITY::InfiniteTimeValue;
00034 using std::string;
00035 
00037 typedef string sid_type;
00038 enum SessionIdLimits { SessionIdNumBytes = 16, SessionIdNumChars = 32 };
00039 
00041 typedef std::uint64_t uid_type;
00042 
00044 typedef std::uint64_t gid_type;
00045 
00047 typedef std::int64_t gsid_type;
00048 
00050 typedef TimeValue::sec_type sec_type;
00051 
00052 // These should probably be std::int64_t.
00053 typedef unsigned int db_limit_type;
00054 typedef unsigned int db_offset_type;
00055 
00057 typedef std::uint64_t row_id_type;
00058 
00059 // Conventions for representing most row identifiers..
00060 const row_id_type NullRowId = boost::integer_traits<row_id_type>::const_min;
00061 const row_id_type MinRowId = NullRowId + 1;
00062 // We lose half of the 64-bit space because sqlite deals in signed integers.
00063 // We used to use a signed row_id_type, but that presented its own
00064 // complications.
00065 //const row_id_type MaxRowId  = boost::integer_traits<row_id_type>::const_max;
00066 const row_id_type MaxRowId  = boost::integer_traits<std::int64_t>::const_max;
00067 
00068 template<typename value_type>
00069 inline value_type null_row_id() {
00070   return boost::integer_traits<value_type>::const_min;
00071 }
00072 
00073 template<typename value_type>
00074 inline value_type min_row_id() {
00075   return null_row_id<value_type>() + 1;
00076 }
00077 
00082 struct uuid_key_type {
00083   std::int64_t high_bits;
00084   std::int64_t low_bits;
00085 };
00086 
00087 __END_NS_SSRC_WSPR
00088 
00089 #endif

Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.