Veil
veil_datatypes.c
Go to the documentation of this file.
1 /**
2  * @file veil_datatypes.c
3  * \code
4  * Author: Marc Munro
5  * Copyright (c) 2005 - 2011 Marc Munro
6  * License: BSD
7  *
8  * \endcode
9  * @brief
10  * Code for non-bitmap datatypes.
11  *
12  */
13 
14 #include "postgres.h"
15 #include "veil_datatypes.h"
16 #include "veil_funcs.h"
17 
18 
19 /**
20  * Create a new session or shared ::Range object.
21  *
22  * @param shared Whether the object is to be created in shared (true) or
23  * session (false) memory.
24  *
25  * @return Pointer to newly created object.
26  */
27 Range *
28 vl_NewRange(bool shared)
29 {
30  Range *range;
31 
32  if (shared) {
33  range = vl_shmalloc(sizeof(Range));
34  }
35  else {
36  range = vl_malloc(sizeof(Range));
37  }
38 
39  range->type = OBJ_RANGE;
40  return range;
41 }
42 
43 /**
44  * Create a new session or shared ::Int4Var object.
45  *
46  * @param shared Whether the object is to be created in shared (true) or
47  * session (false) memory.
48  *
49  * @return Pointer to newly created object.
50  */
51 Int4Var *
52 vl_NewInt4(bool shared)
53 {
54  Int4Var *i4v;
55 
56  if (shared) {
57  i4v = vl_shmalloc(sizeof(Int4Var));
58  }
59  else {
60  i4v = vl_malloc(sizeof(Int4Var));
61  }
62  i4v->type = OBJ_INT4;
63  i4v->isnull = true;
64  return i4v;
65 }
66 
Subtype of Object for storing simple int4 values.
ObjType type
This must have the value OBJ_RANGE.
Provide definitions for all non-local C-callable Veil functions.
Subtype of Object for storing range values.
void * vl_shmalloc(size_t size)
Dynamically allocate a piece of shared memory from the current context.
Definition: veil_shmem.c:414
void * vl_malloc(size_t size)
Dynamically allocate memory using palloc in TopMemoryContext.
Definition: veil_utils.c:28
Int4Var * vl_NewInt4(bool shared)
Create a new session or shared Int4Var object.
ObjType type
This must have the value OBJ_INT4.
bool isnull
if true, the value is null
Range * vl_NewRange(bool shared)
Create a new session or shared Range object.
Define all Veil public datatypes.