diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/ruby/free_function/example.h | |
download | swig-tarball-master.tar.gz |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/ruby/free_function/example.h')
-rw-r--r-- | Examples/ruby/free_function/example.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Examples/ruby/free_function/example.h b/Examples/ruby/free_function/example.h new file mode 100644 index 0000000..933bb36 --- /dev/null +++ b/Examples/ruby/free_function/example.h @@ -0,0 +1,49 @@ +#ifndef _EXAMPLE_H_ +#define _EXAMPLE_H_ + +#include <vector> +#include <string> + +class Animal +{ +protected: + std::string name_; +public: + // Construct an animal with a name + Animal(const char* name); + + // Destruct an animal + ~Animal(); + + // Return the animal's name + const char* get_name() const; +}; + +class Zoo +{ +private: + typedef std::vector<Animal*> AnimalsType; + typedef AnimalsType::iterator IterType; +protected: + AnimalsType animals; +public: + Zoo(); + ~Zoo(); + + /* Create a new animal */ + static Animal* create_animal(const char* name); + + /* Add a new animal to the zoo */ + void add_animal(Animal* animal); + + /* Remove an animal from the zoo */ + Animal* remove_animal(size_t i); + + /* Return the number of animals in the zoo */ + size_t get_num_animals() const; + + /* Return a pointer to the ith animal */ + Animal* get_animal(size_t i) const; +}; + +#endif /*_EXAMPLE_H_*/ |