PDI 1.8.0-alpha.2024-08-11

the PDI data interface

data_descriptor.h
1/*******************************************************************************
2 * Copyright (C) 2015-2024 Commissariat a l'energie atomique et aux energies alternatives (CEA)
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of CEA nor the names of its contributors may be used to
13 * endorse or promote products derived from this software without specific
14 * prior written permission.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 ******************************************************************************/
24
25#ifndef PDI_DATA_DESCRIPTOR_H_
26#define PDI_DATA_DESCRIPTOR_H_
27
28#include <string>
29
30#include <paraconf.h>
31
32#include <pdi/pdi_fwd.h>
33#include <pdi/datatype_template.h>
34#include <pdi/ref_any.h>
35
36namespace PDI {
37
38class PDI_EXPORT Data_descriptor
39{
40public:
42
48 virtual void default_type(Datatype_template_sptr type) = 0;
49
56
59 virtual bool metadata() const = 0;
60
65 virtual void metadata(bool metadata) = 0;
66
69 virtual const std::string& name() const = 0;
70
73 virtual Ref ref() = 0;
74
79 virtual bool empty() = 0;
80
86 virtual void share(void* data, bool read, bool write) = 0;
87
94 virtual void* share(Ref ref, bool read, bool write) = 0;
95
99 virtual void release() = 0;
100
105 virtual void* reclaim() = 0;
106
107}; // class Data_descriptor
108
109} // namespace PDI
110
111#endif // PDI_DATA_DESCRIPTOR_H_
Definition: data_descriptor.h:39
virtual Datatype_template_sptr default_type()=0
Access the datatype template used to type raw pointers shared through this descriptor.
virtual bool metadata() const =0
Return true if the data is a metadata.
virtual const std::string & name() const =0
Access the name of the descriptor.
virtual void metadata(bool metadata)=0
Sets whether this describes a metadata or not.
virtual void * reclaim()=0
Reclaims ownership of a data buffer shared with PDI.
virtual void * share(Ref ref, bool read, bool write)=0
Shares some data with PDI.
virtual Ref ref()=0
Return a reference to the value of the data behind this descriptor.
virtual void share(void *data, bool read, bool write)=0
Shares some data with PDI.
virtual void release()=0
Releases ownership of a data shared with PDI.
virtual ~Data_descriptor()
virtual bool empty()=0
Checks whether this descriptor is empty (contains no reference)
virtual void default_type(Datatype_template_sptr type)=0
Set the datatype template used to type raw pointers shared through this descriptor.
A dynamically typed reference to data with automatic memory management and read/write locking semanti...
Definition: ref_any.h:248
Definition: array_datatype.h:38
std::shared_ptr< const Datatype_template > Datatype_template_sptr
Definition: pdi_fwd.h:77