Skip to content
Back to top
View this page

# Core Utilities

Core classes for definitions, namespaces, paths, and utilities.

When to use: Use `Definitions` to register custom types, `Path` to navigate nested structures, and `Logging` for debug output.

## Quick Start

    from dsviper import Definitions, NameSpace, ValueUUId, Path, LoggerConsole, Logging

    # Create namespace for your types
    ns = NameSpace(ValueUUId("f529bc42-0618-4f54-a3fb-d55f95c5ad03"), "MyApp")

    # Create and register definitions
    defs = Definitions()

    # Paths navigate nested structures
    path = Path.from_field("user").field("address").field("city").const()
    city = path.at(document)  # Get value at path
    path.set(document, "Paris")  # Set value at path

    # Logging for debugging
    logger = LoggerConsole(Logging.LEVEL_DEBUG)
    log = logger.logging()
    log.info("Application started")
    log.error("Something went wrong")

## Key Classes

Class | Purpose | Example
--- | --- | ---
`Definitions` | Register custom types | `defs = Definitions()`
`NameSpace` | Group types by namespace | `ns = NameSpace(uuid, "App")`
`Path` | Navigate nested data | `Path.from_field("x").field("y")`
`Logging` | Debug output | `logger.logging().info(msg)`
`Error` | Parse error messages | `Error.parse(str(e))`

## Definitions

`dsviper.Definitions` | A class used to register concept, club, enumeration, structure and attachment.
`dsviper.DefinitionsConst` | A class used to retreive registered concepts, clubs, enumerations, structures and attachments.
`dsviper.DefinitionsCollector` | A class used to collect referenced types.
`dsviper.DefinitionsInspector` | DefinitionsInspector(definitions).
`dsviper.DefinitionsMapper` | A class use for INTERNAL DEVELOPMENT.
`dsviper.DefinitionsExtendInfo` | A class used to represent the types exchanged during the synchronization of two databases.

## Namespace

`dsviper.NameSpace` | A class used to describe a namespace.

## Paths

`dsviper.Path` | A class used to construct the location of a portion of a value.
`dsviper.PathConst` | A class used to retreive a value from a Path.
`dsviper.PathComponent` | A class used to represent a component of a Path.
`dsviper.PathElementInfo` | A class used to represent the various information for an element of a set.
`dsviper.PathEntryKeyInfo` | A class used to represent various information for an entry of a map.

## Function Pools

`dsviper.Function` | A class used to call a C++ function.
`dsviper.FunctionPool` | A class used to register and retreive C++ functions.
`dsviper.FunctionPoolFunctions` | A class used to represent the functions of a pool.
`dsviper.FunctionPrototype` | A class used to represent the prototype of a function.

## Hashing

`dsviper.Hashing` | An interface to abstract a hasher.
`dsviper.HashCRC32` | A class used to hash data with CRC32.
`dsviper.HashMD5` | A class used to hash data with MD5.
`dsviper.HashSHA1` | A class used to hash data with SHA1.
`dsviper.HashSHA256` | A class used to hash data with SHA256.
`dsviper.HashSHA3` | A class used to hash a data with SHA3.

## Logging

`dsviper.Logging` | An interface to emit a message.
`dsviper.LoggerConsole` | A class used to display a message on the console.
`dsviper.LoggerPrint` | A class used to display a message on the Python stdout.
`dsviper.LoggerReport` | A class used to collect messages.
`dsviper.LoggerNull` | A class used to discard messages.

## Remote Services

`dsviper.ServiceRemote` | A class used to connect to a remote service.
`dsviper.ServiceRemoteFunction` | A class used to call a remote function.
`dsviper.ServiceRemoteFunctionPool` | A class used to represent a remote function pool.
`dsviper.ServiceRemoteFunctionPoolFunction` | A class used to represent a remote function.
`dsviper.ServiceRemoteFunctionPoolFunctions` | A class used to represent the functions of a pool.
`dsviper.ServiceRemoteFunctionPools` | A class used to represent the remote function pools.
`dsviper.ServiceRemoteAttachmentFunction` | A class used to call a remote attachment function.
`dsviper.ServiceRemoteAttachmentFunctionPool` | A class used to represent a remote attachment function pool.
`dsviper.ServiceRemoteAttachmentFunctionPoolFunction` | A class used to represent a remote attachment function.
`dsviper.ServiceRemoteAttachmentFunctionPoolFunctions` | A class used to represent the remote attachment functions.
`dsviper.ServiceRemoteAttachmentFunctionPools` | A class used to represent the remote attachment pools.

## Utilities

`dsviper.ViperError` |
`dsviper.Error` | A class used to represent an error raised by Viper.
`dsviper.Cancelation` | A class used to request a cancelation.
`dsviper.Semaphore` | A class used to represent a semaphore.
`dsviper.SharedMemory` | A class used to represent a shared memory region.
`dsviper.Socket` | A class used to represent a shared memory region.
`dsviper.Float16` | A class used to handle float16 representation.
`dsviper.Fuzzer` | A class used to generate a random value.
`dsviper.KeyHelper` | A class used to collect keys, attachments and missing attachments for a key.
`dsviper.KeyNamer` | A class used to get a name for a key from available attachments.