// file : odb/tracer/transaction.cxx // author : Boris Kolpackov // license : GNU GPL v2; see accompanying LICENSE file #include namespace odb { namespace tracer { transaction& transaction:: current () { // While the impl type can be of the concrete type, the transaction // object can be created as either odb:: or odb::tracer:: type. To // work around that we are going to hard-cast one two the other // relying on the fact that they have the same representation and // no virtual functions. The former is checked in the tests. // odb::transaction& b (odb::transaction::current ()); dynamic_cast (b.implementation ()); return reinterpret_cast (b); } } }