Last change
on this file since 1311 was
549,
checked in by Maciej Komosinski, 8 years ago
|
More correct use of PreconfiguredGenetics?: avoid static objects, create after logger is configured (so warnings can be printed)
|
-
Property svn:eol-style set to
native
|
File size:
862 bytes
|
Rev | Line | |
---|
[286] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
| 2 | // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. |
---|
| 3 | // See LICENSE.txt for details. |
---|
[109] | 4 | |
---|
[382] | 5 | #include <common/virtfile/stdiofile.h> |
---|
[109] | 6 | #include <frams/util/sstringutils.h> |
---|
[145] | 7 | #include <frams/genetics/preconfigured.h> |
---|
[391] | 8 | #include <common/loggers/loggertostdout.h> |
---|
[109] | 9 | |
---|
| 10 | /** |
---|
| 11 | @file |
---|
| 12 | Sample code: Testing genotype validity |
---|
| 13 | |
---|
| 14 | \include geno_test.cpp |
---|
[360] | 15 | */ |
---|
[109] | 16 | |
---|
[360] | 17 | int main(int argc, char*argv[]) |
---|
[109] | 18 | { |
---|
[549] | 19 | LoggerToStdout messages_to_stdout(LoggerBase::Enable); //comment this object out to mute error/warning messages |
---|
[360] | 20 | PreconfiguredGenetics genetics; |
---|
[145] | 21 | |
---|
[360] | 22 | if (argc <= 1) |
---|
[109] | 23 | { |
---|
[360] | 24 | puts("no genotype"); |
---|
| 25 | return 10; |
---|
[109] | 26 | } |
---|
[360] | 27 | SString gen(argv[1]); |
---|
| 28 | if (!strcmp(gen.c_str(), "-")) |
---|
[109] | 29 | { |
---|
[360] | 30 | gen = 0; |
---|
| 31 | StdioFILEDontClose in(stdin); |
---|
| 32 | loadSString(&in, gen); |
---|
[109] | 33 | } |
---|
[360] | 34 | Geno g(gen); |
---|
| 35 | puts(g.isValid() ? "valid" : "invalid"); |
---|
| 36 | return !g.isValid(); |
---|
[109] | 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.