src/terralib/binding/v8/jsi/dataaccess/Sequence.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file Sequence.cpp
22 
23  \brief Utility functions to register the Sequence class into the Google JavaScript V8 engine.
24  */
25 
26 // TerraLib
27 #include "../../../../dataaccess/dataset/Sequence.h"
28 #include "../../common/Utils.h"
29 #include "DataAccess.h"
30 
31 // Boost
32 #include <boost/cstdint.hpp>
33 
34 ::v8::Handle<::v8::Value> Sequence_GetId(const ::v8::Arguments& args)
35 {
36  return ::v8::Undefined();
37 }
38 
39 ::v8::Handle<::v8::Value> Sequence_SetId(const ::v8::Arguments& args)
40 {
41  return ::v8::Undefined();
42 }
43 
44 ::v8::Handle<::v8::Value> Sequence_GetName(const ::v8::Arguments& args)
45 {
46  return ::v8::Undefined();
47 }
48 
49 ::v8::Handle<::v8::Value> Sequence_SetName(const ::v8::Arguments& args)
50 {
51  return ::v8::Undefined();
52 }
53 
54 ::v8::Handle<::v8::Value> Sequence_GetIncrement(const ::v8::Arguments& args)
55 {
56  return ::v8::Undefined();
57 }
58 
59 ::v8::Handle<::v8::Value> Sequence_SetIncrement(const ::v8::Arguments& args)
60 {
61  return ::v8::Undefined();
62 }
63 
64 ::v8::Handle<::v8::Value> Sequence_GetMinValue(const ::v8::Arguments& args)
65 {
66  return ::v8::Undefined();
67 }
68 
69 ::v8::Handle<::v8::Value> Sequence_SetMinvalue(const ::v8::Arguments& args)
70 {
71  return ::v8::Undefined();
72 }
73 
74 ::v8::Handle<::v8::Value> Sequence_GetMaxValue(const ::v8::Arguments& args)
75 {
76  return ::v8::Undefined();
77 }
78 
79 ::v8::Handle<::v8::Value> Sequence_SetMaxValue(const ::v8::Arguments& args)
80 {
81  return ::v8::Undefined();
82 }
83 
84 ::v8::Handle<::v8::Value> Sequence_GetStartValue(const ::v8::Arguments& args)
85 {
86  return ::v8::Undefined();
87 }
88 
89 ::v8::Handle<::v8::Value> Sequence_SetStartValue(const ::v8::Arguments& args)
90 {
91  return ::v8::Undefined();
92 }
93 
94 ::v8::Handle<::v8::Value> Sequence_GetCachedValues(const ::v8::Arguments& args)
95 {
96  return ::v8::Undefined();
97 }
98 
99 ::v8::Handle<::v8::Value> Sequence_SetCachedValues(const ::v8::Arguments& args)
100 {
101  return ::v8::Undefined();
102 }
103 
104 ::v8::Handle<::v8::Value> Sequence_IsCycled(const ::v8::Arguments& args)
105 {
106  return ::v8::Undefined();
107 }
108 
109 ::v8::Handle<::v8::Value> Sequence_SetAsNoCycle(const ::v8::Arguments& args)
110 {
111  return ::v8::Undefined();
112 }
113 
114 ::v8::Handle<::v8::Value> Sequence_GetOwner(const ::v8::Arguments& args)
115 {
116  return ::v8::Undefined();
117 }
118 
119 ::v8::Handle<::v8::Value> Sequence_SetOwner(const ::v8::Arguments& args)
120 {
121  return ::v8::Undefined();
122 }
123 
124 ::v8::Handle<::v8::Value> Sequence_GetCatalog(const ::v8::Arguments& args)
125 {
126  return ::v8::Undefined();
127 }
128 
129 ::v8::Handle<::v8::Value> Sequence_SetCatalog(const ::v8::Arguments& args)
130 {
131  return ::v8::Undefined();
132 }
133 
134 ::v8::Handle<::v8::Value> Sequence_Constructor(const ::v8::Arguments& args)
135 {
136  //::v8::HandleScope hs;
137 
138  //if(!args.IsConstructCall())
139  // return ::v8::ThrowException(::v8::String::New("In order to create a check constraint, you need to call its constructor like: var c = new TeSequence(dt, id);"));
140 
141  //if(args.Holder().IsEmpty())
142  // return ::v8::ThrowException(::v8::String::New("The Sequence constructor must use object notation!"));
143 
144  //if(args.Length() != 0)
145  // return ::v8::ThrowException(::v8::String::New("The Sequence constructor has no parameters!"));
146 
147  //std::auto_ptr<te::da::Sequence> catalog(new te::da::Sequence());
148 
149  //::v8::Local<::v8::Object> jcatalog = te::v8::common::Make(catalog.get(), te::v8::jsi::GetSequenceTemplate, true);
150 
151  //catalog.release();
152 
153  //return hs.Close(jcatalog);
154 
155  return ::v8::Undefined();
156 }
157 
158 void te::v8::jsi::RegisterSequence(::v8::Local<::v8::Object>& global)
159 {
160  ::v8::Local<::v8::FunctionTemplate> jsequence = ::v8::FunctionTemplate::New(Sequence_Constructor);
161 
162  global->Set(::v8::String::New("TeSequence"), jsequence->GetFunction());
163 }
164 
165 static ::v8::Persistent<::v8::FunctionTemplate> sdset_sequence_template;
166 
167 ::v8::Persistent<::v8::FunctionTemplate>& te::v8::jsi::GetSequenceTemplate()
168 {
169  if(sdset_sequence_template.IsEmpty())
170  {
171  ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
172  ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
173 
174  prototype->Set(::v8::String::NewSymbol("getId"), ::v8::FunctionTemplate::New(Sequence_GetId));
175  prototype->Set(::v8::String::NewSymbol("setId"), ::v8::FunctionTemplate::New(Sequence_SetId));
176  prototype->Set(::v8::String::NewSymbol("getName"), ::v8::FunctionTemplate::New(Sequence_GetName));
177  prototype->Set(::v8::String::NewSymbol("setName"), ::v8::FunctionTemplate::New(Sequence_SetName));
178  prototype->Set(::v8::String::NewSymbol("getIncrement"), ::v8::FunctionTemplate::New(Sequence_GetIncrement));
179  prototype->Set(::v8::String::NewSymbol("setIncrement"), ::v8::FunctionTemplate::New(Sequence_SetIncrement));
180  prototype->Set(::v8::String::NewSymbol("getMinValue"), ::v8::FunctionTemplate::New(Sequence_GetMinValue));
181  prototype->Set(::v8::String::NewSymbol("setMinValue"), ::v8::FunctionTemplate::New(Sequence_SetMinvalue));
182  prototype->Set(::v8::String::NewSymbol("getMaxValue"), ::v8::FunctionTemplate::New(Sequence_GetMaxValue));
183  prototype->Set(::v8::String::NewSymbol("setMaxValue"), ::v8::FunctionTemplate::New(Sequence_SetMaxValue));
184  prototype->Set(::v8::String::NewSymbol("getStartValue"), ::v8::FunctionTemplate::New(Sequence_GetStartValue));
185  prototype->Set(::v8::String::NewSymbol("setStartValue"), ::v8::FunctionTemplate::New(Sequence_SetStartValue));
186  prototype->Set(::v8::String::NewSymbol("getCachedValues"), ::v8::FunctionTemplate::New(Sequence_GetCachedValues));
187  prototype->Set(::v8::String::NewSymbol("setCachedValues"), ::v8::FunctionTemplate::New(Sequence_SetCachedValues));
188  prototype->Set(::v8::String::NewSymbol("isCycled"), ::v8::FunctionTemplate::New(Sequence_IsCycled));
189  prototype->Set(::v8::String::NewSymbol("setAsNoCycle"), ::v8::FunctionTemplate::New(Sequence_SetAsNoCycle));
190  prototype->Set(::v8::String::NewSymbol("getOwner"), ::v8::FunctionTemplate::New(Sequence_GetOwner));
191  prototype->Set(::v8::String::NewSymbol("setOwner"), ::v8::FunctionTemplate::New(Sequence_SetOwner));
192  prototype->Set(::v8::String::NewSymbol("getCatalog"), ::v8::FunctionTemplate::New(Sequence_GetCatalog));
193  prototype->Set(::v8::String::NewSymbol("setCatalog"), ::v8::FunctionTemplate::New(Sequence_SetCatalog));
194 
195  sdset_sequence_template = ::v8::Persistent<::v8::FunctionTemplate>::New(result);
196  }
197 
199 }
::v8::Handle<::v8::Value > Sequence_SetId(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetOwner(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_SetOwner(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetCachedValues(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetStartValue(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_SetMinvalue(const ::v8::Arguments &args)
JavaScript exporting routine for the TerraLib Data Access module.
::v8::Handle<::v8::Value > Sequence_SetName(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetMaxValue(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetId(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetMinValue(const ::v8::Arguments &args)
::v8::Persistent<::v8::FunctionTemplate > & GetSequenceTemplate()
It returns a reference to the persistent template of a Sequence object.
::v8::Handle<::v8::Value > Sequence_SetMaxValue(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetName(const ::v8::Arguments &args)
void RegisterSequence(::v8::Local<::v8::Object > &global)
It registers the Sequence class.
::v8::Handle<::v8::Value > Sequence_SetCatalog(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_SetStartValue(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_IsCycled(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_GetCatalog(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_Constructor(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_SetCachedValues(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_SetAsNoCycle(const ::v8::Arguments &args)
static::v8::Persistent<::v8::FunctionTemplate > sdset_sequence_template
::v8::Handle<::v8::Value > Sequence_GetIncrement(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Sequence_SetIncrement(const ::v8::Arguments &args)