source: cpp/frams/_demos/genotypeloader.h @ 855

Last change on this file since 855 was 855, checked in by Maciej Komosinski, 5 years ago

Removed unused field

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#ifndef _GENOTYPELOADER_H_
6#define _GENOTYPELOADER_H_
7
8#include <frams/util/sstring.h>
9#include <frams/param/multiparamload.h>
10#include "genotypemini.h"
11
12/** In most simple cases this is the class you would use to load a series of genotypes from
13        the Framsticks genotype file.
14
15        Typical usage: (see loader_test_geno.cpp for the working code)
16        while(genotype=loader.loadNextGenotype()) doSomethingWith(genotype);
17
18        MiniGenotypeLoader is simply the MultiParamLoader configured to load one kind of data: "org:" objects.
19        The instance of this class can also be reconfigured to recognize more objects by using MultiParamLoader
20        methods, or you can use it as a guide for creating your own specialized class.
21        */
22class GenotypeMiniLoader : public MultiParamLoader
23{
24        GenotypeMini genotype_object;
25        Param genotype_param;
26        void init();
27public:
28        GenotypeMiniLoader();
29        GenotypeMiniLoader(VirtFILE *f);
30        GenotypeMiniLoader(const char* filename);
31
32        /** @returns genotype object if one was loaded or NULL otherwise.
33
34                Returned GenotypeMini pointer always references the the same object (GenotypeMiniLoader::genotype_object)
35                which means you may need to copy the data from it before calling loadNextGenotype() again.
36                In the default configuration (simple GenotypeMiniLoader) NULL is always final and should be used
37                to finish processing.
38
39                If the loader is configured to load other objects or stop on other conditions, NULL will also mean
40                every condition other than "GenotypeLoaded". In such cases you need MultiParamLoader::getStatus(),
41                MultiParamLoader::finished() and other methods to determine the real cause of NULL.
42                */
43        GenotypeMini* loadNextGenotype();
44};
45
46#endif
Note: See TracBrowser for help on using the repository browser.