binding/v8/jsi/dataaccess/Index.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 Index.cpp
22 
23  \brief Utility functions to register the Index class into the Google JavaScript V8 engine.
24  */
25 
26 // TerraLib
27 #include "../../../../dataaccess/dataset/Index.h"
28 #include "../../common/Utils.h"
29 #include "DataAccess.h"
30 
31 // Boost
32 #include <boost/cstdint.hpp>
33 
34 ::v8::Handle<::v8::Value> Index_GetId(const ::v8::Arguments& args)
35 {
36  return ::v8::Undefined();
37 }
38 
39 ::v8::Handle<::v8::Value> Index_SetId(const ::v8::Arguments& args)
40 {
41  return ::v8::Undefined();
42 }
43 
44 ::v8::Handle<::v8::Value> Index_GetName(const ::v8::Arguments& args)
45 {
46  return ::v8::Undefined();
47 }
48 
49 ::v8::Handle<::v8::Value> Index_SetName(const ::v8::Arguments& args)
50 {
51  return ::v8::Undefined();
52 }
53 
54 ::v8::Handle<::v8::Value> Index_GetIndexType(const ::v8::Arguments& args)
55 {
56  return ::v8::Undefined();
57 }
58 
59 ::v8::Handle<::v8::Value> Index_SetIndexType(const ::v8::Arguments& args)
60 {
61  return ::v8::Undefined();
62 }
63 
64 ::v8::Handle<::v8::Value> Index_GetProperties(const ::v8::Arguments& args)
65 {
66  return ::v8::Undefined();
67 }
68 
69 ::v8::Handle<::v8::Value> Index_SetProperties(const ::v8::Arguments& args)
70 {
71  return ::v8::Undefined();
72 }
73 
74 ::v8::Handle<::v8::Value> Index_Add(const ::v8::Arguments& args)
75 {
76  return ::v8::Undefined();
77 }
78 
79 ::v8::Handle<::v8::Value> Index_GetDataSetType(const ::v8::Arguments& args)
80 {
81  return ::v8::Undefined();
82 }
83 
84 ::v8::Handle<::v8::Value> Index_SetDataSetType(const ::v8::Arguments& args)
85 {
86  return ::v8::Undefined();
87 }
88 
89 
90 ::v8::Handle<::v8::Value> Index_Has(const ::v8::Arguments& args)
91 {
92  return ::v8::Undefined();
93 }
94 
95 ::v8::Handle<::v8::Value> Index_Replace(const ::v8::Arguments& args)
96 {
97  return ::v8::Undefined();
98 }
99 
100 ::v8::Handle<::v8::Value> Index_Constructor(const ::v8::Arguments& args)
101 {
102  //::v8::HandleScope hs;
103 
104  //if(!args.IsConstructCall())
105  // return ::v8::ThrowException(::v8::String::New("In order to create a check constraint, you need to call its constructor like: var c = new TeIndex(dt, id);"));
106 
107  //if(args.Holder().IsEmpty())
108  // return ::v8::ThrowException(::v8::String::New("The Index constructor must use object notation!"));
109 
110  //if(args.Length() != 0)
111  // return ::v8::ThrowException(::v8::String::New("The Index constructor has no parameters!"));
112 
113  //std::auto_ptr<te::da::Index> catalog(new te::da::Index());
114 
115  //::v8::Local<::v8::Object> jcatalog = te::v8::common::Make(catalog.get(), te::v8::jsi::GetIndexTemplate, true);
116 
117  //catalog.release();
118 
119  //return hs.Close(jcatalog);
120 
121  return ::v8::Undefined();
122 }
123 
124 void te::v8::jsi::RegisterIndex(::v8::Local<::v8::Object>& global)
125 {
126  ::v8::Local<::v8::FunctionTemplate> jindex = ::v8::FunctionTemplate::New(Index_Constructor);
127 
128  global->Set(::v8::String::New("TeIndex"), jindex->GetFunction());
129 }
130 
131 static ::v8::Persistent<::v8::FunctionTemplate> sdset_index_template;
132 
133 ::v8::Persistent<::v8::FunctionTemplate>& te::v8::jsi::GetIndexTemplate()
134 {
135  if(sdset_index_template.IsEmpty())
136  {
137  ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
138  ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
139 
140  prototype->Set(::v8::String::NewSymbol("getId"), ::v8::FunctionTemplate::New(Index_GetId));
141  prototype->Set(::v8::String::NewSymbol("setId"), ::v8::FunctionTemplate::New(Index_SetId));
142  prototype->Set(::v8::String::NewSymbol("getName"), ::v8::FunctionTemplate::New(Index_GetName));
143  prototype->Set(::v8::String::NewSymbol("setName"), ::v8::FunctionTemplate::New(Index_SetName));
144  prototype->Set(::v8::String::NewSymbol("getIndexType"), ::v8::FunctionTemplate::New(Index_GetIndexType));
145  prototype->Set(::v8::String::NewSymbol("setIndexType"), ::v8::FunctionTemplate::New(Index_SetIndexType));
146  prototype->Set(::v8::String::NewSymbol("getProperties"), ::v8::FunctionTemplate::New(Index_GetProperties));
147  prototype->Set(::v8::String::NewSymbol("setProperties"), ::v8::FunctionTemplate::New(Index_SetProperties));
148  prototype->Set(::v8::String::NewSymbol("add"), ::v8::FunctionTemplate::New(Index_Add));
149  prototype->Set(::v8::String::NewSymbol("getDataSetType"), ::v8::FunctionTemplate::New(Index_GetDataSetType));
150  prototype->Set(::v8::String::NewSymbol("setDataSetType"), ::v8::FunctionTemplate::New(Index_SetDataSetType));
151  prototype->Set(::v8::String::NewSymbol("has"), ::v8::FunctionTemplate::New(Index_Has));
152  prototype->Set(::v8::String::NewSymbol("replace"), ::v8::FunctionTemplate::New(Index_Replace));
153 
154  sdset_index_template = ::v8::Persistent<::v8::FunctionTemplate>::New(result);
155  }
156 
157  return sdset_index_template;
158 }
::v8::Handle<::v8::Value > Index_Add(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_Constructor(const ::v8::Arguments &args)
JavaScript exporting routine for the TerraLib Data Access module.
void RegisterIndex(::v8::Local<::v8::Object > &global)
It registers the Index class.
::v8::Handle<::v8::Value > Index_Replace(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_SetName(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_GetName(const ::v8::Arguments &args)
static::v8::Persistent<::v8::FunctionTemplate > sdset_index_template
::v8::Handle<::v8::Value > Index_GetId(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_SetDataSetType(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_GetProperties(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_GetDataSetType(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_SetIndexType(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_GetIndexType(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_SetId(const ::v8::Arguments &args)
::v8::Persistent<::v8::FunctionTemplate > & GetIndexTemplate()
It returns a reference to the persistent template of a Index object.
::v8::Handle<::v8::Value > Index_Has(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > Index_SetProperties(const ::v8::Arguments &args)