ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
humung.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 // file fvar.cpp
12 // constructors, destructors and misc functions involving class prevariable
13 #include "fvar.hpp"
14 
15 #if defined(__ZTC__)
16 // void _far * _cdecl _farptr_norm(void _far *);
17  void _far * _cdecl _farptr_fromlong(unsigned long);
18  long _cdecl _farptr_tolong(void _far *);
19 #endif
20 
25  adjustment(0),
26  ptr(NULL)
27 {
28 }
29 
35 {
36  ptr -= adjustment;
37  adjustment = 0;
38 #if defined(__BORLANDC__) || defined(__ZTC__)
39  farfree(ptr);
40 #else
41  ::free(ptr);
42 #endif
43  ptr = NULL;
44 }
45 
50 void humungous_pointer::adjust(const size_t a)
51 {
52  adjustment = a;
53  ptr += adjustment;
54 }
55 
61 {
62  return (ptr==p);
63 }
64 
70 {
71  return (ptr!=p);
72 }
73 
78 humungous_pointer::operator char* ()
79 {
80  return ptr;
81 }
82 
87 humungous_pointer::operator void* ()
88 {
89  return (void*)ptr;
90 }
91 
96 humungous_pointer::operator double_and_int* ()
97 {
98  return (double_and_int*)ptr;
99 }
100 
105 humungous_pointer::operator double* ()
106 {
107  return (double*)ptr;
108 }
109 
114 {
115  humungous_pointer tmp;
116 #if defined(__ZTC__)
117  tmp.ptr=(char*)(_farptr_fromlong(_farptr_tolong(ptr)+offset));
118 #else
119  tmp.ptr=(ptr+offset);
120 #endif
121  return tmp;
122 }
123 
128 {
129 #if defined(__ZTC__)
130  ptr=(char*)(_farptr_fromlong(_farptr_tolong(ptr)+offset));
131 #else
132  ptr=(ptr+offset);
133 #endif
134  return *this;
135 }
136 
142 {
143 #if defined(__BORLANDC__)
144  ptr = (char huge *) p;
145 #else
146  ptr = (char*) p;
147 #endif
148  return *this;
149 }
int operator==(void *p)
Description not yet available.
Definition: humung.cpp:60
humungous_pointer & operator=(void *p)
Description not yet available.
Definition: humung.cpp:141
Holds the data for the prevariable class.
Definition: fvar.hpp:191
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
humungous_pointer operator+(unsigned long int &offset)
Note that pointer addition is in bytes not the size of the object pointed to.
Definition: humung.cpp:113
void adjust(const size_t)
Description not yet available.
Definition: humung.cpp:50
humungous_pointer & operator+=(unsigned long int &offset)
Note that pointer addition is in bytes not the size of the object pointed to.
Definition: humung.cpp:127
int operator!=(void *p)
Description not yet available.
Definition: humung.cpp:69
humungous_pointer()
Default constructor.
Definition: humung.cpp:24
void free()
Description not yet available.
Definition: humung.cpp:34
Description not yet available.