HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfContext.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef INCLUDED_IMF_CONTEXT_H
7 #define INCLUDED_IMF_CONTEXT_H
8 
9 #include "ImfContextInit.h"
10 
11 #include "ImfHeader.h"
12 
13 #include <memory>
14 
16 
17 /// \brief Context provides a wrapper around the Core library context
18 /// object
19 ///
20 /// This is the main vehicle by which the core library provides
21 /// concurrent behavior, avoiding globals, and allowing each part of
22 /// any application to use its own custom allocators or any other
23 /// feature they prefer.
24 ///
25 /// The context is logically comprised of referencing a file plus the
26 /// additional helper utilities needed for doing so, and so should be
27 /// the main entrypoint for querying any of the metadata for all the
28 /// component parts of the file, along with the global header
29 /// information.
31 {
32 public:
33  struct read_mode_t { explicit read_mode_t() = default; };
34  struct temp_mode_t { explicit temp_mode_t() = default; };
35  struct write_mode_t { explicit write_mode_t() = default; };
36 
37  Context ();
38 
39  Context (const char* filename,
40  const ContextInitializer& ctxtinit,
41  read_mode_t t);
42 
43  Context (const char* filename,
44  const ContextInitializer& ctxtinit,
45  temp_mode_t t);
46 
47  Context (const char* filename,
48  const ContextInitializer& ctxtinit,
49  write_mode_t t);
50 
51  operator exr_context_t () const noexcept { return *(_ctxt); }
52 
53  IMF_EXPORT void setLongNameSupport (bool onoff);
54 
55  // generic file values
56 
57  IMF_EXPORT const char* fileName () const;
58 
59  IMF_EXPORT int version () const;
60 
61  IMF_EXPORT int partCount () const;
62 
63  IMF_EXPORT exr_storage_t storage (int partidx) const;
64 
65  // access to commonly used attributes
66 
67  IMF_EXPORT exr_attr_box2i_t dataWindow (int partidx) const;
68 
69  IMF_EXPORT const exr_attr_chlist_t* channels (int partidx) const;
70  IMF_EXPORT bool hasChannel (int partidx, const char* name) const;
71  IMF_EXPORT const exr_attr_chlist_entry_t* findChannel (int partidx, const char* name) const;
72 
73  IMF_EXPORT exr_lineorder_t lineOrder (int partidx) const;
74 
75  // access to generic attributes
76 
77  IMF_EXPORT int attrCount (int partidx) const;
78 
79  IMF_EXPORT const exr_attribute_t* getAttr (int partidx, int attridx) const;
81  getAttr (int partidx, const char* name) const;
82 
83  // C++ header interface support
84 
85  IMF_EXPORT Header header (int partnum) const;
86  IMF_EXPORT void addHeader (int partnum, const Header &h);
87 
88  // validation and things
89 
90  IMF_EXPORT bool chunkTableValid (int partidx) const;
91 
92 private:
93  std::shared_ptr<exr_context_t> _ctxt;
94 }; // class Context
95 
97 
98 #endif // INCLUDED_IMF_CONTEXT_H
GT_API const UT_StringHolder filename
Struct to hold an integer box/region definition.
Definition: openexr_attr.h:223
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
ContextInitializer provides a basic type to initialize a Context with.
exr_lineorder_t
Definition: openexr_attr.h:60
class OCIOEXPORT Context
struct _priv_exr_context_t * exr_context_t
#define IMF_EXPORT
Definition: ImfExport.h:54
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble t
Definition: glad.h:2397
GT_API const UT_StringHolder version
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
exr_storage_t
Definition: openexr_attr.h:69
Storage, name and type information for an attribute.
Definition: openexr_attr.h:439
Context provides a wrapper around the Core library context object.
Definition: ImfContext.h:30
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:80
#define IMF_EXPORT_TYPE
Definition: ImfExport.h:57
Definition: openexr_attr.h:306
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)