neuray API Programmer's Manual

itransaction.h File Reference

Description

Database transactions.

Code Example

itransaction.h

‎//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************

#ifndef MI_NEURAYLIB_ITRANSACTION_H
#define MI_NEURAYLIB_ITRANSACTION_H

#include <mi/base/interface_declare.h>
#include <mi/neuraylib/type_traits.h>

namespace mi {

class IArray;

namespace neuraylib {

class IScope;















































class ITransaction : public
    mi::base::Interface_declare<0x6ca1f0c2,0xb262,0x4f09,0xa6,0xa5,0x05,0xae,0x14,0x45,0xed,0xfa>
{
public:
    virtual Sint32 
               commit() = 0;

    virtual void abort() = 0;

    virtual bool is_open() const = 0;

    virtual base::IInterface* create(
        const char* type_name,
        Uint32 argc = 0,
        const base::IInterface* argv[] = 0) = 0;

    template<class T>
    T* create(
        const char* type_name,
        Uint32 argc = 0,
        const base::IInterface* argv[] = 0)
    {
        base::IInterface* ptr_iinterface = create( type_name, argc, argv);
        if( !ptr_iinterface)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    }

    template<class T>
    T* create()
    {
        return create<T>( Type_traits<T>::get_type_name());
    }

    static const mi::Uint8 
               LOCAL_SCOPE = 255;

#ifdef MI_NEURAYLIB_DEPRECATED_ITRANSACTION_STORE_DEFAULT_PRIVACY_LEVEL_ZERO
    virtual Sint32 
               store(
        base::IInterface* db_element, const char* name, Uint8 privacy = 0) = 0;
#else
    virtual Sint32 
               store(
        base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
#endif

    virtual const base::IInterface* access( const char* name) = 0;

    template<class T>
    const T* access( const char* name)
    {
        const base::IInterface* ptr_iinterface = access( name);
        if( !ptr_iinterface)
            return 0;
        const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    }

    virtual base::IInterface* edit( const char* name) = 0;

    template<class T>
    T* edit( const char* name)
    {
        base::IInterface* ptr_iinterface = edit( name);
        if( !ptr_iinterface)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    }

    virtual Sint32 
               copy( const char* source, const char* target, Uint8 privacy = 0) = 0;

    virtual Sint32 remove( const char* name, bool only_localized = false) = 0;

    virtual const char* name_of( const base::IInterface* db_element) const = 0;

    virtual const char* get_time_stamp() const = 0;

    virtual const char* get_time_stamp( const char* element) const = 0;

    virtual bool has_changed_since_time_stamp(
        const char* element, const char* time_stamp) const = 0;

    virtual const char* get_id() const = 0;

    virtual IScope* get_scope() const = 0;

    virtual IArray* list_elements(
        const char* root_element,
        const char* name_pattern = 0,
        const IArray* type_names = 0) const = 0;

    virtual Sint32 
               get_privacy_level( const char* name) const = 0;
};
 // end group mi_neuray_database_access

} // namespace neuraylib

} // namespace mi

#endif // MI_NEURAYLIB_ITRANSACTION_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
namespace 
Namespace for the neuray API. More...

Classes

class 
A transaction provides a consistent view on the database. More...