ObjectName-1.0.1.0: Explicitly handled object names

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

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 :: a -> IO Bool
  - deleteObjectName :: a -> IO ()
  - deleteObjectNames :: [a] -> IO ()
- class ObjectName a => GeneratableObjectName a where
  - genObjectName :: IO a
  - genObjectNames :: Int -> IO [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 :: a -> IO 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 :: a -> IO ()

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

deleteObjectNames :: [a] -> IO ()

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 :: IO a

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

genObjectNames :: Int -> IO [a]

Bulk version of `genObjectName`.