~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

« back to all changes in this revision

Viewing changes to sql/spatial.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 22:33:55 UTC
  • mto: (1.2.1) (37.1.1 lucid-security)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: package-import@ubuntu.com-20120222223355-ku1tb4r70osci6v2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2002-2006 MySQL AB
 
1
/*
 
2
   Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
   This program is free software; you can redistribute it and/or modify
4
5
   it under the terms of the GNU General Public License as published by
11
12
 
12
13
   You should have received a copy of the GNU General Public License
13
14
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
#ifndef _spatial_h
17
19
#define _spatial_h
225
227
  {
226
228
    wkb_xdr= 0,    /* Big Endian */
227
229
    wkb_ndr= 1     /* Little Endian */
228
 
  };                                    
 
230
  };
 
231
 
 
232
  /** Callback which creates Geometry objects on top of a given placement. */
 
233
  typedef Geometry *(*create_geom_t)(char *);
229
234
 
230
235
  class Class_info
231
236
  {
232
237
  public:
233
238
    LEX_STRING m_name;
234
239
    int m_type_id;
235
 
    void (*m_create_func)(void *);
236
 
    Class_info(const char *name, int type_id, void(*create_func)(void *));
 
240
    create_geom_t m_create_func;
 
241
    Class_info(const char *name, int type_id, create_geom_t create_func);
237
242
  };
238
243
 
239
244
  virtual const Class_info *get_class_info() const=0;
263
268
  virtual int geometry_n(uint32 num, String *result) const { return -1; }
264
269
 
265
270
public:
266
 
  static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id)
267
 
  {
268
 
    Class_info *ci;
269
 
    if (!(ci= find_class((int) type_id)))
270
 
      return NULL;
271
 
    (*ci->m_create_func)((void *)buffer);
272
 
    return my_reinterpret_cast(Geometry *)(buffer);
273
 
  }
274
 
 
 
271
  static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id);
275
272
  static Geometry *construct(Geometry_buffer *buffer,
276
273
                             const char *data, uint32 data_len);
277
274
  static Geometry *create_from_wkt(Geometry_buffer *buffer,
528
525
  const Class_info *get_class_info() const;
529
526
};
530
527
 
531
 
const int geometry_buffer_size= sizeof(Gis_point);
532
 
struct Geometry_buffer
533
 
{
534
 
  void *arr[(geometry_buffer_size - 1)/sizeof(void *) + 1];
535
 
};
 
528
struct Geometry_buffer : public
 
529
  my_aligned_storage<sizeof(Gis_point), MY_ALIGNOF(Gis_point)> {};
536
530
 
537
531
#endif /*HAVE_SPATAIAL*/
538
532
#endif