My Project
dynamic_ids.h
00001 /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
00015 
00016 #ifndef DYNAMIC_ID_H
00017 
00018 #define DYNAMIC_ID_H
00019 
00020 #include <my_sys.h>
00021 #include <sql_string.h>
00022 
00023 class Dynamic_ids
00024 {
00025 public:
00026     DYNAMIC_ARRAY dynamic_ids;
00027 
00028     Dynamic_ids(size_t param_size);
00029     virtual ~Dynamic_ids();
00030 
00031     bool pack_dynamic_ids(String *buffer)
00032     {
00033       return(do_pack_dynamic_ids(buffer));
00034     }
00035 
00036     bool unpack_dynamic_ids(char *param_dynamic_ids)
00037     {
00038       return(do_unpack_dynamic_ids(param_dynamic_ids));
00039     }
00040 
00041     bool search_id(const void *id)
00042     {
00043       return (do_search_id(id));
00044     }
00045 
00046 protected:
00047     size_t size;
00048 
00049 private:
00050     virtual bool do_pack_dynamic_ids(String *buffer)= 0;
00051     virtual bool do_unpack_dynamic_ids(char *param_dynamic_ids)= 0;
00052     virtual bool do_search_id(const void *id)= 0;
00053 };
00054 
00055 class Server_ids : public Dynamic_ids
00056 {
00057 public:
00058     Server_ids(size_t size): Dynamic_ids(size) { };
00059     virtual ~Server_ids() { };
00060 
00061 private:
00062     bool do_pack_dynamic_ids(String *buffer);
00063     bool do_unpack_dynamic_ids(char *param_dynamic_ids);
00064     bool do_search_id(const void *id);
00065 };
00066 
00067 class Database_ids : public Dynamic_ids
00068 {
00069 public:
00070     Database_ids(size_t size): Dynamic_ids(size) { };
00071     virtual ~Database_ids() { };
00072 
00073 private:
00074     bool do_pack_dynamic_ids(String *buffer);
00075     bool do_unpack_dynamic_ids(char *param_dynamic_ids);
00076     bool do_search_id(const void *id);
00077 };
00078 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines