Data.ObjectName

ObjectName-1.1.0.0: Explicitly handled object names

Copyright | (c) Sven Panne 2015
License | BSD3
Maintainer | Sven Panne <svenpanne@gmail.com>
Stability | stable
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Data.ObjectName

Description

Object names are explicitly handled identifiers for API objects, e.g. a texture object name in OpenGL or a buffer object name in OpenAL. They come in two flavors: If a name can exist on its own without an associated object, we have a `GeneratableObjectName`, otherwise we have an `ObjectName`.

Synopsis

- class ObjectName a where
  - isObjectName :: MonadIO m => a -> m Bool
  - deleteObjectName :: MonadIO m => a -> m ()
  - deleteObjectNames :: MonadIO m => [a] -> m ()
- class ObjectName a => GeneratableObjectName a where
  - genObjectName :: MonadIO m => m a
  - genObjectNames :: MonadIO m => Int -> m [a]

# Documentation

class ObjectName a where

An `ObjectName` is an explicitly handled identifier for API objects, e.g. a texture object name in OpenGL or a buffer object name in OpenAL.

Minimal complete definition

isObjectName, (deleteObjectName | deleteObjectNames)

Methods

isObjectName :: MonadIO m => a -> m Bool

Test if the given object name is currently in use, i.e. test if it has been generated, but not been deleted so far.

deleteObjectName :: MonadIO m => a -> m ()

Make the given object name available again, declaring it as unused.

deleteObjectNames :: MonadIO m => [a] -> m ()

Bulk version of `deleteObjectName`.

class ObjectName a => GeneratableObjectName a where

A `GeneratableObjectName` is an `ObjectName` which can be generated without creating an associated object at the same time, e.g. an OpenGL buffer object name. Note that e.g. OpenGL program object names do not fall into this category, because you can only create such a name together with a program object itself.

Minimal complete definition

genObjectName | genObjectNames

Methods

genObjectName :: MonadIO m => m a

Generate a new unused object name. By generating the name, it becomes used.

genObjectNames :: MonadIO m => Int -> m [a]

Bulk version of `genObjectName`.