summaryrefslogtreecommitdiff
path: root/lang/cxx/cxx_dbstream.cpp
blob: e158c384f359e87bcd6bf2fcd0b8733d0a7a9cbd (plain)
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
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2013, 2015 Oracle and/or its affiliates.  All rights reserved.
 *
 * $Id$
 */

#include "db_config.h"

#include "db_int.h"

#include "db_cxx.h"
#include "dbinc/cxx_int.h"

#include "dbinc/db_page.h"
#include "dbinc/db_am.h"
#include "dbinc/blob.h"
#include "dbinc/fop.h"
#include "dbinc/mp.h"

// Helper macro for simple methods that pass through to the
// underlying C method. It may return an error or raise an exception.
// Note this macro expects that input _argspec is an argument
// list element (e.g., "char *arg") and that _arglist is the arguments
// that should be passed through to the C method (e.g., "(db, arg)")
//
#define	DBSTREAM_METHOD(_name, _argspec, _arglist)			\
int DbStream::_name _argspec						\
{									\
	int ret;							\
	DB_STREAM *dbs = this;						\
									\
	ret = dbs->_name _arglist;					\
	if (!DB_RETOK_STD(ret))						\
		DB_ERROR(DbEnv::get_DbEnv(dbs->dbc->dbenv),		\
		    "Dbstream::" # _name, ret, ON_ERROR_UNKNOWN);	\
	return (ret);							\
}

// It's private, and should never be called, but VC4.0 needs it resolved
//
DbStream::~DbStream()
{
}

DBSTREAM_METHOD(close, (u_int32_t _flags), (dbs, _flags));
DBSTREAM_METHOD(read,
    (Dbt *data, db_off_t offset, u_int32_t size, u_int32_t _flags),
    (dbs, data, offset, size, _flags));
DBSTREAM_METHOD(size, (db_off_t *size, u_int32_t _flags),
    (dbs, size, _flags));
DBSTREAM_METHOD(write, (Dbt *data, db_off_t offset, u_int32_t _flags),
    (dbs, data, offset, _flags));