diff options
author | Bernard Normier <bernard@zeroc.com> | 2003-10-21 20:40:01 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2003-10-21 20:40:01 +0000 |
commit | 2cb10f33a1cc8d3d94450fa45cc8f63ba32c137f (patch) | |
tree | ee83ca7fa800f497d1e7f340c5d1737545235870 /cpp/src/Freeze/Util.h | |
parent | Fixed code generation bug. (diff) | |
download | ice-2cb10f33a1cc8d3d94450fa45cc8f63ba32c137f.tar.bz2 ice-2cb10f33a1cc8d3d94450fa45cc8f63ba32c137f.tar.xz ice-2cb10f33a1cc8d3d94450fa45cc8f63ba32c137f.zip |
Added Freeze evictor indices
Diffstat (limited to 'cpp/src/Freeze/Util.h')
-rw-r--r-- | cpp/src/Freeze/Util.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/cpp/src/Freeze/Util.h b/cpp/src/Freeze/Util.h new file mode 100644 index 00000000000..e5ec22b758a --- /dev/null +++ b/cpp/src/Freeze/Util.h @@ -0,0 +1,66 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +#ifndef FREEZE_UTIL_H +#define FREEZE_UTIL_H + +#include <Ice/Ice.h> +#include <Freeze/DB.h> +#include <db_cxx.h> +#include <sys/stat.h> + +#ifdef _WIN32 +# define FREEZE_DB_MODE 0 +#else +# define FREEZE_DB_MODE (S_IRUSR | S_IWUSR) +#endif + + +namespace Freeze +{ + +inline void +initializeInDbt(const std::vector<Ice::Byte>& v, Dbt& dbt) +{ + dbt.set_data(const_cast<Ice::Byte*>(&v[0])); + dbt.set_size(v.size()); + dbt.set_ulen(0); + dbt.set_dlen(0); + dbt.set_doff(0); + dbt.set_flags(DB_DBT_USERMEM); +} + +inline void +initializeOutDbt(std::vector<Ice::Byte>& v, Dbt& dbt) +{ + v.resize(v.capacity()); + dbt.set_data(&v[0]); + dbt.set_size(0); + dbt.set_ulen(v.size()); + dbt.set_dlen(0); + dbt.set_doff(0); + dbt.set_flags(DB_DBT_USERMEM); +} + +void +handleMemoryException(const DbMemoryException&, Key&, Dbt&); + +void +handleMemoryException(const DbMemoryException&, Key&, Dbt&, Value&, Dbt&); + +} + + +#endif + |