/usr/include/ncbi-vdb/vdb/manager.hpp is in libncbi-vdb-dev 2.8.1+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | /*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#ifndef _hpp_vdb_manager_
#define _hpp_vdb_manager_
#ifndef _h_vdb_manager_
#include <vdb/manager.h>
#endif
#ifndef _h_vdb_table_
#include <vdb/table.h>
#endif
#ifndef _h_vdb_schema_
#include <vdb/schema.h>
#endif
#ifndef _h_vdb_database_
#include <vdb/database.h>
#endif
/*--------------------------------------------------------------------------
* forward decl. for CreateDB
*/
struct VDatabase;
struct VSchema;
struct VPath;
/*--------------------------------------------------------------------------
* VDBManager
* opaque handle to library
*/
struct VDBManager
{
/* AddRef
* Release
* all objects are reference counted
* NULL references are ignored
*/
inline rc_t AddRef () const throw()
{ return VDBManagerAddRef ( this ); }
inline rc_t Release () const throw()
{ return VDBManagerRelease ( this ); }
/* CreateDB
* create a new or open an existing database using manager
*
* "db" [ OUT ] - return parameter for newly opened database
*
* "schema" [ IN ] - schema object containg database
* declaration to be used in creating db.
*
* "typespec" [ IN ] - type and optionally version of db schema,
* e.g. 'MY_NAMESPACE:MyDatabase' or 'MY_NAMESPACE:MyDatabase#1.1'
*
* "cmode" [ IN ] - creation mode
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to database
*/
inline rc_t CreateDB ( VDatabase **db, struct VSchema const *schema,
const char *typespec, KCreateMode cmode, const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVCreateDB ( this, db, schema, typespec, cmode, path, args );
va_end ( args );
return rc;
}
inline rc_t CreateDB ( VDatabase **db, struct VSchema const *schema,
const char *typespec, KCreateMode cmode, const char *path, va_list args ) throw()
{ return VDBManagerVCreateDB ( this, db, schema, typespec, cmode, path, args ); }
/* OpenDBRead
* open a database for read using manager
* OpenDBUpdate
* open a database for read/write using manager
*
* "db" [ OUT ] - return parameter for newly opened database
*
* "schema" [ IN, NULL OKAY ] - schema object containg database
* declaration to be used in creating db [ needed by manager ].
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to database
*/
inline rc_t OpenDB( const VDatabase **db, struct VSchema const *schema,
const char *path, ... ) const throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVOpenDBRead ( this, db, schema, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenDB( const VDatabase **db, struct VSchema const *schema,
const char *path, va_list args ) const throw()
{ return VDBManagerVOpenDBRead ( this, db, schema, path, args ); }
inline rc_t OpenDB( VDatabase **db, struct VSchema const *schema,
const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVOpenDBUpdate ( this, db, schema, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenDB( VDatabase **db, struct VSchema const *schema,
const char *path, va_list args ) throw()
{ return VDBManagerVOpenDBUpdate ( this, db, schema, path, args ); }
/* CreateTable
* create a new or open an existing table using manager
*
* "tbl" [ OUT ] - return parameter for newly opened table
*
* "schema" [ IN ] - schema object containg table
* declaration to be used in creating tbl.
*
* "typespec" [ IN ] - type and optionally version of table schema,
* e.g. 'MY_NAMESPACE:MyTable' or 'MY_NAMESPACE:MyTable#1.1'
*
* "cmode" [ IN ] - creation mode
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to table
*/
inline rc_t CreateTable ( VTable **tbl, struct VSchema const *schema,
const char *typespec, KCreateMode cmode, const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVCreateTable ( this, tbl, schema, typespec, cmode, path, args );
va_end ( args );
return rc;
}
inline rc_t CreateTable ( VTable **tbl, struct VSchema const *schema,
const char *typespec, KCreateMode cmode, const char *path, va_list args ) throw()
{ return VDBManagerVCreateTable ( this, tbl, schema, typespec, cmode, path, args ); }
/* OpenTableRead
* open a table for read using manager
* OpenTableUpdate
* open a table for read/write using manager
*
* "tbl" [ OUT ] - return parameter for newly opened table
*
* "schema" [ IN, NULL OKAY ] - optional schema object with
* latest versions of table schema.
*
* "path" [ IN ] - NUL terminated string in
* wd-native character set giving path to table
*/
inline rc_t OpenTable ( const VTable **tbl, struct VSchema const *schema,
const char *path, ... ) const throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVOpenTableRead ( this, tbl, schema, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenTable ( const VTable **tbl, struct VSchema const *schema,
const char *path, va_list args ) const throw ()
{ return VDBManagerVOpenTableRead ( this, tbl, schema, path, args ); }
inline rc_t OpenTable ( VTable **tbl, struct VSchema const *schema,
const char *path, ... ) throw ()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVOpenTableUpdate ( this, tbl, schema, path, args );
va_end ( args );
return rc;
}
inline rc_t OpenTable ( VTable **tbl, struct VSchema const *schema,
const char *path, va_list args ) throw ()
{ return VDBManagerVOpenTableUpdate ( this, tbl, schema, path, args ); }
/* MakeSchema
* create a schema object
*/
inline rc_t MakeSchema ( VSchema **schema ) const throw()
{ return VDBManagerMakeSchema ( this, schema ); }
/* MakeRead
* MakeUpdate
* create library handle for specific use
* NB - only one of the functions will be implemented
*
* "wd" [ IN, NULL OKAY ] - optional working directory for
* accessing the file system. mgr will attach its own reference.
*/
static inline rc_t MakeRead ( const VDBManager **mgr,
const KDirectory *wd = 0 ) throw()
{ return VDBManagerMakeRead ( mgr, wd ); }
static inline rc_t MakeUpdate ( VDBManager **mgr,
KDirectory *wd = 0 ) throw()
{ return VDBManagerMakeUpdate ( mgr, wd ); }
/* Version
* returns the library version
*/
inline rc_t Version ( uint32_t *version ) const throw()
{ return VDBManagerVersion ( this, version ); }
/* Writable
* returns 0 if object is writable
* or a reason why if not
*
* "path" [ IN ] - NUL terminated path
*/
inline rc_t Writable ( const char *path, ... ) const throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVWritable ( this, path, args );
va_end ( args );
return rc;
}
inline rc_t Writable ( const char *path, va_list args ) const throw()
{ return VDBManagerVWritable ( this, path, args ); }
/* Lock
* apply lock
*
* if object is already locked, the operation is idempotent
* and returns an rc state of rcLocked
*
* "path" [ IN ] - NUL terminated path
*/
inline rc_t Lock ( const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVLock ( this, path, args );
va_end ( args );
return rc;
}
inline rc_t Lock ( const char *path, va_list args ) throw()
{ return VDBManagerVLock ( this, path, args ); }
/* Unlock
* remove lock
*
* if object is already unlocked, the operation is idempotent
* and returns an rc state of rcUnlocked
*
* "path" [ IN ] - NUL terminated path
*/
inline rc_t Unlock ( const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVUnlock ( this, path, args );
va_end ( args );
return rc;
}
inline rc_t Unlock ( const char *path, va_list args ) throw()
{ return VDBManagerVUnlock ( this, path, args ); }
/* Drop
* drop an object based on its path
*
* "path" [ IN ] - NUL terminated string in UTF-8 giving path to the vdb object
*/
inline rc_t Drop( uint32_t obj_type, const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVDrop ( this, obj_type, path, args );
va_end ( args );
return rc;
}
inline rc_t Drop( uint32_t obj_type, const char *path, va_list args ) throw()
{ return VDBManagerVDrop ( this, obj_type, path, args ); }
/* AddSchemaIncludePath
* add a path to schema for locating input files
*/
inline rc_t AddSchemaIncludePath ( const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVAddSchemaIncludePath ( this, path, args );
va_end ( args );
return rc;
}
inline rc_t AddSchemaIncludePath ( const char *path, va_list args ) throw()
{ return VDBManagerVAddSchemaIncludePath ( this, path, args ); }
/* AddLoadLibraryPath
* add a path to loader for locating dynamic libraries
*/
inline rc_t AddLoadLibraryPath ( const char *path, ... ) throw()
{
va_list args;
va_start ( args, path );
rc_t rc = VDBManagerVAddLoadLibraryPath ( this, path, args );
va_end ( args );
return rc;
}
inline rc_t AddLoadLibraryPath ( const char *path, va_list args ) throw()
{ return VDBManagerVAddLoadLibraryPath ( this, path, args ); }
/* GetUserData
* SetUserData
* store/retrieve an opaque pointer to user data
*
* "data" [ OUT ] - return parameter for getting data
* "data" [ IN ] - parameter for setting data
*
* "destroy" [ IN, NULL OKAY ] - optional destructor param
* invoked from destructor of "self"
*/
inline rc_t GetUserData ( void **data ) const throw()
{ return VDBManagerGetUserData ( this, data ); }
inline rc_t SetUserData ( void *data,
void ( CC * destroy ) ( void *data ) = 0 ) const throw()
{ return VDBManagerSetUserData ( this, data, destroy ); }
/* GetCacheRoot
* SetCacheRoot
* get/set CacheRoot ( location for user-repo/dbgap-repo )
*
* "path" [ OUT ] - VPath pointing to current location
* "path" [ IN ] - VPath of new location
*
*/
inline rc_t GetCacheRoot ( struct VPath const ** path ) const throw()
{ return VDBManagerGetCacheRoot ( this, path ); }
inline rc_t SetCacheRoot ( struct VPath const * path ) const throw()
{ return VDBManagerSetCacheRoot ( this, path ); }
private:
VDBManager ();
~ VDBManager ();
VDBManager ( const VDBManager& );
VDBManager &operator = ( const VDBManager& );
};
#endif // _hpp_vdb_manager_
|