File: unitransaction.h

package info (click to toggle)
wvstreams 4.6.1-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 6,972 kB
  • sloc: cpp: 64,200; ansic: 4,154; sh: 4,094; makefile: 545; perl: 402
file content (43 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (10)
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
/* -*- Mode: C++ -*-
 * Worldvisions Weaver Software:
 *   Copyright (C) 2005 Net Integration Technologies, Inc.
 *
 * Allows one to wrap a UniConf tree with a transaction model.  Use
 * UniTransaction::commit() to commit, and
 * UniTransaction::refresh() to rollback.
 */
#ifndef _UNITRANSACTION_H
#define _UNITRANSACTION_H

#include "unibachelorgen.h"
#include "uniconfroot.h"
#include "unitransactiongen.h"
#include "uniunwrapgen.h"

/**
 * Wraps an existing UniConf tree with a transaction generator.
 */
class UniTransaction : public UniConfRoot
{
    friend class UniConf;
    friend class UniConf::Iter;
    friend class UniConf::RecursiveIter;

public:
    UniTransaction(const UniConf &base)
	: UniConfRoot(new UniTransactionGen(new UniBachelorGen(
		      new UniUnwrapGen(base))), false)
    {
    }
    
    // C++ would auto-generate a "copy constructor" for this function, but
    // what we really want is just to wrap a new transaction around the
    // base, just like any other UniConf object.
    UniTransaction(const UniTransaction &base)
	: UniConfRoot(new UniTransactionGen(new UniBachelorGen(
		      new UniUnwrapGen(base))), false)
    {
    }
};

#endif /* _UNITRANSACTION_H */