From d0698157dcc074b8de7ae21790e07775defd6c11 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 12:10:45 +0000 Subject: [PATCH 01/63] A little simplification. --- .../tests/test_matlab/run_matlab_tests.py | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/generator/tests/test_matlab/run_matlab_tests.py b/generator/tests/test_matlab/run_matlab_tests.py index fd99ee58..226b18e0 100644 --- a/generator/tests/test_matlab/run_matlab_tests.py +++ b/generator/tests/test_matlab/run_matlab_tests.py @@ -16,6 +16,7 @@ # Set up variables fails = [] not_tested = [] +filetypes = ['sf', 'dv', 'vt'] ############################################################################## @@ -26,12 +27,9 @@ def generate_matlab_files(filename, name): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') - ml = BaseMatlabFile.BaseMatlabFile(name, ob, 'sf') - ml.write_file() - ml = BaseMatlabFile.BaseMatlabFile(name, ob, 'dv') - ml.write_file() - ml = BaseMatlabFile.BaseMatlabFile(name, ob, 'vt') - ml.write_file() + for type in filetypes: #['sf', 'dv', 'vt']: + ml = BaseMatlabFile.BaseMatlabFile(name, ob, type) + ml.write_file() os.chdir('../.') @@ -44,15 +42,10 @@ def compare_files(correct_file, temp_file): def compare_matlab(name, filetype): - if filetype == 'sf': - correct_file = '.\\test-matlab\\{0}sf.m'.format(name) - temp_file = '.\\temp\\{0}sf.m'.format(name) - elif filetype == 'dv': - correct_file = '.\\test-matlab\\{0}dv.m'.format(name) - temp_file = '.\\temp\\{0}dv.m'.format(name) - elif filetype == 'vt': - correct_file = '.\\test-matlab\\{0}vt.m'.format(name) - temp_file = '.\\temp\\{0}vt.m'.format(name) + + assert filetype in filetypes # ['sf', 'dv', 'vt'] + correct_file = '.\\test-matlab\\{0}{1}.m'.format(name, filetype) + temp_file = '.\\temp\\{0}{1}.m'.format(name, filetype) return compare_files(correct_file, temp_file) @@ -64,11 +57,11 @@ def compare_matlab(name, filetype): def run_matlab_test(name): filename = test_functions.set_up_test(name, 'MATLAB') generate_matlab_files(filename, name) - fail = compare_matlab(name, 'sf') - fail += compare_matlab(name, 'dv') - fail += compare_matlab(name, 'vt') + fails_here = 0 + for filetype in filetypes: #['sf', 'dv', 'vt']: + fails_here += compare_matlab(name, filetype) print('') - return fail + return fails_here ######################################################################### @@ -77,7 +70,7 @@ def run_matlab_test(name): def main(): - # set up the enivornment + # Set up the environment. this_dir = os.path.dirname(os.path.abspath(__file__)) (path_to_tests, other) = os.path.split(this_dir) @@ -86,7 +79,7 @@ def main(): os.mkdir('temp') fail = 0 - # run the individual tests + # Run the individual tests. name = 'qual' fail += run_matlab_test(name) From 6ea87b270216281669d6b87fdafd8e8a6cc70b86 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 12:44:07 +0000 Subject: [PATCH 02/63] Documenting functions in run_matlab_tests.py. --- .../tests/test_matlab/run_matlab_tests.py | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/generator/tests/test_matlab/run_matlab_tests.py b/generator/tests/test_matlab/run_matlab_tests.py index 226b18e0..5350fbeb 100644 --- a/generator/tests/test_matlab/run_matlab_tests.py +++ b/generator/tests/test_matlab/run_matlab_tests.py @@ -16,7 +16,9 @@ # Set up variables fails = [] not_tested = [] -filetypes = ['sf', 'dv', 'vt'] +filetypes = ['sf', # Uses Matlab str2func(). + 'dv', # Creates/uses various DefaultValues functions. + 'vt'] # Creates/uses various ValueType functions. ############################################################################## @@ -24,10 +26,17 @@ def generate_matlab_files(filename, name): + """ + Parse XML file and generate Matlab file from the information obtained. + + :param filename: XML file to parse + :param name: stub of the name, e.g. 'qual' + :returns: nothing + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') - for type in filetypes: #['sf', 'dv', 'vt']: + for type in filetypes: ml = BaseMatlabFile.BaseMatlabFile(name, ob, type) ml.write_file() os.chdir('../.') @@ -37,28 +46,47 @@ def generate_matlab_files(filename, name): # Specific compare functions def compare_files(correct_file, temp_file): + """ + Compare a reference file and a file generated by the code tests. + + :param correct_file: the reference file + :param temp_file: the generated file + :return: 0 if files identical, 1 otherwise. + """ return test_functions.compare_files(correct_file, temp_file, fails, not_tested) def compare_matlab(name, filetype): - - assert filetype in filetypes # ['sf', 'dv', 'vt'] + """ + Compare two Matlab files. Specifically, is the generated file + identical to the reference version? + + :param name: the stub of the file name + :param filetype: one of our recognised 'filetypes' + :return: 0 if files identical, 1 otherwise. + """ + assert filetype in filetypes correct_file = '.\\test-matlab\\{0}{1}.m'.format(name, filetype) temp_file = '.\\temp\\{0}{1}.m'.format(name, filetype) return compare_files(correct_file, temp_file) - ############################################################################# # Specific test functions def run_matlab_test(name): + """ + Run the Matlab test; generate files and compare with reference versions. + + :param name: stub of name e.g. 'qual' + :returns: number of failures + """ filename = test_functions.set_up_test(name, 'MATLAB') generate_matlab_files(filename, name) fails_here = 0 - for filetype in filetypes: #['sf', 'dv', 'vt']: + for filetype in filetypes: fails_here += compare_matlab(name, filetype) print('') return fails_here From 31103f50b9bc6116f5a47eb6dc4fc9fe67bbd543 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 15:41:58 +0000 Subject: [PATCH 03/63] Tidyin gup a bit and adding function docstring. --- .../tests/test_exit_codes/run_exit_tests.py | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/generator/tests/test_exit_codes/run_exit_tests.py b/generator/tests/test_exit_codes/run_exit_tests.py index 65bbb09b..2c145e30 100644 --- a/generator/tests/test_exit_codes/run_exit_tests.py +++ b/generator/tests/test_exit_codes/run_exit_tests.py @@ -1,14 +1,13 @@ #!/usr/bin/env python import os - import sys sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../') sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../') +import deviser import test_functions +from util import global_variables as gv -from util import global_variables -import deviser ############################################################################## # Set up variables @@ -28,20 +27,28 @@ def generate_deviser(args): def run_deviser_test(name, flag, expected_return): - error = global_variables.get_return_code(expected_return) + """ + General function for running Deviser tests. + + :param name: general name of test + :param flag: a command-line flag + :param expected_return: what we expect the test to return. + :return: 0 on success, 1 on failure + """ + error = gv.get_return_code(expected_return) filename = test_functions.set_up_test(name, flag, error) args = [] - if flag == '-g'or flag == '-l': + if flag in ['-g', '-l', 'wrong']: # == '-g'or flag == '-l': args.append('deviser') args.append(flag) args.append(filename) elif flag == 'missing': args.append('deviser') args.append(filename) - elif flag == 'wrong': - args.append('deviser') - args.append(flag) - args.append(filename) + #elif flag == 'wrong': + # args.append('deviser') + # args.append(flag) + # args.append(filename) generate_deviser(args) fail = test_functions.compare_return_codes(name, flag, expected_return, @@ -56,7 +63,7 @@ def run_deviser_test(name, flag, expected_return): def main(): - # set up the enivornment + # Set up the environment. this_dir = os.path.dirname(os.path.abspath(__file__)) (path_to_tests, other) = os.path.split(this_dir) @@ -64,41 +71,31 @@ def main(): fail = 0 - # run the individual tests + # Run the individual tests. fail += run_deviser_test('non-existent', '-g', - global_variables. - return_codes['failed to read file']) + gv.return_codes['failed to read file']) fail += run_deviser_test('test_child', '-g', - global_variables. - return_codes['success']) + gv.return_codes['success']) fail += run_deviser_test('test_child', 'missing', - global_variables. - return_codes['missing function argument']) + gv.return_codes['missing function argument']) fail += run_deviser_test('test_child', 'wrong', - global_variables. - return_codes['invalid function arguments']) + gv.return_codes['invalid function arguments']) # TODO sort for latest python # fail += run_deviser_test('test_child', '-l', - # global_variables. + # gv. # return_codes['success']) fail += run_deviser_test('invalid', '-g', - global_variables. - return_codes['parsing error']) + gv.return_codes['parsing error']) fail += run_deviser_test('invalid', '-l', - global_variables. - return_codes['parsing error']) + gv.return_codes['parsing error']) fail += run_deviser_test('unknown_type', '-g', - global_variables. - return_codes['unknown type used']) + gv.return_codes['unknown type used']) fail += run_deviser_test('unknown_error', '-g', - global_variables. - return_codes['missing required information']) + gv.return_codes['missing required information']) fail += run_deviser_test('bad_lo_element', '-g', - global_variables. - return_codes['unknown type used']) + gv.return_codes['unknown type used']) fail += run_deviser_test('bad_concretes', '-g', - global_variables. - return_codes['missing required information']) + gv.return_codes['missing required information']) test_functions.report('EXIT CODES', fail, fails, not_tested) From 29857809d9cf2dd586be551bb973d4c3d7961eff Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 15:56:09 +0000 Subject: [PATCH 04/63] A bit more tidying. --- .../tests/test_exit_codes/run_exit_tests.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/generator/tests/test_exit_codes/run_exit_tests.py b/generator/tests/test_exit_codes/run_exit_tests.py index 2c145e30..5e25ebe5 100644 --- a/generator/tests/test_exit_codes/run_exit_tests.py +++ b/generator/tests/test_exit_codes/run_exit_tests.py @@ -2,13 +2,13 @@ import os import sys + sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../') sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../') import deviser import test_functions from util import global_variables as gv - ############################################################################## # Set up variables fails = [] @@ -28,7 +28,7 @@ def generate_deviser(args): def run_deviser_test(name, flag, expected_return): """ - General function for running Deviser tests. + General function for running command-line Deviser tests. :param name: general name of test :param flag: a command-line flag @@ -38,17 +38,13 @@ def run_deviser_test(name, flag, expected_return): error = gv.get_return_code(expected_return) filename = test_functions.set_up_test(name, flag, error) args = [] - if flag in ['-g', '-l', 'wrong']: # == '-g'or flag == '-l': + if flag in ['-g', '-l', 'wrong']: args.append('deviser') args.append(flag) args.append(filename) elif flag == 'missing': args.append('deviser') args.append(filename) - #elif flag == 'wrong': - # args.append('deviser') - # args.append(flag) - # args.append(filename) generate_deviser(args) fail = test_functions.compare_return_codes(name, flag, expected_return, @@ -80,10 +76,9 @@ def main(): gv.return_codes['missing function argument']) fail += run_deviser_test('test_child', 'wrong', gv.return_codes['invalid function arguments']) - # TODO sort for latest python + # TODO sort for latest python ** UPDATE 15th December 2020 this seems to work fine on Python 2 and 3.6.12 # fail += run_deviser_test('test_child', '-l', - # gv. - # return_codes['success']) + # gv.return_codes['success']) fail += run_deviser_test('invalid', '-g', gv.return_codes['parsing error']) fail += run_deviser_test('invalid', '-l', @@ -97,7 +92,6 @@ def main(): fail += run_deviser_test('bad_concretes', '-g', gv.return_codes['missing required information']) - test_functions.report('EXIT CODES', fail, fails, not_tested) return fail From 7129b697f56b0eacfe50ffac12414945c80e46d4 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 16:02:53 +0000 Subject: [PATCH 05/63] Replace global_variables with gv. --- generator/tests/test_functions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/generator/tests/test_functions.py b/generator/tests/test_functions.py index 3e011c66..46b3822f 100644 --- a/generator/tests/test_functions.py +++ b/generator/tests/test_functions.py @@ -4,7 +4,7 @@ import shutil import sys sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..') -from util import global_variables +from util import global_variables as gv path_to_tests = '' @@ -26,8 +26,8 @@ def set_path_to_tests(dirname): # set running tests variable # needs to be separate as the global run test function uses it def set_running_tests(): - global_variables.running_tests = True - global_variables.code_returned = global_variables.return_codes['success'] + gv.running_tests = True + gv.code_returned = gv.return_codes['success'] # get the xml filename @@ -75,16 +75,16 @@ def compare_files(infile, outfile, fails, not_tested): def compare_return_codes(name, flag, expected_return, fails): ret = 0 - this_return = global_variables.code_returned - expected = global_variables.get_return_code(expected_return) + this_return = gv.code_returned + expected = gv.get_return_code(expected_return) if this_return == expected_return: print('{0} returned \'{1}\' as expected'.format(name, expected)) else: ret = 1 fails.append('{0}: {1} {2}'.format(name, flag, expected_return)) print('Incorrect Return: {0} Expected: ' - '{1}'.format(global_variables.get_return_code(this_return), - global_variables.get_return_code(expected_return))) + '{1}'.format(gv.get_return_code(this_return), + gv.get_return_code(expected_return))) return ret From 9d328a5b30ce536144336bf2e5479ec5002c1eac Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 16:28:16 +0000 Subject: [PATCH 06/63] Started documenting test_functions.py. --- generator/tests/test_functions.py | 58 +++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/generator/tests/test_functions.py b/generator/tests/test_functions.py index 46b3822f..e5da0e8d 100644 --- a/generator/tests/test_functions.py +++ b/generator/tests/test_functions.py @@ -15,24 +15,37 @@ 'tex': 'run_tex_tests'} -# set up def set_path_to_tests(dirname): + """ + Set up; set global value of the path to the tests. + + :param dirname: the directory containing the tests. + :return: nothing + """ global path_to_tests path_to_tests = dirname remove_temp() set_running_tests() -# set running tests variable -# needs to be separate as the global run test function uses it def set_running_tests(): + """ + Set running tests variable. + Needs to be separate as the global run test function uses it + """ gv.running_tests = True gv.code_returned = gv.return_codes['success'] -# get the xml filename -# and print a banner defining the test def set_up_test(name, class_name, test_case=''): + """ + Get the xml filename, and print a banner defining the test. + + :param name: stub of XML filename, e.g. 'dyn' for filename 'dyn.xml' + :param class_name: test class, e.g. + :param test_case: brief test description, to output on screen + :return: path to the required XML file. + """ set_running_tests() print('====================================================') print('Testing {0}:{1} {2}'.format(name, class_name, test_case)) @@ -42,16 +55,29 @@ def set_up_test(name, class_name, test_case=''): return filename -# reads file containing expected sbml model and returns it as string def read_file(path): + """ + Reads file containing expected sbml model and returns it as string. + + :param path: location of file to read + :returns: contents of the file, as a string. + """ filein = open(path, 'r') contents = filein.read() filein.close() return contents -# do a string comparison of the contents of two file def compare_files(infile, outfile, fails, not_tested): + """ + Do a string comparison of the contents of two files. + + :param infile: reference file + :param outfile: file generated during tests + :param fails: list of failure cases + :param not_tested: list of untested cases + :returns: 0 on success, or file not present; 1 on failure. TODO if file is not present, isn't that a failure? + """ ret = 0 if not os.path.isfile(infile): # we have not added a file to compare to @@ -74,6 +100,15 @@ def compare_files(infile, outfile, fails, not_tested): def compare_return_codes(name, flag, expected_return, fails): + """ + Compare return code from a test with that expected. + + :param name: + :param flag: + :param expected_return: expected return code from a test + :param fails: list of failure cases + :return: 0 on success, 1 on failure. + """ ret = 0 this_return = gv.code_returned expected = gv.get_return_code(expected_return) @@ -137,6 +172,9 @@ def report(name, fail, fails, not_tested): def remove_temp(): + """ + Create temp directory, or replace it if it exists already. + """ if not os.path.isdir('temp'): os.mkdir('temp') else: @@ -145,6 +183,12 @@ def remove_temp(): def create_dir(newdir): + """ + Create a new directory, or replace it if it exists already. + + :param newdir: path to the new directory (or the one to be replaced) + :return: nothing + """ if not os.path.isdir(newdir): os.mkdir(newdir) else: From 08b3d3be7326ee7e429c7dabbf4cc39ea81f6e65 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 16:53:22 +0000 Subject: [PATCH 07/63] Added more docstrings to test_functions.py. --- generator/tests/test_functions.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/generator/tests/test_functions.py b/generator/tests/test_functions.py index e5da0e8d..e1259e63 100644 --- a/generator/tests/test_functions.py +++ b/generator/tests/test_functions.py @@ -42,7 +42,7 @@ def set_up_test(name, class_name, test_case=''): Get the xml filename, and print a banner defining the test. :param name: stub of XML filename, e.g. 'dyn' for filename 'dyn.xml' - :param class_name: test class, e.g. + :param class_name: test class, e.g. 'MATLAB', 'Examples'. :param test_case: brief test description, to output on screen :return: path to the required XML file. """ @@ -103,8 +103,8 @@ def compare_return_codes(name, flag, expected_return, fails): """ Compare return code from a test with that expected. - :param name: - :param flag: + :param name: general name of test + :param flag: a command-line flag :param expected_return: expected return code from a test :param fails: list of failure cases :return: 0 on success, 1 on failure. @@ -123,8 +123,15 @@ def compare_return_codes(name, flag, expected_return, fails): return ret -# run a set of tests def run_tests(test_name, name, fails): + """ + Run a set of tests. + + :param test_name: name of test, e.g. 'test_binding_code' + :param name: e.g. 'code' TODO not entirely sure what this is + :param fails: list of failure cases + :returns: 0 if all tests pass, 1 if at least one failure case. + """ ret = 0 print('====================================================') print('Running {0}'.format(test_name)) @@ -148,8 +155,16 @@ def run_tests(test_name, name, fails): return ret -# write a report for the tests def report(name, fail, fails, not_tested): + """ + Write a report for the tests. + + :param name: name of test suite, e.g. 'EXIT CODES' + :param fail: number of test failures encountered + :param fails: list of failure cases + :param not_tested: list of untested cases + :returns: nothing + """ print('****************************************************************') print('REPORT for {0} Tests'.format(name)) From a6818cacb689aa5f3518a522adcb39ba7744835f Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 15 Dec 2020 17:01:11 +0000 Subject: [PATCH 08/63] A little bit of tidying up. --- generator/tests/run-tests.py | 11 ++++++++++- generator/tests/test_functions.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/generator/tests/run-tests.py b/generator/tests/run-tests.py index a05b0045..19220f98 100644 --- a/generator/tests/run-tests.py +++ b/generator/tests/run-tests.py @@ -1,7 +1,6 @@ #!/usr/bin/env python import os -import sys import test_functions ############################################################################## @@ -15,6 +14,13 @@ def run_test(name, test_type): + """ + Run a test suite. + + :param name: name of test suite, e.g. 'binding' + :param test_type: e.g. 'codes', TODO what is it? + :return: nothing + """ global total_fail test_name = 'test_{0}_{1}'.format(name, test_type) test_case = os.path.join(this_dir, test_name) @@ -28,6 +34,9 @@ def run_test(name, test_type): def main(): + """ + Run all the test suites and output helpful messages. + """ test_functions.set_running_tests() global this_dir this_dir = os.path.dirname(os.path.abspath(__file__)) diff --git a/generator/tests/test_functions.py b/generator/tests/test_functions.py index e1259e63..86fc1b38 100644 --- a/generator/tests/test_functions.py +++ b/generator/tests/test_functions.py @@ -2,7 +2,7 @@ import os import shutil -import sys +import sys sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..') from util import global_variables as gv From 2c37c2297e2b09559da1dbf824c51b07097abf74 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 16 Dec 2020 16:48:36 +0000 Subject: [PATCH 09/63] Took out some common code. --- .../tests/test_examples/run_examples_tests.py | 49 +++++++------------ 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/generator/tests/test_examples/run_examples_tests.py b/generator/tests/test_examples/run_examples_tests.py index 34175eb1..12224a8e 100644 --- a/generator/tests/test_examples/run_examples_tests.py +++ b/generator/tests/test_examples/run_examples_tests.py @@ -22,27 +22,24 @@ ############################################################################## # Specific generation functions - -def generate_example(filename): +def common(filename): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') if not os.path.exists(ob['name']): os.mkdir(ob['name']) os.chdir('./{0}'.format(ob['name'])) + return ob + +def generate_example(filename): + ob = common(filename) all_files = CppExampleFile.CppExampleFile(ob) all_files.write_file() os.chdir('../../.') return ob['name'] - def generate_xml(filename): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if not os.path.exists(ob['name']): - os.mkdir(ob['name']) - os.chdir('./{0}'.format(ob['name'])) + ob = common(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_file('test_xml') os.chdir('../../.') @@ -50,24 +47,14 @@ def generate_xml(filename): def generate_xml_fails(filename): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if not os.path.exists(ob['name']): - os.mkdir(ob['name']) - os.chdir('./{0}'.format(ob['name'])) + ob = common(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_all_files() os.chdir('../../.') return ob['name'] def generate_some_xml_fails(filename, start, stop, number=-1): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if not os.path.exists(ob['name']): - os.mkdir(ob['name']) - os.chdir('./{0}'.format(ob['name'])) + ob = common(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) if number > -1: all_files.set_num_components(number) @@ -83,24 +70,24 @@ def compare_files(correct_file, temp_file): not_tested) def compare_examples(pkg): - correct_file = '.\\test-examples\\{0}\\{0}_example1.cpp'.format(pkg) - temp_file = '.\\temp\\{0}\\{0}_example1.cpp'.format(pkg) + correct_file = os.path.normpath('./test-examples\\{0}\\{0}_example1.cpp'.format(pkg)) + temp_file = os.path.normpath('.\\temp\\{0}\\{0}_example1.cpp'.format(pkg)) return compare_files(correct_file, temp_file) def compare_xml(pkg): - correct_file = '.\\test-examples\\{0}\\test_xml.xml'.format(pkg) - temp_file = '.\\temp\\{0}\\test_xml.xml'.format(pkg) + correct_file = os.path.normpath('.\\test-examples\\{0}\\test_xml.xml'.format(pkg)) + temp_file = os.path.normpath('.\\temp\\{0}\\test_xml.xml'.format(pkg)) return compare_files(correct_file, temp_file) def compare_xml_fails(pkg): fail = 0 - correct_file_dir = '.\\test-examples\\{0}'.format(pkg) - temp_file_dir = '.\\temp\\{0}'.format(pkg) + correct_file_dir = os.path.normpath('.\\test-examples\\{0}'.format(pkg)) + temp_file_dir = os.path.normpath('.\\temp\\{0}'.format(pkg)) for f in os.listdir(temp_file_dir): if f.endswith('xml'): - correct_file = '{0}\\{1}'.format(correct_file_dir, f) - temp_file = '{0}\\{1}'.format(temp_file_dir, f) + correct_file = os.path.normpath('{0}\\{1}'.format(correct_file_dir, f)) + temp_file = os.path.normpath('{0}\\{1}'.format(temp_file_dir, f)) fail += compare_files(correct_file, temp_file) return fail @@ -179,8 +166,8 @@ def main(): # name = 'qual' # fail += run_xml_test(name) # - # name = 'spatial' - # fail += run_xml_test(name) + name = 'spatial' + fail += run_xml_test(name) # # name = 'spatial' # fail += run_specific_xml_fail_tests(name, 8, 13) From 4fd9bc79bf20ddac12c2536b3b379200fd34aac1 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 16 Dec 2020 16:54:16 +0000 Subject: [PATCH 10/63] Using os.path.normpath() means a file path should work on both Windows and *nix. --- .../tests/test_examples/run_examples_tests.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/generator/tests/test_examples/run_examples_tests.py b/generator/tests/test_examples/run_examples_tests.py index 12224a8e..5f8a6870 100644 --- a/generator/tests/test_examples/run_examples_tests.py +++ b/generator/tests/test_examples/run_examples_tests.py @@ -70,24 +70,24 @@ def compare_files(correct_file, temp_file): not_tested) def compare_examples(pkg): - correct_file = os.path.normpath('./test-examples\\{0}\\{0}_example1.cpp'.format(pkg)) - temp_file = os.path.normpath('.\\temp\\{0}\\{0}_example1.cpp'.format(pkg)) + correct_file = os.path.normpath('./test-examples/{0}/{0}_example1.cpp'.format(pkg)) + temp_file = os.path.normpath('./temp/{0}/{0}_example1.cpp'.format(pkg)) return compare_files(correct_file, temp_file) def compare_xml(pkg): - correct_file = os.path.normpath('.\\test-examples\\{0}\\test_xml.xml'.format(pkg)) - temp_file = os.path.normpath('.\\temp\\{0}\\test_xml.xml'.format(pkg)) + correct_file = os.path.normpath('./test-examples/{0}/test_xml.xml'.format(pkg)) + temp_file = os.path.normpath('./temp/{0}/test_xml.xml'.format(pkg)) return compare_files(correct_file, temp_file) def compare_xml_fails(pkg): fail = 0 - correct_file_dir = os.path.normpath('.\\test-examples\\{0}'.format(pkg)) - temp_file_dir = os.path.normpath('.\\temp\\{0}'.format(pkg)) + correct_file_dir = os.path.normpath('./test-examples/{0}'.format(pkg)) + temp_file_dir = os.path.normpath('./temp/{0}'.format(pkg)) for f in os.listdir(temp_file_dir): if f.endswith('xml'): - correct_file = os.path.normpath('{0}\\{1}'.format(correct_file_dir, f)) - temp_file = os.path.normpath('{0}\\{1}'.format(temp_file_dir, f)) + correct_file = os.path.normpath('{0}/{1}'.format(correct_file_dir, f)) + temp_file = os.path.normpath('{0}/{1}'.format(temp_file_dir, f)) fail += compare_files(correct_file, temp_file) return fail From 70abf423b9155ba587228e91c63eddf4270bebf0 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 16 Dec 2020 17:19:15 +0000 Subject: [PATCH 11/63] Now we can run more tests. --- .../tests/test_examples/run_examples_tests.py | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/generator/tests/test_examples/run_examples_tests.py b/generator/tests/test_examples/run_examples_tests.py index 5f8a6870..6a78a3db 100644 --- a/generator/tests/test_examples/run_examples_tests.py +++ b/generator/tests/test_examples/run_examples_tests.py @@ -148,53 +148,53 @@ def main(): # name = 'lo_children' # fail += run_test(name) # - # name = 'lo_children' - # fail += run_xml_test(name) + name = 'lo_children' + fail += run_xml_test(name) + + name = 'base_class' + fail += run_xml_test(name) + + name = 'base_class' + fail += run_xml_fail_tests(name) # - # name = 'base_class' + # name = 'groups' # fail += run_xml_test(name) - # - # name = 'base_class' - # fail += run_xml_fail_tests(name) - # - name = 'groups' - fail += run_xml_test(name) # name = 'groups' # fail += run_xml_fail_tests(name) - # - # name = 'qual' - # fail += run_xml_test(name) - # + + name = 'qual' + fail += run_xml_test(name) + name = 'spatial' fail += run_xml_test(name) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 8, 13) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 15, 19) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 22, 26) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 32, 36) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 41, 45) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 53, 54) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 60, 61) - # - # name = 'spatial' - # fail += run_specific_xml_fail_tests(name, 65, 66) - # - # name = 'multi' - # fail += run_specific_xml_fail_tests(name, 1, 2, 0) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 8, 13) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 15, 19) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 22, 26) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 32, 36) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 41, 45) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 53, 54) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 60, 61) + + name = 'spatial' + fail += run_specific_xml_fail_tests(name, 65, 66) + + #name = 'multi' + #fail += run_specific_xml_fail_tests(name, 1, 2, 0) # # write summary test_functions.report('examples', fail, fails, not_tested) From 92e97b4fc8e81521b9b3a7cd1ae779fb4c52c4ba Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 10:17:25 +0000 Subject: [PATCH 12/63] More meaningful function name. Some tidying. --- .../tests/test_examples/run_examples_tests.py | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/generator/tests/test_examples/run_examples_tests.py b/generator/tests/test_examples/run_examples_tests.py index 6a78a3db..85066ff2 100644 --- a/generator/tests/test_examples/run_examples_tests.py +++ b/generator/tests/test_examples/run_examples_tests.py @@ -9,7 +9,6 @@ from code_files import CppExampleFile from validation import ValidationXMLFiles from parseXML import ParseXML -from util import strFunctions from tests import test_functions @@ -22,7 +21,7 @@ ############################################################################## # Specific generation functions -def common(filename): +def set_up(filename): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') @@ -31,15 +30,17 @@ def common(filename): os.chdir('./{0}'.format(ob['name'])) return ob + def generate_example(filename): - ob = common(filename) + ob = set_up(filename) all_files = CppExampleFile.CppExampleFile(ob) all_files.write_file() os.chdir('../../.') return ob['name'] + def generate_xml(filename): - ob = common(filename) + ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_file('test_xml') os.chdir('../../.') @@ -47,14 +48,15 @@ def generate_xml(filename): def generate_xml_fails(filename): - ob = common(filename) + ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_all_files() os.chdir('../../.') return ob['name'] + def generate_some_xml_fails(filename, start, stop, number=-1): - ob = common(filename) + ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) if number > -1: all_files.set_num_components(number) @@ -65,15 +67,18 @@ def generate_some_xml_fails(filename, start, stop, number=-1): ############################################################################# # Specific compare functions + def compare_files(correct_file, temp_file): return test_functions.compare_files(correct_file, temp_file, fails, not_tested) + def compare_examples(pkg): correct_file = os.path.normpath('./test-examples/{0}/{0}_example1.cpp'.format(pkg)) temp_file = os.path.normpath('./temp/{0}/{0}_example1.cpp'.format(pkg)) return compare_files(correct_file, temp_file) + def compare_xml(pkg): correct_file = os.path.normpath('./test-examples/{0}/test_xml.xml'.format(pkg)) temp_file = os.path.normpath('./temp/{0}/test_xml.xml'.format(pkg)) @@ -92,12 +97,9 @@ def compare_xml_fails(pkg): return fail - - ############################################################################# # Specific test functions - def run_test(name): filename = test_functions.set_up_test(name, 'Examples') pkg = generate_example(filename) @@ -105,6 +107,7 @@ def run_test(name): print('') return fail + def run_xml_test(name): filename = test_functions.set_up_test(name, 'Examples') pkg = generate_xml(filename) @@ -112,6 +115,7 @@ def run_xml_test(name): print('') return fail + def run_xml_fail_tests(name): filename = test_functions.set_up_test(name, 'Examples') pkg = generate_xml_fails(filename) @@ -119,6 +123,7 @@ def run_xml_fail_tests(name): print('') return fail + def run_specific_xml_fail_tests(name, start, stop, number=-1): filename = test_functions.set_up_test(name, 'Examples') pkg = generate_some_xml_fails(filename, start, stop, number) @@ -132,7 +137,7 @@ def run_specific_xml_fail_tests(name, start, stop, number=-1): def main(): - # set up the enivornment + # Set up the environment this_dir = os.path.dirname(os.path.abspath(__file__)) (path_to_tests, other) = os.path.split(this_dir) @@ -168,29 +173,13 @@ def main(): name = 'spatial' fail += run_xml_test(name) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 8, 13) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 15, 19) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 22, 26) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 32, 36) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 41, 45) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 53, 54) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 60, 61) - - name = 'spatial' fail += run_specific_xml_fail_tests(name, 65, 66) #name = 'multi' From f128fa135ad2a3782cd7145fc0a18c9553e09c79 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 11:29:19 +0000 Subject: [PATCH 13/63] I've added docstrings to the functions I understand. --- .../tests/test_examples/run_examples_tests.py | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/generator/tests/test_examples/run_examples_tests.py b/generator/tests/test_examples/run_examples_tests.py index 85066ff2..aa6eed28 100644 --- a/generator/tests/test_examples/run_examples_tests.py +++ b/generator/tests/test_examples/run_examples_tests.py @@ -22,6 +22,13 @@ # Specific generation functions def set_up(filename): + """ + Parse an XML file and get the big dictionary structure of information + from it. + + :param filename: the file to parse + :return: the big dictionary structure. + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') @@ -32,6 +39,12 @@ def set_up(filename): def generate_example(filename): + """ + Generate a C++ example. + + :param filename: XML file to parse + :return: package name, e.g. 'dyn' + """ ob = set_up(filename) all_files = CppExampleFile.CppExampleFile(ob) all_files.write_file() @@ -40,6 +53,12 @@ def generate_example(filename): def generate_xml(filename): + """ + Generate an XML example. + + :param filename: XML file to parse + :return: package name, e.g. 'dyn' + """ ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_file('test_xml') @@ -48,6 +67,12 @@ def generate_xml(filename): def generate_xml_fails(filename): + """ + Generate a failure example?????? TODO unsure + + :param filename: XML file to parse + :return: package name, e.g. 'dyn' + """ ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_all_files() @@ -56,6 +81,17 @@ def generate_xml_fails(filename): def generate_some_xml_fails(filename, start, stop, number=-1): + """ + Generate + + :param filename: XML file to parse + :param start: + :param stop: + :param number: number of files to write? TODO not sure. + :return: package name, e.g. 'dyn' + + TODO Sorry Sarah I'm a bit confused by this one! + """ ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) if number > -1: @@ -67,25 +103,56 @@ def generate_some_xml_fails(filename, start, stop, number=-1): ############################################################################# # Specific compare functions +# TODO we could merge some of these into a more generic function. def compare_files(correct_file, temp_file): + """ + See if two files are the same. + + :param correct_file: the reference file we are comparing against. + :param temp_file: the temporary file generated in the test, which + we compare with correct_file. + :return: 0 on success (or file not present), 1 on failure. + + TODO I don't think we really need this wrapper function; + test code could just call test_functions.compare_files() directly. + """ return test_functions.compare_files(correct_file, temp_file, fails, not_tested) def compare_examples(pkg): + """ + Compare a reference example C++ file with a temporary one. + + :param pkg: name of XML package, e.g. 'dyn'. + :return: 0 on success or file not present, 1 on failure. + """ correct_file = os.path.normpath('./test-examples/{0}/{0}_example1.cpp'.format(pkg)) temp_file = os.path.normpath('./temp/{0}/{0}_example1.cpp'.format(pkg)) return compare_files(correct_file, temp_file) def compare_xml(pkg): + """ + Compare a reference example XML file with a temporary one. + + :param pkg: name of XML package, e.g. 'dyn'. + :return: 0 on success or file not present, 1 on failure. + """ correct_file = os.path.normpath('./test-examples/{0}/test_xml.xml'.format(pkg)) temp_file = os.path.normpath('./temp/{0}/test_xml.xml'.format(pkg)) return compare_files(correct_file, temp_file) def compare_xml_fails(pkg): + """ + Compare a set of reference example XML files in a directory + with those we generated in a temporary directory. + + :param pkg: name of XML package, e.g. 'dyn'. + :return: 0 on success or file not present, 1 on failure. + """ fail = 0 correct_file_dir = os.path.normpath('./test-examples/{0}'.format(pkg)) temp_file_dir = os.path.normpath('./temp/{0}'.format(pkg)) @@ -100,7 +167,15 @@ def compare_xml_fails(pkg): ############################################################################# # Specific test functions +# TODO Again, some scope for rationalisation here. + def run_test(name): + """ + Run a C++ file test. + + :param name: XML package name, e.g. 'dyn' + :return 0 on success (or file not present), 1 on failure. + """ filename = test_functions.set_up_test(name, 'Examples') pkg = generate_example(filename) fail = compare_examples(pkg) @@ -109,6 +184,12 @@ def run_test(name): def run_xml_test(name): + """ + Run an XML file test. + + :param name: XML package name, e.g. 'dyn' + :return 0 on success (or file not present), 1 on failure. + """ filename = test_functions.set_up_test(name, 'Examples') pkg = generate_xml(filename) fail = compare_xml(pkg) @@ -117,6 +198,12 @@ def run_xml_test(name): def run_xml_fail_tests(name): + """ + Run an XML failure file test. + + :param name: XML package name, e.g. 'dyn' + :return 0 on success (or file not present), 1 on failure. + """ filename = test_functions.set_up_test(name, 'Examples') pkg = generate_xml_fails(filename) fail = compare_xml_fails(pkg) @@ -125,6 +212,17 @@ def run_xml_fail_tests(name): def run_specific_xml_fail_tests(name, start, stop, number=-1): + """ + Generate specific XML failure test cases??? + + :param name: XML file to parse + :param start: + :param stop: + :param number: number of files to write? TODO not sure. + :return: 0 on success or file mising, 1 on failure. + + TODO Sorry Sarah I'm a bit confused by this one as well! + """ filename = test_functions.set_up_test(name, 'Examples') pkg = generate_some_xml_fails(filename, start, stop, number) fail = compare_xml_fails(pkg) @@ -173,6 +271,7 @@ def main(): name = 'spatial' fail += run_xml_test(name) + # Pytest parameterization is good for this sort of thing: fail += run_specific_xml_fail_tests(name, 8, 13) fail += run_specific_xml_fail_tests(name, 15, 19) fail += run_specific_xml_fail_tests(name, 22, 26) From 84a3ac89f4cdbd9d4b662e42824cbf06185103a1 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 11:49:54 +0000 Subject: [PATCH 14/63] Final comment for now. --- generator/tests/test_examples/run_examples_tests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generator/tests/test_examples/run_examples_tests.py b/generator/tests/test_examples/run_examples_tests.py index aa6eed28..f3e94493 100644 --- a/generator/tests/test_examples/run_examples_tests.py +++ b/generator/tests/test_examples/run_examples_tests.py @@ -233,6 +233,9 @@ def run_specific_xml_fail_tests(name, start, stop, number=-1): # Main function +# TODO sort out the tests which are failing, and those which are being +# skipped because a file isn't present. + def main(): # Set up the environment From 74f1260b8eda8ea741d3fa572fa38f34ac5274ec Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 12:02:01 +0000 Subject: [PATCH 15/63] Using os.path.normpath() means this should work on Windows and *nix. --- generator/tests/test_tex_files/run_tex_tests.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/generator/tests/test_tex_files/run_tex_tests.py b/generator/tests/test_tex_files/run_tex_tests.py index 80956815..625a5166 100644 --- a/generator/tests/test_tex_files/run_tex_tests.py +++ b/generator/tests/test_tex_files/run_tex_tests.py @@ -12,7 +12,6 @@ import test_functions - ############################################################################## # Set up variables fails = [] @@ -68,20 +67,20 @@ def compare_files(correct_file, temp_file): def compare_validation(name): - correct_file = '.\\test-tex\\{0}\\apdx-validation.tex'.format(name) - temp_file = '.\\temp\\{0}\\apdx-validation.tex'.format(name) + correct_file = os.path.normpath('./test-tex/{0}/apdx-validation.tex'.format(name)) + temp_file = os.path.normpath('./temp/{0}/apdx-validation.tex'.format(name)) return compare_files(correct_file, temp_file) def compare_macros(name): - correct_file = '.\\test-tex\\{0}\\macros.tex'.format(name) - temp_file = '.\\temp\\{0}\\macros.tex'.format(name) + correct_file = os.path.normpath('./test-tex/{0}/macros.tex'.format(name)) + temp_file = os.path.normpath('./temp/{0}/macros.tex'.format(name)) return compare_files(correct_file, temp_file) def compare_body(name): - correct_file = '.\\test-tex\\{0}\\body.tex'.format(name) - temp_file = '.\\temp\\{0}\\body.tex'.format(name) + correct_file = os.path.normpath('./test-tex/{0}/body.tex'.format(name)) + temp_file = os.path.normpath('./temp/{0}/body.tex'.format(name)) return compare_files(correct_file, temp_file) @@ -112,7 +111,7 @@ def run_test(name, test_type): def main(): runall = True - # set up the enivornment + # Set up the environment. this_dir = os.path.dirname(os.path.abspath(__file__)) (path_to_tests, other) = os.path.split(this_dir) From ec85fe2129b7684de7fb5dbd3e729676f7f25d40 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 12:32:57 +0000 Subject: [PATCH 16/63] Extract common code into setup(). --- .../tests/test_tex_files/run_tex_tests.py | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/generator/tests/test_tex_files/run_tex_tests.py b/generator/tests/test_tex_files/run_tex_tests.py index 625a5166..d19f66ec 100644 --- a/generator/tests/test_tex_files/run_tex_tests.py +++ b/generator/tests/test_tex_files/run_tex_tests.py @@ -21,38 +21,32 @@ ############################################################################## # Specific generation functions - -def generate_validator(filename, name): +def setup(filename, name): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') if not os.path.isdir(name): os.mkdir(name) os.chdir(name) + return ob + + +def generate_validator(filename, name): + ob = setup(filename, name) all_files = TexValidationRulesFile.TexValidationRulesFile(ob) all_files.write_file() os.chdir('../../.') def generate_macros(filename, name): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if not os.path.isdir(name): - os.mkdir(name) - os.chdir(name) + ob = setup(filename, name) all_files = TexMacrosFile.TexMacrosFile(ob) all_files.write_file() os.chdir('../../.') def generate_body(filename, name): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if not os.path.isdir(name): - os.mkdir(name) - os.chdir(name) + ob = setup(filename, name) all_files = TexBodySyntaxFile.TexBodySyntaxFile(ob) all_files.write_file() os.chdir('../../.') @@ -114,14 +108,20 @@ def main(): # Set up the environment. this_dir = os.path.dirname(os.path.abspath(__file__)) - (path_to_tests, other) = os.path.split(this_dir) + (path_to_tests, _) = os.path.split(this_dir) test_functions.set_path_to_tests(path_to_tests) if not os.path.isdir('temp'): os.mkdir('temp') fail = 0 + # These tests all appear to be independent from each other, + # so I'm assuming their order doesn't matter. + name = 'spatial' + test_case = 'body' + fail += run_test(name, test_case) + if runall: - # run the individual tests + # Run the other individual tests. name = 'qual' test_case = 'validation' fail += run_test(name, test_case) @@ -162,18 +162,6 @@ def main(): test_case = 'validation' fail += run_test(name, test_case) - name = 'spatial' - test_case = 'validation' - fail += run_test(name, test_case) - - name = 'spatial' - test_case = 'body' - fail += run_test(name, test_case) - else: - name = 'spatial' - test_case = 'validation' - fail += run_test(name, test_case) - # write summary test_functions.report('TEX', fail, fails, not_tested) return fail From cdd8a3f1fbc3fe1a5307f1cb20618b7fafd13c0c Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 12:58:49 +0000 Subject: [PATCH 17/63] Now we have a common compare function. --- .../tests/test_tex_files/run_tex_tests.py | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/generator/tests/test_tex_files/run_tex_tests.py b/generator/tests/test_tex_files/run_tex_tests.py index d19f66ec..742ba684 100644 --- a/generator/tests/test_tex_files/run_tex_tests.py +++ b/generator/tests/test_tex_files/run_tex_tests.py @@ -78,6 +78,13 @@ def compare_body(name): return compare_files(correct_file, temp_file) +def compare_items(name, type): + assert type in ['apdx-validation', 'macros', 'body'] + correct_file = os.path.normpath('./test-tex/{0}/{1}.tex'.format(name, type)) + temp_file = os.path.normpath('./temp/{0}/{1}.tex'.format(name, type)) + return test_functions.compare_files(correct_file, temp_file, fails, + not_tested) + ############################################################################# # Specific test functions @@ -85,15 +92,17 @@ def compare_body(name): def run_test(name, test_type): filename = test_functions.set_up_test(name, 'Tex', test_type) fail = 0 - if test_type == 'validation': + #fail = compare_items(name, test_type) + if test_type == 'apdx-validation': generate_validator(filename, name) - fail = compare_validation(name) + #fail = compare_validation(name) elif test_type == 'macros': generate_macros(filename, name) - fail = compare_macros(name) + #fail = compare_macros(name) elif test_type == 'body': generate_body(filename, name) - fail = compare_body(name) + #fail = compare_body(name) + fail = compare_items(name, test_type) print('') return fail @@ -123,7 +132,7 @@ def main(): if runall: # Run the other individual tests. name = 'qual' - test_case = 'validation' + test_case = 'apdx-validation' fail += run_test(name, test_case) name = 'groups' @@ -131,7 +140,7 @@ def main(): fail += run_test(name, test_case) name = 'groups' - test_case = 'validation' + test_case = 'apdx-validation' fail += run_test(name, test_case) name = 'groups' @@ -139,11 +148,11 @@ def main(): fail += run_test(name, test_case) name = 'unknown_type' - test_case = 'validation' + test_case = 'apdx-validation' fail += run_test(name, test_case) name = 'test_sidrefs' - test_case = 'validation' + test_case = 'apdx-validation' fail += run_test(name, test_case) name = 'test_sidrefs' @@ -151,7 +160,7 @@ def main(): fail += run_test(name, test_case) name = 'test_lists' - test_case = 'validation' + test_case = 'apdx-validation' fail += run_test(name, test_case) name = 'test_lists' @@ -159,7 +168,7 @@ def main(): fail += run_test(name, test_case) name = 'test_att' - test_case = 'validation' + test_case = 'apdx-validation' fail += run_test(name, test_case) # write summary From 32a8e3cab2f0d6ba4ca37e902bab1a3ee04feba7 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 13:07:16 +0000 Subject: [PATCH 18/63] More generic functions to replace specifics. --- .../tests/test_tex_files/run_tex_tests.py | 65 +++---------------- 1 file changed, 9 insertions(+), 56 deletions(-) diff --git a/generator/tests/test_tex_files/run_tex_tests.py b/generator/tests/test_tex_files/run_tex_tests.py index 742ba684..53e16d52 100644 --- a/generator/tests/test_tex_files/run_tex_tests.py +++ b/generator/tests/test_tex_files/run_tex_tests.py @@ -18,9 +18,6 @@ not_tested = [] -############################################################################## -# Specific generation functions - def setup(filename, name): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() @@ -31,53 +28,19 @@ def setup(filename, name): return ob -def generate_validator(filename, name): - ob = setup(filename, name) - all_files = TexValidationRulesFile.TexValidationRulesFile(ob) - all_files.write_file() - os.chdir('../../.') - - -def generate_macros(filename, name): - ob = setup(filename, name) - all_files = TexMacrosFile.TexMacrosFile(ob) - all_files.write_file() - os.chdir('../../.') - - -def generate_body(filename, name): +def generate_files(filename, name, type): + assert type in ['apdx-validation', 'macros', 'body'] ob = setup(filename, name) - all_files = TexBodySyntaxFile.TexBodySyntaxFile(ob) + if type == 'apdx-validation': + all_files = TexValidationRulesFile.TexValidationRulesFile(ob) + elif type == 'macros': + all_files = TexMacrosFile.TexMacrosFile(ob) + else: # type == 'body': + all_files = TexBodySyntaxFile.TexBodySyntaxFile(ob) all_files.write_file() os.chdir('../../.') -############################################################################# -# Specific compare functions - -def compare_files(correct_file, temp_file): - return test_functions.compare_files(correct_file, temp_file, fails, - not_tested) - - -def compare_validation(name): - correct_file = os.path.normpath('./test-tex/{0}/apdx-validation.tex'.format(name)) - temp_file = os.path.normpath('./temp/{0}/apdx-validation.tex'.format(name)) - return compare_files(correct_file, temp_file) - - -def compare_macros(name): - correct_file = os.path.normpath('./test-tex/{0}/macros.tex'.format(name)) - temp_file = os.path.normpath('./temp/{0}/macros.tex'.format(name)) - return compare_files(correct_file, temp_file) - - -def compare_body(name): - correct_file = os.path.normpath('./test-tex/{0}/body.tex'.format(name)) - temp_file = os.path.normpath('./temp/{0}/body.tex'.format(name)) - return compare_files(correct_file, temp_file) - - def compare_items(name, type): assert type in ['apdx-validation', 'macros', 'body'] correct_file = os.path.normpath('./test-tex/{0}/{1}.tex'.format(name, type)) @@ -91,17 +54,7 @@ def compare_items(name, type): def run_test(name, test_type): filename = test_functions.set_up_test(name, 'Tex', test_type) - fail = 0 - #fail = compare_items(name, test_type) - if test_type == 'apdx-validation': - generate_validator(filename, name) - #fail = compare_validation(name) - elif test_type == 'macros': - generate_macros(filename, name) - #fail = compare_macros(name) - elif test_type == 'body': - generate_body(filename, name) - #fail = compare_body(name) + generate_files(filename, name, test_type) fail = compare_items(name, test_type) print('') return fail From 01fc80230151d0660b0445078995b335ad90e369 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 14:32:14 +0000 Subject: [PATCH 19/63] Finished documenting run_text_tests.py. --- .../tests/test_tex_files/run_tex_tests.py | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/generator/tests/test_tex_files/run_tex_tests.py b/generator/tests/test_tex_files/run_tex_tests.py index 53e16d52..0bfc8cca 100644 --- a/generator/tests/test_tex_files/run_tex_tests.py +++ b/generator/tests/test_tex_files/run_tex_tests.py @@ -19,6 +19,14 @@ def setup(filename, name): + """ + Parses XML file and obtains big dictionary structure of information + about it. Creates directory for test file, if required. + + :param filename: name of the XML file to parse + :param name: name of the temporary directory + :returns: the big dictionary structure. + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') @@ -29,6 +37,14 @@ def setup(filename, name): def generate_files(filename, name, type): + """ + Generate the file to test. + + :param filename: the name of the file + :param name: directory in which to create the file + :type: one of ['apdx-validation', 'macros', 'body'] + :returns: nothing + """ assert type in ['apdx-validation', 'macros', 'body'] ob = setup(filename, name) if type == 'apdx-validation': @@ -42,17 +58,28 @@ def generate_files(filename, name, type): def compare_items(name, type): + """ + Compare two files, reference and temporary versions. + + :param name: name of the directory housing the file. + :param type: one of ['apdx-validation', 'macros', 'body'] + :return: 0 if success or file missing, 1 on failure + """ assert type in ['apdx-validation', 'macros', 'body'] correct_file = os.path.normpath('./test-tex/{0}/{1}.tex'.format(name, type)) temp_file = os.path.normpath('./temp/{0}/{1}.tex'.format(name, type)) return test_functions.compare_files(correct_file, temp_file, fails, not_tested) -############################################################################# -# Specific test functions - def run_test(name, test_type): + """ + Generic test function. + + :param name: directory name + :param test_type: a valid test type e.g. 'macros' + :returns: 0 if success or file missing, 1 if failure. + """ filename = test_functions.set_up_test(name, 'Tex', test_type) generate_files(filename, name, test_type) fail = compare_items(name, test_type) From 1071facb10588f88fc0cd2881affd823e2feb466 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 15:16:55 +0000 Subject: [PATCH 20/63] Adding os.path.normpath() lets us run the tsts on Windows and *nix. --- generator/tests/test_binding_code/run_bindings_tests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/tests/test_binding_code/run_bindings_tests.py b/generator/tests/test_binding_code/run_bindings_tests.py index 7b195c1d..2f203342 100644 --- a/generator/tests/test_binding_code/run_bindings_tests.py +++ b/generator/tests/test_binding_code/run_bindings_tests.py @@ -94,14 +94,14 @@ def compare_files(correct_file, temp_file): def compare_code(name, binding, ext): - correct_file = '.\\test-binding\\{0}\\{1}.{2}'.format(binding, name, ext) - temp_file = '.\\temp\\{0}\\{1}.{2}'.format(binding, name, ext) + correct_file = os.path.normpath('./test-binding/{0}/{1}.{2}'.format(binding, name, ext)) + temp_file = os.path.normpath('./temp/{0}/{1}.{2}'.format(binding, name, ext)) return compare_files(correct_file, temp_file) def compare_ext_headers(class_name): - correct_file = '.\\test-extension\\{0}.h'.format(class_name) - temp_file = '.\\temp\\{0}.h'.format(class_name) + correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) + temp_file = ('./temp/{0}.h'.format(class_name)) return compare_files(correct_file, temp_file) From bc23d8f3fe4c084a0a6fbb65e9c3a449f79e05cc Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 15:33:35 +0000 Subject: [PATCH 21/63] Extracted common set-up code into its own function. --- .../test_binding_code/run_bindings_tests.py | 54 +++++-------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/generator/tests/test_binding_code/run_bindings_tests.py b/generator/tests/test_binding_code/run_bindings_tests.py index 2f203342..0b2b446f 100644 --- a/generator/tests/test_binding_code/run_bindings_tests.py +++ b/generator/tests/test_binding_code/run_bindings_tests.py @@ -19,8 +19,7 @@ ############################################################################## # Specific generation functions - -def generate_bindings_downcast_ext(filename, binding): +def set_up(filename, binding): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') @@ -30,60 +29,33 @@ def generate_bindings_downcast_ext(filename, binding): os.makedirs(binding) os.chdir(binding) all_files = BindingsFiles.BindingFiles(ob, binding, True) - all_files.write_downcast_extension() - os.chdir('../.') - os.chdir('../.') + return all_files +def generate_bindings_downcast_ext(filename, binding): + all_files = set_up(filename, binding) + all_files.write_downcast_extension() + os.chdir('../..') + def generate_bindings_downcast_ns(filename, binding): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if os.path.isdir(binding): - os.chdir(binding) - else: - os.makedirs(binding) - os.chdir(binding) - all_files = BindingsFiles.BindingFiles(ob, binding, True) + all_files = set_up(filename, binding) all_files.write_downcast_namespace() - os.chdir('../.') - os.chdir('../.') - + os.chdir('../..') def generate_bindings_downcast_pkgs(filename, binding, local): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if os.path.isdir(binding): - os.chdir(binding) - else: - os.makedirs(binding) - os.chdir(binding) - all_files = BindingsFiles.BindingFiles(ob, binding, True) + all_files = set_up(filename, binding) if binding == 'swig': all_files.write_swig_files() elif local: all_files.write_local() else: all_files.write_downcast_packages() - os.chdir('../.') - os.chdir('../.') - + os.chdir('../..') def generate_bindings_downcast_plugins(filename, binding): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - if os.path.isdir(binding): - os.chdir(binding) - else: - os.makedirs(binding) - os.chdir(binding) - all_files = BindingsFiles.BindingFiles(ob, binding, True) + all_files = set_up(filename, binding) all_files.write_downcast_plugins() - os.chdir('../.') - os.chdir('../.') - + os.chdir('../..') ############################################################################# # Specific compare functions From b15acc2afc14d785fe061cffd410869e02cfe020 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 15:44:39 +0000 Subject: [PATCH 22/63] Removed wrapper function around test_functions.compare_files(). --- .../tests/test_binding_code/run_bindings_tests.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/generator/tests/test_binding_code/run_bindings_tests.py b/generator/tests/test_binding_code/run_bindings_tests.py index 0b2b446f..6de4c314 100644 --- a/generator/tests/test_binding_code/run_bindings_tests.py +++ b/generator/tests/test_binding_code/run_bindings_tests.py @@ -60,21 +60,18 @@ def generate_bindings_downcast_plugins(filename, binding): ############################################################################# # Specific compare functions -def compare_files(correct_file, temp_file): - return test_functions.compare_files(correct_file, temp_file, fails, - not_tested) - - def compare_code(name, binding, ext): correct_file = os.path.normpath('./test-binding/{0}/{1}.{2}'.format(binding, name, ext)) temp_file = os.path.normpath('./temp/{0}/{1}.{2}'.format(binding, name, ext)) - return compare_files(correct_file, temp_file) + return test_functions.compare_files(correct_file, temp_file, fails, + not_tested) def compare_ext_headers(class_name): correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) temp_file = ('./temp/{0}.h'.format(class_name)) - return compare_files(correct_file, temp_file) + return test_functions.compare_files(correct_file, temp_file, fails, + not_tested) ############################################################################# From bd23dd79ffacf1aa2116df8916019e97582f5ee7 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 16:03:51 +0000 Subject: [PATCH 23/63] Added some docstrings. --- .../test_binding_code/run_bindings_tests.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/generator/tests/test_binding_code/run_bindings_tests.py b/generator/tests/test_binding_code/run_bindings_tests.py index 6de4c314..3ebddba3 100644 --- a/generator/tests/test_binding_code/run_bindings_tests.py +++ b/generator/tests/test_binding_code/run_bindings_tests.py @@ -20,6 +20,15 @@ # Specific generation functions def set_up(filename, binding): + """ + Generic set-up code used by all the specific generation functions. + Parse XML file and use the big dictionary structure obtained to + generate a bindings file of the required binding. + + :param filename: the XML file to parse + :param binding: the required binding, e.g. 'csharp', 'java', etc. + :return: the new file object + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') @@ -33,16 +42,27 @@ def set_up(filename, binding): def generate_bindings_downcast_ext(filename, binding): + """ + Generate a downcast extension. + """ all_files = set_up(filename, binding) all_files.write_downcast_extension() os.chdir('../..') + def generate_bindings_downcast_ns(filename, binding): + """ + Generate a downcast namespace. + """ all_files = set_up(filename, binding) all_files.write_downcast_namespace() os.chdir('../..') + def generate_bindings_downcast_pkgs(filename, binding, local): + """ + Generate a downcast package. + """ all_files = set_up(filename, binding) if binding == 'swig': all_files.write_swig_files() @@ -52,7 +72,11 @@ def generate_bindings_downcast_pkgs(filename, binding, local): all_files.write_downcast_packages() os.chdir('../..') + def generate_bindings_downcast_plugins(filename, binding): + """ + Generate a downcast plugin. + """ all_files = set_up(filename, binding) all_files.write_downcast_plugins() os.chdir('../..') From f2cae72aec0249c768204516f3990d6130d4311a Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Thu, 17 Dec 2020 17:01:19 +0000 Subject: [PATCH 24/63] Added what docstrings I can. --- .../test_binding_code/run_bindings_tests.py | 78 +++++++++++++++++-- 1 file changed, 71 insertions(+), 7 deletions(-) diff --git a/generator/tests/test_binding_code/run_bindings_tests.py b/generator/tests/test_binding_code/run_bindings_tests.py index 3ebddba3..2cef6455 100644 --- a/generator/tests/test_binding_code/run_bindings_tests.py +++ b/generator/tests/test_binding_code/run_bindings_tests.py @@ -85,6 +85,14 @@ def generate_bindings_downcast_plugins(filename, binding): # Specific compare functions def compare_code(name, binding, ext): + """ + Compare a reference file with a temporary test version of the file. + + :param name: name of reference file + :param binding: which binding, e.g. 'java' + :param ext: the file extension + :returns: 0 on success or missing file, 1 on failure. + """ correct_file = os.path.normpath('./test-binding/{0}/{1}.{2}'.format(binding, name, ext)) temp_file = os.path.normpath('./temp/{0}/{1}.{2}'.format(binding, name, ext)) return test_functions.compare_files(correct_file, temp_file, fails, @@ -92,6 +100,9 @@ def compare_code(name, binding, ext): def compare_ext_headers(class_name): + """ + TODO This function doesn't appear to be used anywhere. + """ correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) temp_file = ('./temp/{0}.h'.format(class_name)) return test_functions.compare_files(correct_file, temp_file, fails, @@ -102,6 +113,13 @@ def compare_ext_headers(class_name): # Specific test functions def run_ns_test(name, binding, ext): + """ + Run a namespace test. + + :param name: package name + :param binding: the required binding, e.g. 'csharp', 'java', etc. + :param ext: the file extension + """ filename = test_functions.set_up_test(name, 'downcast-ns', binding) generate_bindings_downcast_ns(filename, binding) if name == 'test_vers': @@ -112,7 +130,17 @@ def run_ns_test(name, binding, ext): return fail +# TODO I'm not sure what these different test functions are testing, exactly. + + def run_test(name, binding, ext): + """ + Run a test. TODO Sarah please expand... + + :param name: package name + :param binding: the required binding, e.g. 'csharp', 'java', etc. + :param ext: the file extension + """ filename = test_functions.set_up_test(name, 'downcast-ext', binding) generate_bindings_downcast_ext(filename, binding) if name == 'test_vers': @@ -124,6 +152,13 @@ def run_test(name, binding, ext): def run_pkgs_test(name, binding, ext): + """ + Run a test. TODO Sarah please expand... + + :param name: package name + :param binding: the required binding, e.g. 'csharp', 'java', etc. + :param ext: the file extension + """ filename = test_functions.set_up_test(name, 'downcast-packages', binding) generate_bindings_downcast_pkgs(filename, binding, False) if name == 'test_vers': @@ -138,6 +173,14 @@ def run_pkgs_test(name, binding, ext): def run_local_test(name, binding, ext, local): + """ + Run a test. TODO Sarah please expand... + + :param name: package name + :param binding: the required binding, e.g. 'csharp', 'java', etc. + :param ext: the file extension + :param local: TODO Sarah please expand... + """ filename = test_functions.set_up_test(name, 'local', binding) generate_bindings_downcast_pkgs(filename, binding, local) if binding == 'csharp' or binding == 'java': @@ -150,6 +193,13 @@ def run_local_test(name, binding, ext, local): def run_plugin_test(name, binding, ext): + """ + Run a test. TODO Sarah please expand... + + :param name: package name + :param binding: the required binding, e.g. 'csharp', 'java', etc. + :param ext: the file extension + """ filename = test_functions.set_up_test(name, 'downcast-plugins', binding) generate_bindings_downcast_plugins(filename, binding) fail = compare_code('local-downcast-plugins-{0}'.format(name), @@ -159,6 +209,13 @@ def run_plugin_test(name, binding, ext): def run_swig_test(name, binding, ext): + """ + Run a test. TODO Sarah please expand... + + :param name: package name + :param binding: the required binding, e.g. 'csharp', 'java', etc. + :param ext: the file extension + """ filename = test_functions.set_up_test(name, 'native', binding) generate_bindings_downcast_pkgs(filename, binding, True) fail = compare_code('{0}-package'.format(name), binding, ext) @@ -171,22 +228,27 @@ def run_swig_test(name, binding, ext): def main(): - # set up the enivornment + # Set up the environment. this_dir = os.path.dirname(os.path.abspath(__file__)) - (path_to_tests, other) = os.path.split(this_dir) + (path_to_tests, _) = os.path.split(this_dir) test_functions.set_path_to_tests(path_to_tests) if not os.path.isdir('temp'): os.mkdir('temp') fail = 0 - runall = True -# runall = False - if runall: + run_all = True + + if run_all: # run the individual tests + # Using pytest parameterization would be good here. + name = 'spatial' test_case = 'csharp' ext = 'i' + # my_tuple = ('spatial', 'csharp', 'i') + # fail += run_test(my_tuple[0], my_tuple[1], my_tuple[2]) + # fail += run_test(name=my_tuple[0], binding=my_tuple[1], ext=my_tuple[2]) fail += run_test(name, test_case, ext) name = 'spatial' @@ -314,9 +376,11 @@ def main(): name = 'test_vers' test_case = 'java' ext = 'i' -# fail += run_test(name, test_case, ext) + # TODO Why are two of these tests commented out here? + # They didn't raise any errors when I tried running them. + # fail += run_test(name, test_case, ext) fail += run_ns_test(name, test_case, ext) -# fail += run_pkgs_test(name, test_case, ext) + # fail += run_pkgs_test(name, test_case, ext) test_functions.report('BINDINGS', fail, fails, not_tested) return fail From 503e097e48f62a5a3ef6b8e9dab9478d6151fdab Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Tue, 5 Jan 2021 12:35:04 +0000 Subject: [PATCH 25/63] Added more text and TODO statements. --- .../test_binding_code/run_bindings_tests.py | 28 +++++++++++++------ generator/tests/test_functions.py | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/generator/tests/test_binding_code/run_bindings_tests.py b/generator/tests/test_binding_code/run_bindings_tests.py index 2cef6455..2047b3e3 100644 --- a/generator/tests/test_binding_code/run_bindings_tests.py +++ b/generator/tests/test_binding_code/run_bindings_tests.py @@ -43,7 +43,7 @@ def set_up(filename, binding): def generate_bindings_downcast_ext(filename, binding): """ - Generate a downcast extension. + Generate a downcast extension. TODO such as? """ all_files = set_up(filename, binding) all_files.write_downcast_extension() @@ -52,7 +52,7 @@ def generate_bindings_downcast_ext(filename, binding): def generate_bindings_downcast_ns(filename, binding): """ - Generate a downcast namespace. + Generate a downcast namespace. TODO such as? """ all_files = set_up(filename, binding) all_files.write_downcast_namespace() @@ -61,7 +61,11 @@ def generate_bindings_downcast_ns(filename, binding): def generate_bindings_downcast_pkgs(filename, binding, local): """ - Generate a downcast package. + Generate a downcast package. TODO such as? + + :param filename: + :param binding: + :param local: """ all_files = set_up(filename, binding) if binding == 'swig': @@ -75,7 +79,7 @@ def generate_bindings_downcast_pkgs(filename, binding, local): def generate_bindings_downcast_plugins(filename, binding): """ - Generate a downcast plugin. + Generate a downcast plugin. TODO such as? """ all_files = set_up(filename, binding) all_files.write_downcast_plugins() @@ -119,6 +123,7 @@ def run_ns_test(name, binding, ext): :param name: package name :param binding: the required binding, e.g. 'csharp', 'java', etc. :param ext: the file extension + :return: 0 on success or missing file, 1 on failure. """ filename = test_functions.set_up_test(name, 'downcast-ns', binding) generate_bindings_downcast_ns(filename, binding) @@ -140,6 +145,7 @@ def run_test(name, binding, ext): :param name: package name :param binding: the required binding, e.g. 'csharp', 'java', etc. :param ext: the file extension + :return: 0 on success or missing file, 1 on failure. """ filename = test_functions.set_up_test(name, 'downcast-ext', binding) generate_bindings_downcast_ext(filename, binding) @@ -153,11 +159,12 @@ def run_test(name, binding, ext): def run_pkgs_test(name, binding, ext): """ - Run a test. TODO Sarah please expand... + Run a pkgs test. TODO Sarah please expand... :param name: package name :param binding: the required binding, e.g. 'csharp', 'java', etc. :param ext: the file extension + :return: 0 on success or missing file, 1 on failure. """ filename = test_functions.set_up_test(name, 'downcast-packages', binding) generate_bindings_downcast_pkgs(filename, binding, False) @@ -174,12 +181,13 @@ def run_pkgs_test(name, binding, ext): def run_local_test(name, binding, ext, local): """ - Run a test. TODO Sarah please expand... + Run a local test. TODO Sarah please expand... :param name: package name :param binding: the required binding, e.g. 'csharp', 'java', etc. :param ext: the file extension :param local: TODO Sarah please expand... + :return: 0 on success or missing file, 1 on failure. """ filename = test_functions.set_up_test(name, 'local', binding) generate_bindings_downcast_pkgs(filename, binding, local) @@ -194,11 +202,12 @@ def run_local_test(name, binding, ext, local): def run_plugin_test(name, binding, ext): """ - Run a test. TODO Sarah please expand... + Run a plugin test. TODO Sarah please expand... :param name: package name :param binding: the required binding, e.g. 'csharp', 'java', etc. :param ext: the file extension + :return: 0 on success or missing file, 1 on failure. """ filename = test_functions.set_up_test(name, 'downcast-plugins', binding) generate_bindings_downcast_plugins(filename, binding) @@ -210,11 +219,12 @@ def run_plugin_test(name, binding, ext): def run_swig_test(name, binding, ext): """ - Run a test. TODO Sarah please expand... + Run a SWIG test. TODO Sarah please expand... :param name: package name :param binding: the required binding, e.g. 'csharp', 'java', etc. :param ext: the file extension + :return: 0 on success or missing file, 1 on failure. """ filename = test_functions.set_up_test(name, 'native', binding) generate_bindings_downcast_pkgs(filename, binding, True) @@ -241,7 +251,7 @@ def main(): if run_all: # run the individual tests - # Using pytest parameterization would be good here. + # TODO Using pytest parameterization would be good here. name = 'spatial' test_case = 'csharp' diff --git a/generator/tests/test_functions.py b/generator/tests/test_functions.py index 86fc1b38..0fa567f4 100644 --- a/generator/tests/test_functions.py +++ b/generator/tests/test_functions.py @@ -76,7 +76,7 @@ def compare_files(infile, outfile, fails, not_tested): :param outfile: file generated during tests :param fails: list of failure cases :param not_tested: list of untested cases - :returns: 0 on success, or file not present; 1 on failure. TODO if file is not present, isn't that a failure? + :returns: 0 on success, or file not present; 1 on failure. """ ret = 0 if not os.path.isfile(infile): From c546a4947ca68bc49a8dfcf26ba80da43d840726 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 09:54:37 +0000 Subject: [PATCH 26/63] Used os.path.normpath() for portability. --- .../tests/test_cmake_code/run_cmake_tests.py | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/generator/tests/test_cmake_code/run_cmake_tests.py b/generator/tests/test_cmake_code/run_cmake_tests.py index a70e2506..fadeadcf 100644 --- a/generator/tests/test_cmake_code/run_cmake_tests.py +++ b/generator/tests/test_cmake_code/run_cmake_tests.py @@ -23,36 +23,44 @@ def generate_cmake_files(filename): + """ + Generic set-up code used by the test wrapper function. + Parse XML file and use the big dictionary structure obtained to + generate the CMake package files. + + :param filename: the XML file to parse + :return: nothing + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() - os.chdir('./temp') + os.chdir(os.path.normpath('./temp')) if not os.path.exists('src'): os.mkdir('src') all_files = CMakeFiles.CMakeFiles(ob, os.getcwd(), True) all_files.write_package_files() - os.chdir('../.') + os.chdir(os.path.normpath('../.')) def generate_cmake_register_files(filename): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() - os.chdir('./temp') + os.chdir(os.path.normpath('./temp')) all_files = CMakeFiles.CMakeFiles(ob, os.getcwd(), True) all_files.write_register_files() - os.chdir('../.') + os.chdir(os.path.normpath('../.')) def generate_cmake_example_files(filename, name): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() - os.chdir('./temp') + os.chdir(os.path.normpath('./temp')) if not os.path.exists('examples'): os.mkdir('examples') - os.mkdir('examples/c++') - os.mkdir('examples/c++/{0}'.format(name)) + os.mkdir(os.path.normpath('examples/c++')) + os.mkdir(os.path.normpath('examples/c++/{0}'.format(name))) os.chdir('examples') all_files = CMakeFiles.CMakeFiles(ob, os.getcwd(), True) all_files.write_example_files() - os.chdir('../../../../.') + os.chdir(os.path.normpath('../../../../.')) ############################################################################# @@ -65,35 +73,35 @@ def compare_files(correct_file, temp_file): def compare_cmake(name, is_src=False): if is_src: - correct_file = '.\\test-cmake\\{0}-package.cmake'.format(name) - temp_file = '.\\temp\\{0}-package.cmake'.format(name) + correct_file = os.path.normpath('./test-cmake/{0}-package.cmake'.format(name)) + temp_file = os.path.normpath('./temp/{0}-package.cmake'.format(name)) else: - correct_file = '.\\test-cmake\\{0}-package.cmake'.format(name) - temp_file = '.\\temp\\{0}-package.cmake'.format(name) + correct_file = os.path.normpath('./test-cmake/{0}-package.cmake'.format(name)) + temp_file = os.path.normpath('./temp/{0}-package.cmake'.format(name)) return compare_files(correct_file, temp_file) def compare_cmake_register(name, is_cxx=False): if is_cxx: - correct_file = '.\\test-cmake\\{0}-register.h'.format(name) - temp_file = '.\\temp\\{0}-register.h'.format(name) + correct_file = os.path.normpath('./test-cmake/{0}-register.h'.format(name)) + temp_file = os.path.normpath('./temp/{0}-register.h'.format(name)) else: - correct_file = '.\\test-cmake\\{0}-register.cxx'.format(name) - temp_file = '.\\temp\\{0}-register.cxx'.format(name) + correct_file = os.path.normpath('./test-cmake/{0}-register.cxx'.format(name)) + temp_file = os.path.normpath('./temp/{0}-register.cxx'.format(name)) return compare_files(correct_file, temp_file) def compare_cmake_example(name, is_txt=False): if is_txt and name=='spatial': - correct_file = '.\\test-cmake\\examples\\CMakeLists.txt' - temp_file = '.\\temp\\examples\\c++\\{0}\\CMakeLists.txt'.format(name) + correct_file = os.path.normpath('./test-cmake/examples/CMakeLists.txt') + temp_file = os.path.normpath('./temp/examples/c++/{0}/CMakeLists.txt'.format(name)) else: - correct_file = '.\\test-cmake\\examples\\{0}-package.cmake'.format(name) - temp_file = '.\\temp\\examples\\{0}-package.cmake'.format(name) + correct_file = os.path.normpath('./test-cmake/examples/{0}-package.cmake'.format(name)) + temp_file = os.path.normpath('./temp/examples/{0}-package.cmake'.format(name)) return compare_files(correct_file, temp_file) def compare_examples(name): - correct_file = '.\\test-cmake\\examples\\c++\\{0}_example1.cpp'.format(name) - temp_file = '.\\temp\\examples\\c++\\{0}\\{0}_example1.cpp'.format(name) + correct_file = os.path.normpath('./test-cmake/examples/c++/{0}_example1.cpp'.format(name)) + temp_file = os.path.normpath('./temp/examples/c++/{0}/{0}_example1.cpp'.format(name)) return compare_files(correct_file, temp_file) ############################################################################# @@ -135,7 +143,7 @@ def run_example_test(name): def main(): - # set up the enivornment + # Set up the environment. this_dir = os.path.dirname(os.path.abspath(__file__)) (path_to_tests, other) = os.path.split(this_dir) @@ -144,7 +152,7 @@ def main(): os.mkdir('temp') fail = 0 - # run the individual tests + # Run the individual tests. TODO Consider using a pytest fixture. name = 'spatial' fail += run_cmake_test(name) From d17e0558402332156f2f3df970b422308baccf7e Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 10:45:04 +0000 Subject: [PATCH 27/63] Finished most of the basic documentation for run_cmake_tests.py. --- .../tests/test_cmake_code/run_cmake_tests.py | 81 ++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/generator/tests/test_cmake_code/run_cmake_tests.py b/generator/tests/test_cmake_code/run_cmake_tests.py index fadeadcf..913239cf 100644 --- a/generator/tests/test_cmake_code/run_cmake_tests.py +++ b/generator/tests/test_cmake_code/run_cmake_tests.py @@ -26,7 +26,7 @@ def generate_cmake_files(filename): """ Generic set-up code used by the test wrapper function. Parse XML file and use the big dictionary structure obtained to - generate the CMake package files. + generate the CMake `package` files. :param filename: the XML file to parse :return: nothing @@ -42,6 +42,14 @@ def generate_cmake_files(filename): def generate_cmake_register_files(filename): + """ + Generic set-up code used by the test wrapper function. + Parse XML file and use the big dictionary structure obtained to + generate the CMake `register` files. + + :param filename: the XML file to parse + :return: nothing + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir(os.path.normpath('./temp')) @@ -49,7 +57,17 @@ def generate_cmake_register_files(filename): all_files.write_register_files() os.chdir(os.path.normpath('../.')) + def generate_cmake_example_files(filename, name): + """ + Generic set-up code used by the test wrapper function. + Parse XML file and use the big dictionary structure obtained to + generate the CMake `example` files. + + :param filename: the XML file to parse + :param name: name of subdirectory to be created under examples/c++/ + :return: nothing + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir(os.path.normpath('./temp')) @@ -67,11 +85,28 @@ def generate_cmake_example_files(filename, name): # Specific compare functions def compare_files(correct_file, temp_file): + """ + Do a string comparison of the contents of two files. + + :param correct_file: reference file + :param temp_file: file generated during tests + :return: 0 on success, or file not present; 1 on failure. + """ return test_functions.compare_files(correct_file, temp_file, fails, not_tested) def compare_cmake(name, is_src=False): + """ + Do a string comparison of the contents of two files. + + TODO: the two cases checked by this function are identical! + Presumably a mistake? + + :param name: TODO + :param is_src: TODO + :return: 0 on success, or file not present; 1 on failure. + """ if is_src: correct_file = os.path.normpath('./test-cmake/{0}-package.cmake'.format(name)) temp_file = os.path.normpath('./temp/{0}-package.cmake'.format(name)) @@ -82,6 +117,13 @@ def compare_cmake(name, is_src=False): def compare_cmake_register(name, is_cxx=False): + """ + Compare two cmake 'register' files. + + :param name: first part of filename + :param is_cxx: Use True if a .cxx file, otherwise False + :return: 0 on success, or file not present; 1 on failure. + """ if is_cxx: correct_file = os.path.normpath('./test-cmake/{0}-register.h'.format(name)) temp_file = os.path.normpath('./temp/{0}-register.h'.format(name)) @@ -90,7 +132,16 @@ def compare_cmake_register(name, is_cxx=False): temp_file = os.path.normpath('./temp/{0}-register.cxx'.format(name)) return compare_files(correct_file, temp_file) + def compare_cmake_example(name, is_txt=False): + """ + Compare two cmake 'register' files. + + :param name: first part of filename, or directory name if + 'is_txt' is True and name is 'spatial' + :param is_txt: Use True if files end in .txt, otherwise False + :return: 0 on success, or file not present; 1 on failure. + """ if is_txt and name=='spatial': correct_file = os.path.normpath('./test-cmake/examples/CMakeLists.txt') temp_file = os.path.normpath('./temp/examples/c++/{0}/CMakeLists.txt'.format(name)) @@ -99,7 +150,14 @@ def compare_cmake_example(name, is_txt=False): temp_file = os.path.normpath('./temp/examples/{0}-package.cmake'.format(name)) return compare_files(correct_file, temp_file) + def compare_examples(name): + """ + Compare two 'example' files. + + :param name: first part of filename, and a subdir under temp/examples/c++/ + :return: 0 on success, or file not present; 1 on failure. + """ correct_file = os.path.normpath('./test-cmake/examples/c++/{0}_example1.cpp'.format(name)) temp_file = os.path.normpath('./temp/examples/c++/{0}/{0}_example1.cpp'.format(name)) return compare_files(correct_file, temp_file) @@ -109,6 +167,12 @@ def compare_examples(name): def run_cmake_test(name): + """ + General CMake test. + + :param name: stub of XML filename, e.g. 'dyn' for filename 'dyn.xml' + :return: 0 if all comparisons succeed, else number of failures. + """ filename = test_functions.set_up_test(name, 'CMake') generate_cmake_files(filename) fail = compare_cmake(name) @@ -118,6 +182,12 @@ def run_cmake_test(name): def run_register_test(name): + """ + CMake 'register' test. + + :param name: stub of XML filename, e.g. 'dyn' for filename 'dyn.xml' + :return: 0 if all comparisons succeed, else number of failures. + """ filename = test_functions.set_up_test(name, 'CMake', 'register') generate_cmake_register_files(filename) fail = compare_cmake_register(name) @@ -127,6 +197,12 @@ def run_register_test(name): def run_example_test(name): + """ + CMake 'example' test. + + :param name: stub of XML filename, e.g. 'dyn' for filename 'dyn.xml' + :return: 0 if all comparisons succeed, else number of failures. + """ filename = test_functions.set_up_test(name, 'CMake', 'example') generate_cmake_example_files(filename, name) fail = compare_cmake_example(name) @@ -142,6 +218,9 @@ def run_example_test(name): def main(): + """ + Main function. Set up and run all tests. + """ # Set up the environment. this_dir = os.path.dirname(os.path.abspath(__file__)) From a3c5485c86ab2f75a1589f539af93a041c40625f Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 10:48:35 +0000 Subject: [PATCH 28/63] Fixed some of the flake8 complaints. --- .../tests/test_cmake_code/run_cmake_tests.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/generator/tests/test_cmake_code/run_cmake_tests.py b/generator/tests/test_cmake_code/run_cmake_tests.py index 913239cf..b2f2e530 100644 --- a/generator/tests/test_cmake_code/run_cmake_tests.py +++ b/generator/tests/test_cmake_code/run_cmake_tests.py @@ -108,10 +108,12 @@ def compare_cmake(name, is_src=False): :return: 0 on success, or file not present; 1 on failure. """ if is_src: - correct_file = os.path.normpath('./test-cmake/{0}-package.cmake'.format(name)) + correct_file = os.path.normpath('./test-cmake/{0}-package.cmake'. + format(name)) temp_file = os.path.normpath('./temp/{0}-package.cmake'.format(name)) else: - correct_file = os.path.normpath('./test-cmake/{0}-package.cmake'.format(name)) + correct_file = os.path.normpath('./test-cmake/{0}-package.cmake'. + format(name)) temp_file = os.path.normpath('./temp/{0}-package.cmake'.format(name)) return compare_files(correct_file, temp_file) @@ -125,10 +127,12 @@ def compare_cmake_register(name, is_cxx=False): :return: 0 on success, or file not present; 1 on failure. """ if is_cxx: - correct_file = os.path.normpath('./test-cmake/{0}-register.h'.format(name)) + correct_file = os.path.normpath('./test-cmake/{0}-register.h'. + format(name)) temp_file = os.path.normpath('./temp/{0}-register.h'.format(name)) else: - correct_file = os.path.normpath('./test-cmake/{0}-register.cxx'.format(name)) + correct_file = os.path.normpath('./test-cmake/{0}-register.cxx'. + format(name)) temp_file = os.path.normpath('./temp/{0}-register.cxx'.format(name)) return compare_files(correct_file, temp_file) @@ -142,7 +146,7 @@ def compare_cmake_example(name, is_txt=False): :param is_txt: Use True if files end in .txt, otherwise False :return: 0 on success, or file not present; 1 on failure. """ - if is_txt and name=='spatial': + if is_txt and name == 'spatial': correct_file = os.path.normpath('./test-cmake/examples/CMakeLists.txt') temp_file = os.path.normpath('./temp/examples/c++/{0}/CMakeLists.txt'.format(name)) else: @@ -212,11 +216,9 @@ def run_example_test(name): return fail - ######################################################################### # Main function - def main(): """ Main function. Set up and run all tests. From abe41fbd941ba46b6168ba51bfc86745365fccd6 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 10:54:53 +0000 Subject: [PATCH 29/63] Added more os.path.normpath() statements. --- .../tests/test_binding_code/run_bindings_tests.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/generator/tests/test_binding_code/run_bindings_tests.py b/generator/tests/test_binding_code/run_bindings_tests.py index 2047b3e3..2de8ada8 100644 --- a/generator/tests/test_binding_code/run_bindings_tests.py +++ b/generator/tests/test_binding_code/run_bindings_tests.py @@ -31,7 +31,7 @@ def set_up(filename, binding): """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() - os.chdir('./temp') + os.chdir(os.path.normpath('./temp')) if os.path.isdir(binding): os.chdir(binding) else: @@ -47,7 +47,7 @@ def generate_bindings_downcast_ext(filename, binding): """ all_files = set_up(filename, binding) all_files.write_downcast_extension() - os.chdir('../..') + os.chdir(os.path.normpath('../..')) def generate_bindings_downcast_ns(filename, binding): @@ -56,7 +56,7 @@ def generate_bindings_downcast_ns(filename, binding): """ all_files = set_up(filename, binding) all_files.write_downcast_namespace() - os.chdir('../..') + os.chdir(os.path.normpath('../..')) def generate_bindings_downcast_pkgs(filename, binding, local): @@ -74,7 +74,7 @@ def generate_bindings_downcast_pkgs(filename, binding, local): all_files.write_local() else: all_files.write_downcast_packages() - os.chdir('../..') + os.chdir(os.path.normpath('../..')) def generate_bindings_downcast_plugins(filename, binding): @@ -83,7 +83,7 @@ def generate_bindings_downcast_plugins(filename, binding): """ all_files = set_up(filename, binding) all_files.write_downcast_plugins() - os.chdir('../..') + os.chdir(os.path.normpath('../..')) ############################################################################# # Specific compare functions @@ -108,7 +108,7 @@ def compare_ext_headers(class_name): TODO This function doesn't appear to be used anywhere. """ correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) - temp_file = ('./temp/{0}.h'.format(class_name)) + temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) return test_functions.compare_files(correct_file, temp_file, fails, not_tested) From da46fb9a48cfd2e42500c708582813d2db3b183b Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 11:20:47 +0000 Subject: [PATCH 30/63] Added more os.path.normpath() statements to run_examples_tests.py, but I'm not sure if these particular ones are necessary. --- generator/tests/test_examples/run_examples_tests.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/generator/tests/test_examples/run_examples_tests.py b/generator/tests/test_examples/run_examples_tests.py index f3e94493..cf7571f9 100644 --- a/generator/tests/test_examples/run_examples_tests.py +++ b/generator/tests/test_examples/run_examples_tests.py @@ -31,10 +31,10 @@ def set_up(filename): """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() - os.chdir('./temp') + os.chdir(os.path.normpath('./temp')) if not os.path.exists(ob['name']): os.mkdir(ob['name']) - os.chdir('./{0}'.format(ob['name'])) + os.chdir(os.path.normpath('./{0}'.format(ob['name']))) return ob @@ -48,7 +48,7 @@ def generate_example(filename): ob = set_up(filename) all_files = CppExampleFile.CppExampleFile(ob) all_files.write_file() - os.chdir('../../.') + os.chdir(os.path.normpath('../../.')) return ob['name'] @@ -62,7 +62,7 @@ def generate_xml(filename): ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_file('test_xml') - os.chdir('../../.') + os.chdir(os.path.normpath('../../.')) return ob['name'] @@ -76,7 +76,7 @@ def generate_xml_fails(filename): ob = set_up(filename) all_files = ValidationXMLFiles.ValidationXMLFiles(ob) all_files.write_all_files() - os.chdir('../../.') + os.chdir(os.path.normpath('../../.')) return ob['name'] @@ -97,7 +97,7 @@ def generate_some_xml_fails(filename, start, stop, number=-1): if number > -1: all_files.set_num_components(number) all_files.write_test_files(start, stop) - os.chdir('../../.') + os.chdir(os.path.normpath('../../.')) return ob['name'] ############################################################################# From 31ca25ce7b87e6240cf3818ac312c07541b7dff7 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 11:30:50 +0000 Subject: [PATCH 31/63] Added some os.path.normpath() statements to run_matlab_tests.py --- generator/tests/test_matlab/run_matlab_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/tests/test_matlab/run_matlab_tests.py b/generator/tests/test_matlab/run_matlab_tests.py index 5350fbeb..23ea1a4f 100644 --- a/generator/tests/test_matlab/run_matlab_tests.py +++ b/generator/tests/test_matlab/run_matlab_tests.py @@ -67,8 +67,8 @@ def compare_matlab(name, filetype): :return: 0 if files identical, 1 otherwise. """ assert filetype in filetypes - correct_file = '.\\test-matlab\\{0}{1}.m'.format(name, filetype) - temp_file = '.\\temp\\{0}{1}.m'.format(name, filetype) + correct_file = os.path.normpath('./test-matlab/{0}{1}.m'.format(name, filetype)) + temp_file = os.path.normpath('./temp/{0}{1}.m'.format(name, filetype)) return compare_files(correct_file, temp_file) From 57318357da357897e8ab332a49b13da5977ca28d Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 12:05:06 +0000 Subject: [PATCH 32/63] Added os.path.normpath() statements to run_cpp_tests.py --- .../tests/test_cpp_code/run_cpp_tests.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index 991b479c..25c5c54c 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -104,30 +104,30 @@ def compare_files(correct_file, temp_file): def compare_code_headers(class_name): - correct_file = '.\\test-code\\{0}.h'.format(class_name) - temp_file = '.\\temp\\{0}.h'.format(class_name) + correct_file = os.path.normpath('./test-code/{0}.h'.format(class_name)) + temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) return compare_files(correct_file, temp_file) def compare_ext_headers(class_name): - correct_file = '.\\test-extension\\{0}.h'.format(class_name) - temp_file = '.\\temp\\{0}.h'.format(class_name) + correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) + temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) return compare_files(correct_file, temp_file) def compare_code_impl(class_name): - correct_file = '.\\test-code\\{0}.cpp'.format(class_name) - temp_file = '.\\temp\\{0}.cpp'.format(class_name) + correct_file = os.path.normpath('./test-code/{0}.cpp'.format(class_name)) + temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) return compare_files(correct_file, temp_file) def compare_ext_impl(class_name, declared=False): if declared: - correct_file = '.\\test-extension\\{0}Declared.cxx'.format(class_name) - temp_file = '.\\temp\\{0}Declared.cxx'.format(class_name) + correct_file = os.path.normpath('./test-extension/{0}Declared.cxx'.format(class_name)) + temp_file = os.path.normpath('./temp/{0}Declared.cxx'.format(class_name)) else: - correct_file = '.\\test-extension\\{0}.cpp'.format(class_name) - temp_file = '.\\temp\\{0}.cpp'.format(class_name) + correct_file = os.path.normpath('./test-extension/{0}.cpp'.format(class_name)) + temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) return compare_files(correct_file, temp_file) From 57f005cb35893bc9d29e1b1c1f437c97767da329 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 12:33:46 +0000 Subject: [PATCH 33/63] Moving always-run tests to beginning of test set. --- .../tests/test_cpp_code/run_cpp_tests.py | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index 25c5c54c..6bab4fdb 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -199,8 +199,14 @@ def run_constraints_test(name, class_name, test_case): def main(): + + # TODO Currently, nearly all tests are failing on Python 2 (on Linux) + # Only AnalyticVolume and Arc pass. + # But previously, the files were just being skipped anyway. + + runall = True - # runall = False + # runall = False this_dir = os.path.dirname(os.path.abspath(__file__)) (path_to_tests, other) = os.path.split(this_dir) test_functions.set_path_to_tests(path_to_tests) @@ -208,6 +214,24 @@ def main(): os.mkdir('temp') fail = 0 + # Run the next couple of tests always: + + # TODO This test is currently failing. + name = 'copy' + num = 0 + class_name = 'Def' + list_of = '' + test_case = 'class with XMLNode' + fail += run_test(name, num, class_name, test_case, list_of) + + # name = 'copy_add' + # num = 0 + # class_name = 'Abc' + # list_of = '' + # test_case = 'class with additional code' + # fail += run_test(name, num, class_name, test_case, list_of) + + if runall: # run the individual tests name = 'test_att' @@ -822,20 +846,6 @@ def main(): test_case = 'versions of plugins - elements' fail += run_plug_test(name, class_name, test_case, num) - # name = 'copy_add' - # num = 0 - # class_name = 'Abc' - # list_of = '' - # test_case = 'class with additional code' - # fail += run_test(name, num, class_name, test_case, list_of) - - name = 'copy' - num = 0 - class_name = 'Def' - list_of = '' - test_case = 'class with XMLNode' - fail += run_test(name, num, class_name, test_case, list_of) - name = 'twoAtOnce' num = 0 class_name = 'TwoatonceSBasePlugin' @@ -1011,19 +1021,8 @@ def main(): # test_case = 'validator' # fail += run_valid_test(name, class_name, test_case, False) else: - # name = 'copy_add' - # num = 0 - # class_name = 'Abc' - # list_of = '' - # test_case = 'class with additional code' - # fail += run_test(name, num, class_name, test_case, list_of) + pass - name = 'copy' - num = 0 - class_name = 'Def' - list_of = '' - test_case = 'class with XMLNode' - fail += run_test(name, num, class_name, test_case, list_of) test_functions.report('CPP', fail, fails, not_tested) return fail From 3a81c58b57c0a15e87dc78db03023ed766961ae1 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 12:58:36 +0000 Subject: [PATCH 34/63] Abstracted some common code into generate_generic_header(). --- .../tests/test_cpp_code/run_cpp_tests.py | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index 6bab4fdb..2bee541f 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -22,6 +22,12 @@ def generate_new_cpp_header(filename, num): + """ + + :param filename: name of XML file to parse. + :param num: + :return: nothing + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() working_class = ob['baseElements'][num] @@ -31,39 +37,37 @@ def generate_new_cpp_header(filename, num): os.chdir('../.') -def generate_extension_header(filename): +def generate_generic_header(filename, package): + """ + Parse XML file and create files with specified package. + + :param filename: XML file to parse. + :param package: required package, e.g. 'types', 'fwd' or '' + :return: nothing. + """ parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') - all_files = ExtensionFiles.ExtensionFiles(ob, '', True) + all_files = ExtensionFiles.ExtensionFiles(ob, package, True) all_files.write_files() os.chdir('../.') -def generate_types_header(filename): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - all_files = ExtensionFiles.ExtensionFiles(ob, 'types', True) - all_files.write_files() - os.chdir('../.') +def generate_extension_header(filename): + generate_generic_header(filename, '') +def generate_types_header(filename): + generate_generic_header(filename, 'types') def generate_fwd_header(filename): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') - all_files = ExtensionFiles.ExtensionFiles(ob, 'fwd', True) - all_files.write_files() - os.chdir('../.') - + generate_generic_header(filename, 'fwd') def generate_plugin_header(filename, num): parser = ParseXML.ParseXML(filename) ob = parser.parse_deviser_xml() os.chdir('./temp') all_files = ExtensionFiles.ExtensionFiles(ob, '', True) - all_files.write_plugin_files(num) + all_files.write_plugin_files(num) # NB this line is different to above functions. os.chdir('../.') @@ -202,7 +206,7 @@ def main(): # TODO Currently, nearly all tests are failing on Python 2 (on Linux) # Only AnalyticVolume and Arc pass. - # But previously, the files were just being skipped anyway. + # But previously, the files were just being skipped (on Linux) anyway. runall = True From a39cf9fbe2e1bfc2255f0f9e9416b5ef1c105ca0 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 14:01:28 +0000 Subject: [PATCH 35/63] Extracted common code into common_setup(). --- .../tests/test_cpp_code/run_cpp_tests.py | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index 2bee541f..c02c8af0 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -20,18 +20,29 @@ ############################################################################## # Specific generation functions +def common_setup(filename): + """ + Generic set-up code. Parse XML file and go into ./temp. + + :param filename: XML file to parse + :return: the big dictionary structure generated from the XML. + """ + parser = ParseXML.ParseXML(filename) + ob = parser.parse_deviser_xml() + os.chdir('./temp') + return ob + def generate_new_cpp_header(filename, num): """ + Generate cpp files. :param filename: name of XML file to parse. :param num: :return: nothing """ - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() + ob = common_setup(filename) working_class = ob['baseElements'][num] - os.chdir('./temp') all_files = CppFiles.CppFiles(working_class, True) all_files.write_files() os.chdir('../.') @@ -39,15 +50,13 @@ def generate_new_cpp_header(filename, num): def generate_generic_header(filename, package): """ - Parse XML file and create files with specified package. + Generate Extension files with specified package. :param filename: XML file to parse. :param package: required package, e.g. 'types', 'fwd' or '' :return: nothing. """ - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') + ob = common_setup(filename) all_files = ExtensionFiles.ExtensionFiles(ob, package, True) all_files.write_files() os.chdir('../.') @@ -63,18 +72,14 @@ def generate_fwd_header(filename): generate_generic_header(filename, 'fwd') def generate_plugin_header(filename, num): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') + ob = common_setup(filename) all_files = ExtensionFiles.ExtensionFiles(ob, '', True) all_files.write_plugin_files(num) # NB this line is different to above functions. os.chdir('../.') def generate_error_header(filename): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') + ob = common_setup(filename) all_files = ValidationFiles.ValidationFiles(ob, True) all_files.write_error_header() all_files.write_error_table_header() @@ -82,18 +87,14 @@ def generate_error_header(filename): def generate_validator(filename): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') + ob = common_setup(filename) all_files = ValidationFiles.ValidationFiles(ob, True) all_files.write_validator_files() os.chdir('../.') def generate_constraints(filename): - parser = ParseXML.ParseXML(filename) - ob = parser.parse_deviser_xml() - os.chdir('./temp') + ob = common_setup(filename) all_files = ValidationFiles.ValidationFiles(ob, True) all_files.write_constraints() os.chdir('../.') From 5e215b922fc6b2fc573c3eea8a410e6ecf4429ad Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 14:35:22 +0000 Subject: [PATCH 36/63] More function documenting in run_cpp_tests.py --- .../tests/test_cpp_code/run_cpp_tests.py | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index c02c8af0..4527691a 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -38,7 +38,9 @@ def generate_new_cpp_header(filename, num): Generate cpp files. :param filename: name of XML file to parse. - :param num: + :param num: TODO seems to be index of item in list which is the value + (in the big dictionary structure) for the key 'baseElements'. + But I don't fully understand this. :return: nothing """ ob = common_setup(filename) @@ -65,20 +67,36 @@ def generate_generic_header(filename, package): def generate_extension_header(filename): generate_generic_header(filename, '') + def generate_types_header(filename): generate_generic_header(filename, 'types') + def generate_fwd_header(filename): generate_generic_header(filename, 'fwd') + def generate_plugin_header(filename, num): + """ + Generate plugin files. + + :param filename: XML file to parse. + :param num: plugin #. + :return: nothing. + """ ob = common_setup(filename) all_files = ExtensionFiles.ExtensionFiles(ob, '', True) - all_files.write_plugin_files(num) # NB this line is different to above functions. + all_files.write_plugin_files(num) os.chdir('../.') def generate_error_header(filename): + """ + Generate error header files. + + :param filename: XML file to parse + :return: nothing + """ ob = common_setup(filename) all_files = ValidationFiles.ValidationFiles(ob, True) all_files.write_error_header() @@ -87,6 +105,12 @@ def generate_error_header(filename): def generate_validator(filename): + """ + Generate the set of Validation files. + + :param filename: XML file to parse. + :return: nothing + """ ob = common_setup(filename) all_files = ValidationFiles.ValidationFiles(ob, True) all_files.write_validator_files() @@ -94,6 +118,12 @@ def generate_validator(filename): def generate_constraints(filename): + """ + Generate the 'constraints' files. + + :param filename: XML file to parse + :return: nothing. + """ ob = common_setup(filename) all_files = ValidationFiles.ValidationFiles(ob, True) all_files.write_constraints() @@ -108,6 +138,7 @@ def compare_files(correct_file, temp_file): not_tested) + def compare_code_headers(class_name): correct_file = os.path.normpath('./test-code/{0}.h'.format(class_name)) temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) From d2461db4909641fba77ab929dc10e8c7b9de4669 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 14:48:41 +0000 Subject: [PATCH 37/63] Moving common code into new version of compare_files(). --- .../tests/test_cpp_code/run_cpp_tests.py | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index 4527691a..415bb942 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -133,39 +133,48 @@ def generate_constraints(filename): ############################################################################# # Specific compare functions -def compare_files(correct_file, temp_file): +#def compare_files(correct_file, temp_file): +# return test_functions.compare_files(correct_file, temp_file, fails, +# not_tested) + +def compare_files(folder, class_name, file_extension): + correct_file = os.path.normpath('./{0}/{1}{2}'.format(folder, class_name, file_extension)) + temp_file = os.path.normpath('./temp/{0}{1}'.format(class_name, file_extension)) return test_functions.compare_files(correct_file, temp_file, fails, not_tested) - - def compare_code_headers(class_name): - correct_file = os.path.normpath('./test-code/{0}.h'.format(class_name)) - temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) - return compare_files(correct_file, temp_file) + #correct_file = os.path.normpath('./test-code/{0}.h'.format(class_name)) + #temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) + #return compare_files(correct_file, temp_file) + return compare_files('test-code', class_name, '.h') def compare_ext_headers(class_name): - correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) - temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) - return compare_files(correct_file, temp_file) + #correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) + #temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) + #return compare_files(correct_file, temp_file) + return compare_files('test-extension', class_name, '.h') def compare_code_impl(class_name): - correct_file = os.path.normpath('./test-code/{0}.cpp'.format(class_name)) - temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) - return compare_files(correct_file, temp_file) + #correct_file = os.path.normpath('./test-code/{0}.cpp'.format(class_name)) + #temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) + #return compare_files(correct_file, temp_file) + return compare_files('test-code', class_name, '.cpp') def compare_ext_impl(class_name, declared=False): if declared: - correct_file = os.path.normpath('./test-extension/{0}Declared.cxx'.format(class_name)) - temp_file = os.path.normpath('./temp/{0}Declared.cxx'.format(class_name)) + #correct_file = os.path.normpath('./test-extension/{0}Declared.cxx'.format(class_name)) + #temp_file = os.path.normpath('./temp/{0}Declared.cxx'.format(class_name)) + ending = 'Declared.cxx' else: - correct_file = os.path.normpath('./test-extension/{0}.cpp'.format(class_name)) - temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) - return compare_files(correct_file, temp_file) - + ending = '.cpp' + #correct_file = os.path.normpath('./test-extension/{0}.cpp'.format(class_name)) + #temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) + #return compare_files(correct_file, temp_file) + return compare_files('test-extension', class_name, ending) ############################################################################# # Specific test functions From 36fc3678c932598a9077c4ecfdbbf1b8efe56616 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 15:16:59 +0000 Subject: [PATCH 38/63] Added more documentation to the comparison functions. --- .../tests/test_cpp_code/run_cpp_tests.py | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index 415bb942..6c30b117 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -133,47 +133,50 @@ def generate_constraints(filename): ############################################################################# # Specific compare functions -#def compare_files(correct_file, temp_file): -# return test_functions.compare_files(correct_file, temp_file, fails, -# not_tested) +def compare_files(folder, class_name, file_ending): + """ + Generic function for comparing a reference file with a test one. -def compare_files(folder, class_name, file_extension): - correct_file = os.path.normpath('./{0}/{1}{2}'.format(folder, class_name, file_extension)) - temp_file = os.path.normpath('./temp/{0}{1}'.format(class_name, file_extension)) + :param folder: directory (e.g. 'test-code', 'test-extension') housing reference file. + :param class_name: C++ class name, and stub of .cpp and .h files in test-code/ and test-extension/. + :param file_ending: end of file name, e.g. '.h', '.cpp', 'Declared.cxx' + :returns: 0 on success, or file not present; 1 on failure. + """ + correct_file = os.path.normpath('./{0}/{1}{2}'.format(folder, class_name, file_ending)) + temp_file = os.path.normpath('./temp/{0}{1}'.format(class_name, file_ending)) return test_functions.compare_files(correct_file, temp_file, fails, not_tested) + def compare_code_headers(class_name): - #correct_file = os.path.normpath('./test-code/{0}.h'.format(class_name)) - #temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) - #return compare_files(correct_file, temp_file) + """ + Wrapper to help compare two code header files. + """ return compare_files('test-code', class_name, '.h') def compare_ext_headers(class_name): - #correct_file = os.path.normpath('./test-extension/{0}.h'.format(class_name)) - #temp_file = os.path.normpath('./temp/{0}.h'.format(class_name)) - #return compare_files(correct_file, temp_file) + """ + Wrapper to help compare two extension header files. + """ return compare_files('test-extension', class_name, '.h') def compare_code_impl(class_name): - #correct_file = os.path.normpath('./test-code/{0}.cpp'.format(class_name)) - #temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) - #return compare_files(correct_file, temp_file) + """ + Wrapper to help compare two code implementation files. + """ return compare_files('test-code', class_name, '.cpp') def compare_ext_impl(class_name, declared=False): + """ + Wrapper to help compare two extension implementation files. + """ if declared: - #correct_file = os.path.normpath('./test-extension/{0}Declared.cxx'.format(class_name)) - #temp_file = os.path.normpath('./temp/{0}Declared.cxx'.format(class_name)) - ending = 'Declared.cxx' + ending = 'Declared.cxx' else: ending = '.cpp' - #correct_file = os.path.normpath('./test-extension/{0}.cpp'.format(class_name)) - #temp_file = os.path.normpath('./temp/{0}.cpp'.format(class_name)) - #return compare_files(correct_file, temp_file) return compare_files('test-extension', class_name, ending) ############################################################################# From edbd39d49e16906f24255365c2c6999a2cf3ec80 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 16:05:41 +0000 Subject: [PATCH 39/63] Added docs to the test runner functions. --- .../tests/test_cpp_code/run_cpp_tests.py | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/generator/tests/test_cpp_code/run_cpp_tests.py b/generator/tests/test_cpp_code/run_cpp_tests.py index 6c30b117..c2a5dfd4 100644 --- a/generator/tests/test_cpp_code/run_cpp_tests.py +++ b/generator/tests/test_cpp_code/run_cpp_tests.py @@ -183,6 +183,16 @@ def compare_ext_impl(class_name, declared=False): # Specific test functions def run_test(name, num, class_name, test_case, list_of): + """ + Most commonly-used test function. + + :param name: which set of tests this relates to. e.g. 'test_att' + :param num: index??? TODO please Sarah. + :param class_name: C++ class name/start of .h and .cpp file names. + :param test_case: brief description, e.g. 'all types attributes required' + :param list_of: e.g. 'ListOfFunctionTerms'. Can be ''. + :return: number of test failures. + """ filename = test_functions.set_up_test(name, class_name, test_case) generate_new_cpp_header(filename, num) fail = compare_code_headers(class_name) @@ -196,6 +206,15 @@ def run_test(name, num, class_name, test_case, list_of): def run_ext_test(name, class_name, test_case, test): + """ + Run an 'extension' test. + + :param name: which set of tests this relates to, e.g. 'qual' + :param class_name: C++ class name/start of .h and .cpp file names, e.g. 'QualExtension'. + :param test_case: brief description, e.g. 'basic extension file' + :param test: integer specifying which type of header file to generate. + :return: number of failed tests + """ filename = test_functions.set_up_test(name, class_name, test_case) if test == 0: generate_extension_header(filename) @@ -211,6 +230,15 @@ def run_ext_test(name, class_name, test_case, test): def run_plug_test(name, class_name, test_case, num): + """ + Run a 'plugin' test. + + :param name: which set of tests this relates to, e.g. 'qual' + :param class_name: C++ class name/start of .h and .cpp file names, e.g. 'QualModelPlugin' + :param test_case: brief description, e.g. 'basic plugin' + :param num: plugin #. TODO I'm not too sure about this. Please can we have an example? + :return: number of failed tests. + """ filename = test_functions.set_up_test(name, class_name, test_case) generate_plugin_header(filename, num) fail = compare_ext_headers(class_name) @@ -220,6 +248,15 @@ def run_plug_test(name, class_name, test_case, num): def run_valid_test(name, class_name, test_case, is_ext=True): + """ + Run a 'validation' test. + + :param name: which set of tests this relates to, e.g. 'test_att' + :param class_name: C++ class name/start of .h and .cpp file names, e.g. 'TestSBMLError' + :param test_case: brief description, e.g. 'error enumeration' + :param is_ext: determines which file to generate. TODO please amend this, Sarah. Thanks. + :return: number of failed tests. + """ filename = test_functions.set_up_test(name, class_name, test_case) if is_ext: generate_error_header(filename) @@ -234,6 +271,14 @@ def run_valid_test(name, class_name, test_case, is_ext=True): def run_constraints_test(name, class_name, test_case): + """ + Run a 'constraints' test. + + :param name: which set of tests this relates to, e.g. 'spatial' + :param class_name: C++ class name/start of .h and .cpp file names, e.g. 'SpatialConsistencyConstraints' + :param test_case: brief description, e.g. 'constraints' + :return: number of failed tests + """ filename = test_functions.set_up_test(name, class_name, test_case) generate_constraints(filename) fail = compare_ext_impl(class_name) @@ -250,7 +295,7 @@ def main(): # TODO Currently, nearly all tests are failing on Python 2 (on Linux) # Only AnalyticVolume and Arc pass. - # But previously, the files were just being skipped (on Linux) anyway. + # But previously, the tests were just being skipped (on Linux) anyway. runall = True @@ -326,7 +371,7 @@ def main(): name = 'test_att' class_name = 'TestSBMLError' - test_case = 'error enumeration ' + test_case = 'error enumeration' fail += run_valid_test(name, class_name, test_case) name = 'qual' From 56315bfcb3889e8f35b0bdfa843aa0873a29ee36 Mon Sep 17 00:00:00 2001 From: Matthew Gillman Date: Wed, 6 Jan 2021 17:12:17 +0000 Subject: [PATCH 40/63] Ran all cpp test files through dos2unix so python 2 tests will succeed. --- .../test-code/AnalyticVolume.cpp | 3170 +++--- .../tests/test_cpp_code/test-code/Arc.cpp | 5478 ++++----- .../test_cpp_code/test-code/ArrayChild.cpp | 2492 ++--- .../test_cpp_code/test-code/ArrayChild.h | 2072 ++-- .../test_cpp_code/test-code/Association.cpp | 1168 +- .../test_cpp_code/test-code/Association.h | 1388 +-- .../tests/test_cpp_code/test-code/BBB.cpp | 2772 ++--- generator/tests/test_cpp_code/test-code/BBB.h | 2618 ++--- .../test-code/BernoulliDistribution.cpp | 2266 ++-- .../test-code/BernoulliDistribution.h | 1942 ++-- .../test-code/BetaDistribution.cpp | 2806 ++--- .../test-code/BetaDistribution.h | 2206 ++-- .../test-code/BinomialDistribution.cpp | 2884 ++--- .../test-code/BinomialDistribution.h | 2280 ++-- .../test_cpp_code/test-code/Boundary.cpp | 1846 ++-- .../tests/test_cpp_code/test-code/Boundary.h | 1710 +-- .../tests/test_cpp_code/test-code/CSGNode.cpp | 1952 ++-- .../tests/test_cpp_code/test-code/CSGNode.h | 2028 ++-- .../test_cpp_code/test-code/CSGObject.cpp | 3902 +++---- .../tests/test_cpp_code/test-code/CSGObject.h | 2864 ++--- .../test-code/CSGSetOperator.cpp | 4000 +++---- .../test_cpp_code/test-code/CSGSetOperator.h | 3722 +++---- .../test-code/CSGTransformation.cpp | 3050 ++--- .../test-code/CSGTransformation.h | 2406 ++-- .../test_cpp_code/test-code/CSGeometry.cpp | 2320 ++-- .../test_cpp_code/test-code/CSGeometry.h | 2478 ++--- .../test-code/CategoricalDistribution.cpp | 2250 ++-- .../test-code/CategoricalDistribution.h | 2224 ++-- .../test_cpp_code/test-code/Category.cpp | 3118 +++--- .../tests/test_cpp_code/test-code/Category.h | 2408 ++-- .../tests/test_cpp_code/test-code/Child.cpp | 936 +- .../tests/test_cpp_code/test-code/Child.h | 1084 +- .../test_cpp_code/test-code/ClassOne.cpp | 2400 ++-- .../tests/test_cpp_code/test-code/ClassOne.h | 1986 ++-- .../test_cpp_code/test-code/ClassOneTwo.cpp | 4814 ++++---- .../test_cpp_code/test-code/ClassOneTwo.h | 3468 +++--- .../test_cpp_code/test-code/ClassThree.cpp | 3334 +++--- .../test_cpp_code/test-code/ClassThree.h | 3500 +++--- .../test_cpp_code/test-code/ClassTwo.cpp | 936 +- .../tests/test_cpp_code/test-code/ClassTwo.h | 1090 +- .../test-code/ClassWithRequiredID.cpp | 2060 ++-- .../test-code/ClassWithRequiredID.h | 1824 +-- .../test_cpp_code/test-code/Compartment.cpp | 3432 +++--- .../test_cpp_code/test-code/Compartment.h | 2784 ++--- .../test_cpp_code/test-code/Constraint.cpp | 1606 +-- .../test_cpp_code/test-code/Constraint.h | 1586 +-- .../test_cpp_code/test-code/Container.cpp | 1990 ++-- .../tests/test_cpp_code/test-code/Container.h | 2178 ++-- .../test_cpp_code/test-code/ContainerX.cpp | 1980 ++-- .../test_cpp_code/test-code/ContainerX.h | 2162 ++-- .../test-code/CoordinateComponent.cpp | 4006 +++---- .../test-code/CoordinateComponent.h | 3224 +++--- .../test_cpp_code/test-code/Copyright.cpp | 1446 +-- .../tests/test_cpp_code/test-code/Copyright.h | 1458 +-- .../tests/test_cpp_code/test-code/Def.cpp | 1866 ++-- generator/tests/test_cpp_code/test-code/Def.h | 1750 +-- .../test_cpp_code/test-code/DefaultValues.cpp | 2832 ++--- .../test_cpp_code/test-code/DefaultValues.h | 2300 ++-- .../DiscreteUnivariateDistribution.cpp | 3086 +++--- .../DiscreteUnivariateDistribution.h | 2482 ++--- .../test_cpp_code/test-code/Distribution.cpp | 1788 +-- .../test_cpp_code/test-code/Distribution.h | 2246 ++-- .../test-code/DrawFromDistribution.cpp | 3954 +++---- .../test-code/DrawFromDistribution.h | 3110 +++--- .../tests/test_cpp_code/test-code/Event.cpp | 4144 +++---- .../tests/test_cpp_code/test-code/Event.h | 3400 +++--- .../test-code/ExponentialDistribution.cpp | 2274 ++-- .../test-code/ExponentialDistribution.h | 1950 ++-- .../test-code/ExternalParameter.cpp | 2606 ++--- .../test-code/ExternalParameter.h | 2458 ++-- .../tests/test_cpp_code/test-code/FbcAnd.cpp | 2364 ++-- .../tests/test_cpp_code/test-code/FbcAnd.h | 2296 ++-- .../tests/test_cpp_code/test-code/Fred.cpp | 4902 ++++---- .../tests/test_cpp_code/test-code/Fred.h | 3720 +++---- .../test_cpp_code/test-code/FunctionTerm.cpp | 2082 ++-- .../test_cpp_code/test-code/FunctionTerm.h | 1858 ++-- .../test_cpp_code/test-code/Geometry.cpp | 6812 ++++++------ .../tests/test_cpp_code/test-code/Geometry.h | 7464 ++++++------- .../test-code/GeometryDefinition.cpp | 2280 ++-- .../test-code/GeometryDefinition.h | 2234 ++-- .../test_cpp_code/test-code/GradientStop.cpp | 2614 ++--- .../test_cpp_code/test-code/GradientStop.h | 2176 ++-- .../test-code/GraphicalPrimitive2D.cpp | 2192 ++-- .../test-code/GraphicalPrimitive2D.h | 2230 ++-- .../tests/test_cpp_code/test-code/Group.cpp | 3330 +++--- .../tests/test_cpp_code/test-code/Group.h | 3308 +++--- .../tests/test_cpp_code/test-code/Label.cpp | 2538 ++--- .../tests/test_cpp_code/test-code/Label.h | 2212 ++-- .../test_cpp_code/test-code/LineEnding.cpp | 3464 +++--- .../test_cpp_code/test-code/LineEnding.h | 2670 ++--- .../test-code/ListOfAnalyticVolumes.cpp | 898 +- .../test-code/ListOfAnalyticVolumes.h | 1096 +- .../test-code/ListOfAssociations.cpp | 1038 +- .../test-code/ListOfAssociations.h | 1168 +- .../test-code/ListOfCSGNodes.cpp | 1242 +-- .../test_cpp_code/test-code/ListOfCSGNodes.h | 1266 +-- .../test-code/ListOfCategories.cpp | 802 +- .../test-code/ListOfCategories.h | 1018 +- .../test-code/ListOfChildren.cpp | 794 +- .../test_cpp_code/test-code/ListOfChildren.h | 1000 +- .../test-code/ListOfClassTwos.cpp | 800 +- .../test_cpp_code/test-code/ListOfClassTwos.h | 1012 +- .../test-code/ListOfCoordinateComponents.cpp | 838 +- .../test-code/ListOfCoordinateComponents.h | 1046 +- .../test-code/ListOfFunctionTerms.cpp | 1356 +-- .../test-code/ListOfFunctionTerms.h | 1320 +-- .../test-code/ListOfGeometryDefinitions.cpp | 1202 +- .../test-code/ListOfGeometryDefinitions.h | 1266 +-- .../test_cpp_code/test-code/ListOfGroups.cpp | 792 +- .../test_cpp_code/test-code/ListOfGroups.h | 996 +- .../test_cpp_code/test-code/ListOfMembers.cpp | 1560 +-- .../test_cpp_code/test-code/ListOfMembers.h | 1612 +-- .../test-code/ListOfMyLoTests.cpp | 1242 +-- .../test_cpp_code/test-code/ListOfMyLoTests.h | 1344 +-- .../test-code/ListOfObjectives.cpp | 1570 +-- .../test-code/ListOfObjectives.h | 1446 +-- .../test_cpp_code/test-code/ListOfOutputs.cpp | 876 +- .../test_cpp_code/test-code/ListOfOutputs.h | 1058 +- .../test-code/ListOfSampledFields.cpp | 808 +- .../test-code/ListOfSampledFields.h | 1028 +- .../test-code/ListOfTransitions.cpp | 808 +- .../test-code/ListOfTransitions.h | 1022 +- .../tests/test_cpp_code/test-code/Map.cpp | 4322 ++++---- generator/tests/test_cpp_code/test-code/Map.h | 4492 ++++---- .../tests/test_cpp_code/test-code/Member.cpp | 2440 ++-- .../tests/test_cpp_code/test-code/Member.h | 2118 ++-- .../test_cpp_code/test-code/MixedGeometry.cpp | 3310 +++--- .../test_cpp_code/test-code/MixedGeometry.h | 3362 +++--- .../test-code/ModifierSpeciesReference.cpp | 1262 +-- .../test-code/ModifierSpeciesReference.h | 1260 +-- .../test_cpp_code/test-code/MultipleChild.cpp | 3770 +++---- .../test_cpp_code/test-code/MultipleChild.h | 3160 +++--- .../tests/test_cpp_code/test-code/MyBase.cpp | 1432 +-- .../tests/test_cpp_code/test-code/MyBase.h | 1438 +-- .../test_cpp_code/test-code/MyLoTest.cpp | 1492 +-- .../tests/test_cpp_code/test-code/MyLoTest.h | 1450 +-- .../test-code/MyRequiredClass.cpp | 9838 ++++++++--------- .../test_cpp_code/test-code/MyRequiredClass.h | 7054 ++++++------ .../test_cpp_code/test-code/MySEDClass.cpp | 1360 +-- .../test_cpp_code/test-code/MySEDClass.h | 1384 +-- .../test_cpp_code/test-code/MyTestClass.cpp | 6162 +++++------ .../test_cpp_code/test-code/MyTestClass.h | 4794 ++++---- .../test_cpp_code/test-code/Objective.cpp | 3784 +++---- .../tests/test_cpp_code/test-code/Objective.h | 3478 +++--- .../tests/test_cpp_code/test-code/Other.cpp | 970 +- .../tests/test_cpp_code/test-code/Other.h | 1120 +- .../tests/test_cpp_code/test-code/Output.cpp | 2940 ++--- .../tests/test_cpp_code/test-code/Output.h | 2642 ++--- .../test-code/OutwardBindingSite.cpp | 2662 ++--- .../test-code/OutwardBindingSite.h | 2494 ++--- .../test-code/ParametricGeometry.cpp | 2930 ++--- .../test-code/ParametricGeometry.h | 2856 ++--- .../tests/test_cpp_code/test-code/Parent.cpp | 2404 ++-- .../tests/test_cpp_code/test-code/Parent.h | 2500 ++--- .../tests/test_cpp_code/test-code/Point.cpp | 2668 ++--- .../tests/test_cpp_code/test-code/Point.h | 2498 ++--- .../tests/test_cpp_code/test-code/Polygon.cpp | 2174 ++-- .../tests/test_cpp_code/test-code/Polygon.h | 2232 ++-- .../test_cpp_code/test-code/RenderGroup.cpp | 6188 +++++------ .../test_cpp_code/test-code/RenderGroup.h | 5484 ++++----- .../test_cpp_code/test-code/SampledField.cpp | 4902 ++++---- .../test_cpp_code/test-code/SampledField.h | 4174 +++---- .../test-code/SampledFieldGeometry.cpp | 2802 ++--- .../test-code/SampledFieldGeometry.h | 2818 ++--- .../test-code/SbgnListOfPoints.cpp | 836 +- .../test-code/SbgnListOfPoints.h | 1026 +- .../test_cpp_code/test-code/SpatialPoints.cpp | 3114 +++--- .../test_cpp_code/test-code/SpatialPoints.h | 2936 ++--- .../test_cpp_code/test-code/Transition.cpp | 4486 ++++---- .../test_cpp_code/test-code/Transition.h | 4606 ++++---- .../test_cpp_code/test-code/Uncertainty.cpp | 3770 +++---- .../test_cpp_code/test-code/Uncertainty.h | 2524 ++--- .../test-code/UncertaintyOld.cpp | 2450 ++-- .../test_cpp_code/test-code/UncertaintyOld.h | 2240 ++-- .../tests/test_cpp_code/test-code/Unit.cpp | 1490 +-- .../tests/test_cpp_code/test-code/Unit.h | 1448 +-- .../test_cpp_code/test-code/UnknownType.cpp | 1380 +-- .../test_cpp_code/test-code/UnknownType.h | 1442 +-- .../test-extension/CompSBMLDocumentPlugin.cpp | 2988 ++--- .../test-extension/CompSBMLDocumentPlugin.h | 2980 ++--- .../test-extension/CoreversExtension.cpp | 822 +- .../test-extension/CoreversExtension.h | 780 +- .../CoreversmultipkgExtension.cpp | 1310 +-- .../CoreversmultipkgExtension.h | 1158 +- .../CoreversmultipkgModelPlugin.cpp | 4014 +++---- .../CoreversmultipkgModelPlugin.h | 2706 ++--- .../test-extension/CoreverspkgExtension.cpp | 824 +- .../test-extension/CoreverspkgExtension.h | 816 +- .../test-extension/DistribSBMLError.h | 358 +- .../test-extension/DistribSBMLErrorTable.h | 2566 ++--- .../test-extension/FbcModelPlugin.cpp | 4096 +++---- .../test-extension/FbcModelPlugin.h | 4182 +++---- .../test-extension/FbcSBMLError.h | 308 +- .../test-extension/FbcSBMLErrorTable.h | 1932 ++-- .../test-extension/FooSBMLError.h | 236 +- .../test-extension/FooSBMLErrorTable.h | 1056 +- .../test-extension/GroupsExtension.cpp | 998 +- .../test-extension/GroupsExtension.h | 1018 +- .../test-extension/GroupsModelPlugin.cpp | 2096 ++-- .../test-extension/GroupsModelPlugin.h | 2072 ++-- .../GroupsSBMLDocumentPlugin.cpp | 988 +- .../test-extension/GroupsSBMLDocumentPlugin.h | 884 +- .../test-extension/GroupsSBMLError.h | 216 +- .../test-extension/GroupsSBMLErrorTable.h | 816 +- .../test-extension/MultiExtension.cpp | 1412 +-- .../test-extension/MultiExtension.h | 1516 +-- .../test-extension/PluginidSBasePlugin.cpp | 3048 ++--- .../test-extension/PluginidSBasePlugin.h | 2274 ++-- .../QualConsistencyValidator.cpp | 150 +- .../test-extension/QualConsistencyValidator.h | 194 +- .../test-extension/QualExtension.cpp | 1354 +-- .../test-extension/QualExtension.h | 1506 +-- .../test-extension/QualExtensionTypes.h | 118 +- .../test-extension/QualModelPlugin.cpp | 2716 ++--- .../test-extension/QualModelPlugin.h | 2972 ++--- .../test-extension/QualSBMLDocumentPlugin.cpp | 984 +- .../test-extension/QualSBMLDocumentPlugin.h | 884 +- .../test-extension/QualSBMLError.h | 276 +- .../test-extension/QualSBMLErrorTable.h | 1548 +-- .../test-extension/QualValidator.cpp | 908 +- .../test-extension/QualValidator.h | 338 +- .../test-extension/RefsSBMLError.h | 202 +- .../test-extension/RefsSBMLErrorTable.h | 652 +- .../test-extension/RenderSBMLError.h | 586 +- .../test-extension/RenderSBMLErrorTable.h | 5468 ++++----- .../SpatialCompartmentPlugin.cpp | 1964 ++-- .../test-extension/SpatialCompartmentPlugin.h | 1638 +-- .../SpatialConsistencyConstraints.cpp | 116 +- .../SpatialConsistencyConstraintsDeclared.cxx | 84 +- .../test-extension/SpatialParameterPlugin.cpp | 3882 +++---- .../test-extension/SpatialParameterPlugin.h | 2662 ++--- .../test-extension/SpatialReactionPlugin.cpp | 1346 +-- .../test-extension/SpatialReactionPlugin.h | 1258 +-- .../SpatialSBMLDocumentPlugin.cpp | 988 +- .../SpatialSBMLDocumentPlugin.h | 884 +- .../test-extension/SpatialValidator.cpp | 1990 ++-- .../test-extension/SpatialValidator.h | 344 +- .../test-extension/TestExtension.cpp | 1338 +-- .../test-extension/TestExtension.h | 1466 +-- .../test-extension/TestSBMLError.h | 318 +- .../test-extension/TestSBMLErrorTable.h | 2004 ++-- .../test-extension/TwoatonceExtension.cpp | 950 +- .../test-extension/TwoatonceExtension.h | 846 +- .../test-extension/TwoatonceSBasePlugin.cpp | 3122 +++--- .../test-extension/TwoatonceSBasePlugin.h | 2248 ++-- .../test-extension/VersExtension.cpp | 1142 +- .../test-extension/VersExtension.h | 1102 +- .../test-extension/VersModelPlugin.cpp | 2936 ++--- .../test-extension/VersModelPlugin.h | 2194 ++-- .../test-extension/VersSpeciesPlugin.cpp | 4584 ++++---- .../test-extension/VersSpeciesPlugin.h | 3546 +++--- .../test_cpp_code/test-extension/qualfwd.h | 158 +- 252 files changed, 278112 insertions(+), 278112 deletions(-) diff --git a/generator/tests/test_cpp_code/test-code/AnalyticVolume.cpp b/generator/tests/test_cpp_code/test-code/AnalyticVolume.cpp index 6c5484d8..8776ba66 100644 --- a/generator/tests/test_cpp_code/test-code/AnalyticVolume.cpp +++ b/generator/tests/test_cpp_code/test-code/AnalyticVolume.cpp @@ -1,1585 +1,1585 @@ -/** - * @file AnalyticVolume.cpp - * @brief Implementation of the AnalyticVolume class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new AnalyticVolume using the given SBML Level, Version and - * “spatial” package version. - */ -AnalyticVolume::AnalyticVolume(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mFunctionType (SPATIAL_FUNCTIONKIND_INVALID) - , mOrdinal (SBML_INT_MAX) - , mIsSetOrdinal (false) - , mDomainType ("") - , mMath (NULL) -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new AnalyticVolume using the given SpatialPkgNamespaces object. - */ -AnalyticVolume::AnalyticVolume(SpatialPkgNamespaces *spatialns) - : SBase(spatialns) - , mFunctionType (SPATIAL_FUNCTIONKIND_INVALID) - , mOrdinal (SBML_INT_MAX) - , mIsSetOrdinal (false) - , mDomainType ("") - , mMath (NULL) -{ - setElementNamespace(spatialns->getURI()); - connectToChild(); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for AnalyticVolume. - */ -AnalyticVolume::AnalyticVolume(const AnalyticVolume& orig) - : SBase( orig ) - , mFunctionType ( orig.mFunctionType ) - , mOrdinal ( orig.mOrdinal ) - , mIsSetOrdinal ( orig.mIsSetOrdinal ) - , mDomainType ( orig.mDomainType ) - , mMath ( NULL ) -{ - if (orig.mMath != NULL) - { - mMath = orig.mMath->deepCopy(); - } - - connectToChild(); -} - - -/* - * Assignment operator for AnalyticVolume. - */ -AnalyticVolume& -AnalyticVolume::operator=(const AnalyticVolume& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mFunctionType = rhs.mFunctionType; - mOrdinal = rhs.mOrdinal; - mIsSetOrdinal = rhs.mIsSetOrdinal; - mDomainType = rhs.mDomainType; - delete mMath; - if (rhs.mMath != NULL) - { - mMath = rhs.mMath->deepCopy(); - } - else - { - mMath = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this AnalyticVolume object. - */ -AnalyticVolume* -AnalyticVolume::clone() const -{ - return new AnalyticVolume(*this); -} - - -/* - * Destructor for AnalyticVolume. - */ -AnalyticVolume::~AnalyticVolume() -{ - delete mMath; - mMath = NULL; -} - - -/* - * Returns the value of the "id" attribute of this AnalyticVolume. - */ -const std::string& -AnalyticVolume::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "functionType" attribute of this AnalyticVolume. - */ -FunctionKind_t -AnalyticVolume::getFunctionType() const -{ - return mFunctionType; -} - - -/* - * Returns the value of the "functionType" attribute of this AnalyticVolume. - */ -std::string -AnalyticVolume::getFunctionTypeAsString() const -{ - std::string code_str = FunctionKind_toString(mFunctionType); - return code_str; -} - - -/* - * Returns the value of the "ordinal" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::getOrdinal() const -{ - return mOrdinal; -} - - -/* - * Returns the value of the "domainType" attribute of this AnalyticVolume. - */ -const std::string& -AnalyticVolume::getDomainType() const -{ - return mDomainType; -} - - -/* - * Predicate returning @c true if this AnalyticVolume's "id" attribute is set. - */ -bool -AnalyticVolume::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this AnalyticVolume's "functionType" - * attribute is set. - */ -bool -AnalyticVolume::isSetFunctionType() const -{ - return (mFunctionType != SPATIAL_FUNCTIONKIND_INVALID); -} - - -/* - * Predicate returning @c true if this AnalyticVolume's "ordinal" attribute is - * set. - */ -bool -AnalyticVolume::isSetOrdinal() const -{ - return mIsSetOrdinal; -} - - -/* - * Predicate returning @c true if this AnalyticVolume's "domainType" attribute - * is set. - */ -bool -AnalyticVolume::isSetDomainType() const -{ - return (mDomainType.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "functionType" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setFunctionType(const FunctionKind_t functionType) -{ - if (FunctionKind_isValid(functionType) == 0) - { - mFunctionType = SPATIAL_FUNCTIONKIND_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mFunctionType = functionType; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "functionType" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setFunctionType(const std::string& functionType) -{ - mFunctionType = FunctionKind_fromString(functionType.c_str()); - - if (mFunctionType == SPATIAL_FUNCTIONKIND_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "ordinal" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setOrdinal(int ordinal) -{ - mOrdinal = ordinal; - mIsSetOrdinal = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "domainType" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setDomainType(const std::string& domainType) -{ - if (!(SyntaxChecker::isValidInternalSId(domainType))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mDomainType = domainType; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "id" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "functionType" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::unsetFunctionType() -{ - mFunctionType = SPATIAL_FUNCTIONKIND_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "ordinal" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::unsetOrdinal() -{ - mOrdinal = SBML_INT_MAX; - mIsSetOrdinal = false; - - if (isSetOrdinal() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "domainType" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::unsetDomainType() -{ - mDomainType.erase(); - - if (mDomainType.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "math" element of this AnalyticVolume. - */ -const ASTNode* -AnalyticVolume::getMath() const -{ - return mMath; -} - - -/* - * Returns the value of the "math" element of this AnalyticVolume. - */ -ASTNode* -AnalyticVolume::getMath() -{ - return mMath; -} - - -/* - * Predicate returning @c true if this AnalyticVolume's "math" element is set. - */ -bool -AnalyticVolume::isSetMath() const -{ - return (mMath != NULL); -} - - -/* - * Sets the value of the "math" element of this AnalyticVolume. - */ -int -AnalyticVolume::setMath(const ASTNode* math) -{ - if (mMath == math) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (math == NULL) - { - delete mMath; - mMath = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else if (!(math->isWellFormedASTNode())) - { - return LIBSBML_INVALID_OBJECT; - } - else - { - delete mMath; - mMath = (math != NULL) ? math->deepCopy() : NULL; - if (mMath != NULL) - { - mMath->setParentSBMLObject(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "math" element of this AnalyticVolume. - */ -int -AnalyticVolume::unsetMath() -{ - delete mMath; - mMath = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -AnalyticVolume::renameSIdRefs(const std::string& oldid, - const std::string& newid) -{ - if (isSetDomainType() && mDomainType == oldid) - { - setDomainType(newid); - } - - if (isSetMath()) - { - mMath->renameSIdRefs(oldid, newid); - } -} - - -/* - * Returns the XML element name of this AnalyticVolume object. - */ -const std::string& -AnalyticVolume::getElementName() const -{ - static const string name = "analyticVolume"; - return name; -} - - -/* - * Returns the libSBML type code for this AnalyticVolume object. - */ -int -AnalyticVolume::getTypeCode() const -{ - return SBML_SPATIAL_ANALYTICVOLUME; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * AnalyticVolume object have been set. - */ -bool -AnalyticVolume::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - if (isSetFunctionType() == false) - { - allPresent = false; - } - - if (isSetDomainType() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -AnalyticVolume::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetMath() == true) - { - writeMathML(getMath(), stream, getSBMLNamespaces()); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -AnalyticVolume::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -AnalyticVolume::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -AnalyticVolume::connectToChild() -{ - SBase::connectToChild(); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -AnalyticVolume::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -AnalyticVolume::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "ordinal") - { - value = getOrdinal(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "functionType") - { - value = getFunctionTypeAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "domainType") - { - value = getDomainType(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this AnalyticVolume's attribute - * "attributeName" is set. - */ -bool -AnalyticVolume::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "functionType") - { - value = isSetFunctionType(); - } - else if (attributeName == "ordinal") - { - value = isSetOrdinal(); - } - else if (attributeName == "domainType") - { - value = isSetDomainType(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "ordinal") - { - return_value = setOrdinal(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "functionType") - { - return_value = setFunctionType(value); - } - else if (attributeName == "domainType") - { - return_value = setDomainType(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this AnalyticVolume. - */ -int -AnalyticVolume::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "functionType") - { - value = unsetFunctionType(); - } - else if (attributeName == "ordinal") - { - value = unsetOrdinal(); - } - else if (attributeName == "domainType") - { - value = unsetDomainType(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -AnalyticVolume::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("functionType"); - - attributes.add("ordinal"); - - attributes.add("domainType"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -AnalyticVolume::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialAnalyticGeometryLOAnalyticVolumesAllowedAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialAnalyticGeometryLOAnalyticVolumesAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialAnalyticVolumeAllowedCoreAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'id' is missing from the " - " element."; - log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } - - // - // functionType enum (use = "required" ) - // - - std::string functionType; - assigned = attributes.readInto("functionType", functionType); - - if (assigned == true) - { - if (functionType.empty() == true) - { - logEmptyString(functionType, level, version, ""); - } - else - { - mFunctionType = FunctionKind_fromString(functionType.c_str()); - - if (log && FunctionKind_isValid(mFunctionType) == 0) - { - std::string msg = "The functionType on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + functionType + "', which is not a valid option."; - - log->logPackageError("spatial", - SpatialAnalyticVolumeFunctionTypeMustBeFunctionKindEnum, pkgVersion, - level, version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'functionType' is missing."; - log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } - - // - // ordinal int (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetOrdinal = attributes.readInto("ordinal", mOrdinal); - - if ( mIsSetOrdinal == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Spatial attribute 'ordinal' from the " - " element must be an integer."; - log->logPackageError("spatial", - SpatialAnalyticVolumeOrdinalMustBeInteger, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // domainType SIdRef (use = "required" ) - // - - assigned = attributes.readInto("domainType", mDomainType); - - if (assigned == true) - { - if (mDomainType.empty() == true) - { - logEmptyString(mDomainType, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mDomainType) == false) - { - std::string msg = "The domainType attribute on the <" + getElementName() - + ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mDomainType + "', which does not conform to the " - "syntax."; - log->logPackageError("spatial", - SpatialAnalyticVolumeDomainTypeMustBeDomainType, pkgVersion, level, - version, msg, getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'domainType' is missing from the " - " element."; - log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads other XML such as math/notes etc. - */ -bool -AnalyticVolume::readOtherXML(XMLInputStream& stream) -{ - bool read = false; - const string& name = stream.peek().getName(); - - if (name == "math") - { - const XMLToken elem = stream.peek(); - const std::string prefix = checkMathMLNamespace(elem); - if (stream.getSBMLNamespaces() == NULL) - { - stream.setSBMLNamespaces(new SBMLNamespaces(getLevel(), getVersion())); - } - - delete mMath; - mMath = readMathML(stream, prefix); - read = true; - } - - if (SBase::readOtherXML(stream)) - { - read = true; - } - - return read; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -AnalyticVolume::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetFunctionType() == true) - { - stream.writeAttribute("functionType", getPrefix(), - FunctionKind_toString(mFunctionType)); - } - - if (isSetOrdinal() == true) - { - stream.writeAttribute("ordinal", getPrefix(), mOrdinal); - } - - if (isSetDomainType() == true) - { - stream.writeAttribute("domainType", getPrefix(), mDomainType); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new AnalyticVolume_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -AnalyticVolume_t * -AnalyticVolume_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new AnalyticVolume(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this AnalyticVolume_t object. - */ -LIBSBML_EXTERN -AnalyticVolume_t* -AnalyticVolume_clone(const AnalyticVolume_t* av) -{ - if (av != NULL) - { - return static_cast(av->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this AnalyticVolume_t object. - */ -LIBSBML_EXTERN -void -AnalyticVolume_free(AnalyticVolume_t* av) -{ - if (av != NULL) - { - delete av; - } -} - - -/* - * Returns the value of the "id" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -char * -AnalyticVolume_getId(const AnalyticVolume_t * av) -{ - if (av == NULL) - { - return NULL; - } - - return av->getId().empty() ? NULL : safe_strdup(av->getId().c_str()); -} - - -/* - * Returns the value of the "functionType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -FunctionKind_t -AnalyticVolume_getFunctionType(const AnalyticVolume_t * av) -{ - if (av == NULL) - { - return SPATIAL_FUNCTIONKIND_INVALID; - } - - return av->getFunctionType(); -} - - -/* - * Returns the value of the "functionType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -char * -AnalyticVolume_getFunctionTypeAsString(const AnalyticVolume_t * av) -{ - return (char*)(FunctionKind_toString(av->getFunctionType())); -} - - -/* - * Returns the value of the "ordinal" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_getOrdinal(const AnalyticVolume_t * av) -{ - return (av != NULL) ? av->getOrdinal() : SBML_INT_MAX; -} - - -/* - * Returns the value of the "domainType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -char * -AnalyticVolume_getDomainType(const AnalyticVolume_t * av) -{ - if (av == NULL) - { - return NULL; - } - - return av->getDomainType().empty() ? NULL : - safe_strdup(av->getDomainType().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this AnalyticVolume_t's "id" attribute is - * set. - */ -LIBSBML_EXTERN -int -AnalyticVolume_isSetId(const AnalyticVolume_t * av) -{ - return (av != NULL) ? static_cast(av->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this AnalyticVolume_t's "functionType" - * attribute is set. - */ -LIBSBML_EXTERN -int -AnalyticVolume_isSetFunctionType(const AnalyticVolume_t * av) -{ - return (av != NULL) ? static_cast(av->isSetFunctionType()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this AnalyticVolume_t's "ordinal" - * attribute is set. - */ -LIBSBML_EXTERN -int -AnalyticVolume_isSetOrdinal(const AnalyticVolume_t * av) -{ - return (av != NULL) ? static_cast(av->isSetOrdinal()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this AnalyticVolume_t's "domainType" - * attribute is set. - */ -LIBSBML_EXTERN -int -AnalyticVolume_isSetDomainType(const AnalyticVolume_t * av) -{ - return (av != NULL) ? static_cast(av->isSetDomainType()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_setId(AnalyticVolume_t * av, const char * id) -{ - return (av != NULL) ? av->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "functionType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_setFunctionType(AnalyticVolume_t * av, - FunctionKind_t functionType) -{ - return (av != NULL) ? av->setFunctionType(functionType) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "functionType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_setFunctionTypeAsString(AnalyticVolume_t * av, - const char * functionType) -{ - return (av != NULL) ? av->setFunctionType(functionType): - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "ordinal" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_setOrdinal(AnalyticVolume_t * av, int ordinal) -{ - return (av != NULL) ? av->setOrdinal(ordinal) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "domainType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_setDomainType(AnalyticVolume_t * av, const char * domainType) -{ - return (av != NULL) ? av->setDomainType(domainType) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_unsetId(AnalyticVolume_t * av) -{ - return (av != NULL) ? av->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "functionType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_unsetFunctionType(AnalyticVolume_t * av) -{ - return (av != NULL) ? av->unsetFunctionType() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "ordinal" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_unsetOrdinal(AnalyticVolume_t * av) -{ - return (av != NULL) ? av->unsetOrdinal() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "domainType" attribute of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_unsetDomainType(AnalyticVolume_t * av) -{ - return (av != NULL) ? av->unsetDomainType() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "math" element of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -const ASTNode_t* -AnalyticVolume_getMath(const AnalyticVolume_t * av) -{ - if (av == NULL) - { - return NULL; - } - - return (ASTNode_t*)(av->getMath()); -} - - -/* - * Predicate returning @c 1 (true) if this AnalyticVolume_t's "math" element is - * set. - */ -LIBSBML_EXTERN -int -AnalyticVolume_isSetMath(const AnalyticVolume_t * av) -{ - return (av != NULL) ? static_cast(av->isSetMath()) : 0; -} - - -/* - * Sets the value of the "math" element of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_setMath(AnalyticVolume_t * av, const ASTNode_t* math) -{ - return (av != NULL) ? av->setMath(math) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "math" element of this AnalyticVolume_t. - */ -LIBSBML_EXTERN -int -AnalyticVolume_unsetMath(AnalyticVolume_t * av) -{ - return (av != NULL) ? av->unsetMath() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * AnalyticVolume_t object have been set. - */ -LIBSBML_EXTERN -int -AnalyticVolume_hasRequiredAttributes(const AnalyticVolume_t * av) -{ - return (av != NULL) ? static_cast(av->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file AnalyticVolume.cpp + * @brief Implementation of the AnalyticVolume class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new AnalyticVolume using the given SBML Level, Version and + * “spatial” package version. + */ +AnalyticVolume::AnalyticVolume(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mFunctionType (SPATIAL_FUNCTIONKIND_INVALID) + , mOrdinal (SBML_INT_MAX) + , mIsSetOrdinal (false) + , mDomainType ("") + , mMath (NULL) +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new AnalyticVolume using the given SpatialPkgNamespaces object. + */ +AnalyticVolume::AnalyticVolume(SpatialPkgNamespaces *spatialns) + : SBase(spatialns) + , mFunctionType (SPATIAL_FUNCTIONKIND_INVALID) + , mOrdinal (SBML_INT_MAX) + , mIsSetOrdinal (false) + , mDomainType ("") + , mMath (NULL) +{ + setElementNamespace(spatialns->getURI()); + connectToChild(); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for AnalyticVolume. + */ +AnalyticVolume::AnalyticVolume(const AnalyticVolume& orig) + : SBase( orig ) + , mFunctionType ( orig.mFunctionType ) + , mOrdinal ( orig.mOrdinal ) + , mIsSetOrdinal ( orig.mIsSetOrdinal ) + , mDomainType ( orig.mDomainType ) + , mMath ( NULL ) +{ + if (orig.mMath != NULL) + { + mMath = orig.mMath->deepCopy(); + } + + connectToChild(); +} + + +/* + * Assignment operator for AnalyticVolume. + */ +AnalyticVolume& +AnalyticVolume::operator=(const AnalyticVolume& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mFunctionType = rhs.mFunctionType; + mOrdinal = rhs.mOrdinal; + mIsSetOrdinal = rhs.mIsSetOrdinal; + mDomainType = rhs.mDomainType; + delete mMath; + if (rhs.mMath != NULL) + { + mMath = rhs.mMath->deepCopy(); + } + else + { + mMath = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this AnalyticVolume object. + */ +AnalyticVolume* +AnalyticVolume::clone() const +{ + return new AnalyticVolume(*this); +} + + +/* + * Destructor for AnalyticVolume. + */ +AnalyticVolume::~AnalyticVolume() +{ + delete mMath; + mMath = NULL; +} + + +/* + * Returns the value of the "id" attribute of this AnalyticVolume. + */ +const std::string& +AnalyticVolume::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "functionType" attribute of this AnalyticVolume. + */ +FunctionKind_t +AnalyticVolume::getFunctionType() const +{ + return mFunctionType; +} + + +/* + * Returns the value of the "functionType" attribute of this AnalyticVolume. + */ +std::string +AnalyticVolume::getFunctionTypeAsString() const +{ + std::string code_str = FunctionKind_toString(mFunctionType); + return code_str; +} + + +/* + * Returns the value of the "ordinal" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::getOrdinal() const +{ + return mOrdinal; +} + + +/* + * Returns the value of the "domainType" attribute of this AnalyticVolume. + */ +const std::string& +AnalyticVolume::getDomainType() const +{ + return mDomainType; +} + + +/* + * Predicate returning @c true if this AnalyticVolume's "id" attribute is set. + */ +bool +AnalyticVolume::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this AnalyticVolume's "functionType" + * attribute is set. + */ +bool +AnalyticVolume::isSetFunctionType() const +{ + return (mFunctionType != SPATIAL_FUNCTIONKIND_INVALID); +} + + +/* + * Predicate returning @c true if this AnalyticVolume's "ordinal" attribute is + * set. + */ +bool +AnalyticVolume::isSetOrdinal() const +{ + return mIsSetOrdinal; +} + + +/* + * Predicate returning @c true if this AnalyticVolume's "domainType" attribute + * is set. + */ +bool +AnalyticVolume::isSetDomainType() const +{ + return (mDomainType.empty() == false); +} + + +/* + * Sets the value of the "id" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "functionType" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setFunctionType(const FunctionKind_t functionType) +{ + if (FunctionKind_isValid(functionType) == 0) + { + mFunctionType = SPATIAL_FUNCTIONKIND_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mFunctionType = functionType; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "functionType" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setFunctionType(const std::string& functionType) +{ + mFunctionType = FunctionKind_fromString(functionType.c_str()); + + if (mFunctionType == SPATIAL_FUNCTIONKIND_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "ordinal" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setOrdinal(int ordinal) +{ + mOrdinal = ordinal; + mIsSetOrdinal = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "domainType" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setDomainType(const std::string& domainType) +{ + if (!(SyntaxChecker::isValidInternalSId(domainType))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mDomainType = domainType; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "id" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "functionType" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::unsetFunctionType() +{ + mFunctionType = SPATIAL_FUNCTIONKIND_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "ordinal" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::unsetOrdinal() +{ + mOrdinal = SBML_INT_MAX; + mIsSetOrdinal = false; + + if (isSetOrdinal() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "domainType" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::unsetDomainType() +{ + mDomainType.erase(); + + if (mDomainType.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "math" element of this AnalyticVolume. + */ +const ASTNode* +AnalyticVolume::getMath() const +{ + return mMath; +} + + +/* + * Returns the value of the "math" element of this AnalyticVolume. + */ +ASTNode* +AnalyticVolume::getMath() +{ + return mMath; +} + + +/* + * Predicate returning @c true if this AnalyticVolume's "math" element is set. + */ +bool +AnalyticVolume::isSetMath() const +{ + return (mMath != NULL); +} + + +/* + * Sets the value of the "math" element of this AnalyticVolume. + */ +int +AnalyticVolume::setMath(const ASTNode* math) +{ + if (mMath == math) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (math == NULL) + { + delete mMath; + mMath = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else if (!(math->isWellFormedASTNode())) + { + return LIBSBML_INVALID_OBJECT; + } + else + { + delete mMath; + mMath = (math != NULL) ? math->deepCopy() : NULL; + if (mMath != NULL) + { + mMath->setParentSBMLObject(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "math" element of this AnalyticVolume. + */ +int +AnalyticVolume::unsetMath() +{ + delete mMath; + mMath = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +AnalyticVolume::renameSIdRefs(const std::string& oldid, + const std::string& newid) +{ + if (isSetDomainType() && mDomainType == oldid) + { + setDomainType(newid); + } + + if (isSetMath()) + { + mMath->renameSIdRefs(oldid, newid); + } +} + + +/* + * Returns the XML element name of this AnalyticVolume object. + */ +const std::string& +AnalyticVolume::getElementName() const +{ + static const string name = "analyticVolume"; + return name; +} + + +/* + * Returns the libSBML type code for this AnalyticVolume object. + */ +int +AnalyticVolume::getTypeCode() const +{ + return SBML_SPATIAL_ANALYTICVOLUME; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * AnalyticVolume object have been set. + */ +bool +AnalyticVolume::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + if (isSetFunctionType() == false) + { + allPresent = false; + } + + if (isSetDomainType() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +AnalyticVolume::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetMath() == true) + { + writeMathML(getMath(), stream, getSBMLNamespaces()); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +AnalyticVolume::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +AnalyticVolume::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +AnalyticVolume::connectToChild() +{ + SBase::connectToChild(); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +AnalyticVolume::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +AnalyticVolume::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "ordinal") + { + value = getOrdinal(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "functionType") + { + value = getFunctionTypeAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "domainType") + { + value = getDomainType(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this AnalyticVolume's attribute + * "attributeName" is set. + */ +bool +AnalyticVolume::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "functionType") + { + value = isSetFunctionType(); + } + else if (attributeName == "ordinal") + { + value = isSetOrdinal(); + } + else if (attributeName == "domainType") + { + value = isSetDomainType(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "ordinal") + { + return_value = setOrdinal(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "functionType") + { + return_value = setFunctionType(value); + } + else if (attributeName == "domainType") + { + return_value = setDomainType(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this AnalyticVolume. + */ +int +AnalyticVolume::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "functionType") + { + value = unsetFunctionType(); + } + else if (attributeName == "ordinal") + { + value = unsetOrdinal(); + } + else if (attributeName == "domainType") + { + value = unsetDomainType(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +AnalyticVolume::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("functionType"); + + attributes.add("ordinal"); + + attributes.add("domainType"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +AnalyticVolume::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialAnalyticGeometryLOAnalyticVolumesAllowedAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialAnalyticGeometryLOAnalyticVolumesAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialAnalyticVolumeAllowedCoreAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'id' is missing from the " + " element."; + log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } + + // + // functionType enum (use = "required" ) + // + + std::string functionType; + assigned = attributes.readInto("functionType", functionType); + + if (assigned == true) + { + if (functionType.empty() == true) + { + logEmptyString(functionType, level, version, ""); + } + else + { + mFunctionType = FunctionKind_fromString(functionType.c_str()); + + if (log && FunctionKind_isValid(mFunctionType) == 0) + { + std::string msg = "The functionType on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + functionType + "', which is not a valid option."; + + log->logPackageError("spatial", + SpatialAnalyticVolumeFunctionTypeMustBeFunctionKindEnum, pkgVersion, + level, version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'functionType' is missing."; + log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } + + // + // ordinal int (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetOrdinal = attributes.readInto("ordinal", mOrdinal); + + if ( mIsSetOrdinal == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Spatial attribute 'ordinal' from the " + " element must be an integer."; + log->logPackageError("spatial", + SpatialAnalyticVolumeOrdinalMustBeInteger, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // domainType SIdRef (use = "required" ) + // + + assigned = attributes.readInto("domainType", mDomainType); + + if (assigned == true) + { + if (mDomainType.empty() == true) + { + logEmptyString(mDomainType, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mDomainType) == false) + { + std::string msg = "The domainType attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mDomainType + "', which does not conform to the " + "syntax."; + log->logPackageError("spatial", + SpatialAnalyticVolumeDomainTypeMustBeDomainType, pkgVersion, level, + version, msg, getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'domainType' is missing from the " + " element."; + log->logPackageError("spatial", SpatialAnalyticVolumeAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads other XML such as math/notes etc. + */ +bool +AnalyticVolume::readOtherXML(XMLInputStream& stream) +{ + bool read = false; + const string& name = stream.peek().getName(); + + if (name == "math") + { + const XMLToken elem = stream.peek(); + const std::string prefix = checkMathMLNamespace(elem); + if (stream.getSBMLNamespaces() == NULL) + { + stream.setSBMLNamespaces(new SBMLNamespaces(getLevel(), getVersion())); + } + + delete mMath; + mMath = readMathML(stream, prefix); + read = true; + } + + if (SBase::readOtherXML(stream)) + { + read = true; + } + + return read; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +AnalyticVolume::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetFunctionType() == true) + { + stream.writeAttribute("functionType", getPrefix(), + FunctionKind_toString(mFunctionType)); + } + + if (isSetOrdinal() == true) + { + stream.writeAttribute("ordinal", getPrefix(), mOrdinal); + } + + if (isSetDomainType() == true) + { + stream.writeAttribute("domainType", getPrefix(), mDomainType); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new AnalyticVolume_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +AnalyticVolume_t * +AnalyticVolume_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new AnalyticVolume(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this AnalyticVolume_t object. + */ +LIBSBML_EXTERN +AnalyticVolume_t* +AnalyticVolume_clone(const AnalyticVolume_t* av) +{ + if (av != NULL) + { + return static_cast(av->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this AnalyticVolume_t object. + */ +LIBSBML_EXTERN +void +AnalyticVolume_free(AnalyticVolume_t* av) +{ + if (av != NULL) + { + delete av; + } +} + + +/* + * Returns the value of the "id" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +char * +AnalyticVolume_getId(const AnalyticVolume_t * av) +{ + if (av == NULL) + { + return NULL; + } + + return av->getId().empty() ? NULL : safe_strdup(av->getId().c_str()); +} + + +/* + * Returns the value of the "functionType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +FunctionKind_t +AnalyticVolume_getFunctionType(const AnalyticVolume_t * av) +{ + if (av == NULL) + { + return SPATIAL_FUNCTIONKIND_INVALID; + } + + return av->getFunctionType(); +} + + +/* + * Returns the value of the "functionType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +char * +AnalyticVolume_getFunctionTypeAsString(const AnalyticVolume_t * av) +{ + return (char*)(FunctionKind_toString(av->getFunctionType())); +} + + +/* + * Returns the value of the "ordinal" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_getOrdinal(const AnalyticVolume_t * av) +{ + return (av != NULL) ? av->getOrdinal() : SBML_INT_MAX; +} + + +/* + * Returns the value of the "domainType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +char * +AnalyticVolume_getDomainType(const AnalyticVolume_t * av) +{ + if (av == NULL) + { + return NULL; + } + + return av->getDomainType().empty() ? NULL : + safe_strdup(av->getDomainType().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this AnalyticVolume_t's "id" attribute is + * set. + */ +LIBSBML_EXTERN +int +AnalyticVolume_isSetId(const AnalyticVolume_t * av) +{ + return (av != NULL) ? static_cast(av->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this AnalyticVolume_t's "functionType" + * attribute is set. + */ +LIBSBML_EXTERN +int +AnalyticVolume_isSetFunctionType(const AnalyticVolume_t * av) +{ + return (av != NULL) ? static_cast(av->isSetFunctionType()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this AnalyticVolume_t's "ordinal" + * attribute is set. + */ +LIBSBML_EXTERN +int +AnalyticVolume_isSetOrdinal(const AnalyticVolume_t * av) +{ + return (av != NULL) ? static_cast(av->isSetOrdinal()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this AnalyticVolume_t's "domainType" + * attribute is set. + */ +LIBSBML_EXTERN +int +AnalyticVolume_isSetDomainType(const AnalyticVolume_t * av) +{ + return (av != NULL) ? static_cast(av->isSetDomainType()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_setId(AnalyticVolume_t * av, const char * id) +{ + return (av != NULL) ? av->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "functionType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_setFunctionType(AnalyticVolume_t * av, + FunctionKind_t functionType) +{ + return (av != NULL) ? av->setFunctionType(functionType) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "functionType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_setFunctionTypeAsString(AnalyticVolume_t * av, + const char * functionType) +{ + return (av != NULL) ? av->setFunctionType(functionType): + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "ordinal" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_setOrdinal(AnalyticVolume_t * av, int ordinal) +{ + return (av != NULL) ? av->setOrdinal(ordinal) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "domainType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_setDomainType(AnalyticVolume_t * av, const char * domainType) +{ + return (av != NULL) ? av->setDomainType(domainType) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_unsetId(AnalyticVolume_t * av) +{ + return (av != NULL) ? av->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "functionType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_unsetFunctionType(AnalyticVolume_t * av) +{ + return (av != NULL) ? av->unsetFunctionType() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "ordinal" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_unsetOrdinal(AnalyticVolume_t * av) +{ + return (av != NULL) ? av->unsetOrdinal() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "domainType" attribute of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_unsetDomainType(AnalyticVolume_t * av) +{ + return (av != NULL) ? av->unsetDomainType() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "math" element of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +const ASTNode_t* +AnalyticVolume_getMath(const AnalyticVolume_t * av) +{ + if (av == NULL) + { + return NULL; + } + + return (ASTNode_t*)(av->getMath()); +} + + +/* + * Predicate returning @c 1 (true) if this AnalyticVolume_t's "math" element is + * set. + */ +LIBSBML_EXTERN +int +AnalyticVolume_isSetMath(const AnalyticVolume_t * av) +{ + return (av != NULL) ? static_cast(av->isSetMath()) : 0; +} + + +/* + * Sets the value of the "math" element of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_setMath(AnalyticVolume_t * av, const ASTNode_t* math) +{ + return (av != NULL) ? av->setMath(math) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "math" element of this AnalyticVolume_t. + */ +LIBSBML_EXTERN +int +AnalyticVolume_unsetMath(AnalyticVolume_t * av) +{ + return (av != NULL) ? av->unsetMath() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * AnalyticVolume_t object have been set. + */ +LIBSBML_EXTERN +int +AnalyticVolume_hasRequiredAttributes(const AnalyticVolume_t * av) +{ + return (av != NULL) ? static_cast(av->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Arc.cpp b/generator/tests/test_cpp_code/test-code/Arc.cpp index 46ef9162..507241f8 100644 --- a/generator/tests/test_cpp_code/test-code/Arc.cpp +++ b/generator/tests/test_cpp_code/test-code/Arc.cpp @@ -1,2739 +1,2739 @@ -/** - * @file Arc.cpp - * @brief Implementation of the Arc class. - * @author DEVISER - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBGN_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Arc using the given SBGN Level and @ p version values. - */ -Arc::Arc(unsigned int level, unsigned int version) - : SBase(level, version) - , mClazz ("") - , mSource ("") - , mTarget ("") - , mGlyphs (level, version) - , mStart (NULL) - , mPoints (level, version) - , mEnd (NULL) - , mPorts (level, version) -{ - setSbgnNamespacesAndOwn(new SbgnNamespaces(level, version)); - mPoints.setElementName("next"); - connectToChild(); -} - - -/* - * Creates a new Arc using the given SbgnNamespaces object @p sbgnns. - */ -Arc::Arc(SbgnNamespaces *sbgnns) - : SBase(sbgnns) - , mClazz ("") - , mSource ("") - , mTarget ("") - , mGlyphs (sbgnns) - , mStart (NULL) - , mPoints (sbgnns) - , mEnd (NULL) - , mPorts (sbgnns) -{ - setElementNamespace(sbgnns->getURI()); - mPoints.setElementName("next"); - connectToChild(); -} - - -/* - * Copy constructor for Arc. - */ -Arc::Arc(const Arc& orig) - : SBase( orig ) - , mClazz ( orig.mClazz ) - , mSource ( orig.mSource ) - , mTarget ( orig.mTarget ) - , mGlyphs ( orig.mGlyphs ) - , mStart ( NULL ) - , mPoints ( orig.mPoints ) - , mEnd ( NULL ) - , mPorts ( orig.mPorts ) -{ - if (orig.mStart != NULL) - { - mStart = orig.mStart->clone(); - } - - if (orig.mEnd != NULL) - { - mEnd = orig.mEnd->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for Arc. - */ -Arc& -Arc::operator=(const Arc& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mClazz = rhs.mClazz; - mSource = rhs.mSource; - mTarget = rhs.mTarget; - mGlyphs = rhs.mGlyphs; - mPoints = rhs.mPoints; - mPorts = rhs.mPorts; - delete mStart; - if (rhs.mStart != NULL) - { - mStart = rhs.mStart->clone(); - } - else - { - mStart = NULL; - } - - delete mEnd; - if (rhs.mEnd != NULL) - { - mEnd = rhs.mEnd->clone(); - } - else - { - mEnd = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Arc object. - */ -Arc* -Arc::clone() const -{ - return new Arc(*this); -} - - -/* - * Destructor for Arc. - */ -Arc::~Arc() -{ - delete mStart; - mStart = NULL; - delete mEnd; - mEnd = NULL; -} - - -/* - * Returns the value of the "id" attribute of this Arc. - */ -const std::string& -Arc::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "class" attribute of this Arc. - */ -const std::string& -Arc::getClazz() const -{ - return mClazz; -} - - -/* - * Returns the value of the "source" attribute of this Arc. - */ -const std::string& -Arc::getSource() const -{ - return mSource; -} - - -/* - * Returns the value of the "target" attribute of this Arc. - */ -const std::string& -Arc::getTarget() const -{ - return mTarget; -} - - -/* - * Predicate returning @c true if this Arc's "id" attribute is set. - */ -bool -Arc::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this Arc's "class" attribute is set. - */ -bool -Arc::isSetClazz() const -{ - return (mClazz.empty() == false); -} - - -/* - * Predicate returning @c true if this Arc's "source" attribute is set. - */ -bool -Arc::isSetSource() const -{ - return (mSource.empty() == false); -} - - -/* - * Predicate returning @c true if this Arc's "target" attribute is set. - */ -bool -Arc::isSetTarget() const -{ - return (mTarget.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this Arc. - */ -int -Arc::setId(const std::string& id) -{ - if (!(SyntaxChecker::isValidXMLID(id))) - { - return LIBSBGN_INVALID_ATTRIBUTE_VALUE; - } - else - { - mId = id; - return LIBSBGN_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "class" attribute of this Arc. - */ -int -Arc::setClazz(const std::string& clazz) -{ - mClazz = clazz; - return LIBSBGN_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "source" attribute of this Arc. - */ -int -Arc::setSource(const std::string& source) -{ - if (!(SyntaxChecker::isValidXMLID(source))) - { - return LIBSBGN_INVALID_ATTRIBUTE_VALUE; - } - else - { - mSource = source; - return LIBSBGN_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "target" attribute of this Arc. - */ -int -Arc::setTarget(const std::string& target) -{ - if (!(SyntaxChecker::isValidXMLID(target))) - { - return LIBSBGN_INVALID_ATTRIBUTE_VALUE; - } - else - { - mTarget = target; - return LIBSBGN_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "id" attribute of this Arc. - */ -int -Arc::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - return LIBSBGN_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "class" attribute of this Arc. - */ -int -Arc::unsetClazz() -{ - mClazz.erase(); - - if (mClazz.empty() == true) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - return LIBSBGN_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "source" attribute of this Arc. - */ -int -Arc::unsetSource() -{ - mSource.erase(); - - if (mSource.empty() == true) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - return LIBSBGN_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "target" attribute of this Arc. - */ -int -Arc::unsetTarget() -{ - mTarget.erase(); - - if (mTarget.empty() == true) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - return LIBSBGN_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "start" element of this Arc. - */ -const Point* -Arc::getStart() const -{ - return mStart; -} - - -/* - * Returns the value of the "start" element of this Arc. - */ -Point* -Arc::getStart() -{ - return mStart; -} - - -/* - * Returns the value of the "end" element of this Arc. - */ -const Point* -Arc::getEnd() const -{ - return mEnd; -} - - -/* - * Returns the value of the "end" element of this Arc. - */ -Point* -Arc::getEnd() -{ - return mEnd; -} - - -/* - * Predicate returning @c true if this Arc's "start" element is set. - */ -bool -Arc::isSetStart() const -{ - return (mStart != NULL); -} - - -/* - * Predicate returning @c true if this Arc's "end" element is set. - */ -bool -Arc::isSetEnd() const -{ - return (mEnd != NULL); -} - - -/* - * Sets the value of the "start" element of this Arc. - */ -int -Arc::setStart(const Point* start) -{ - if (mStart == start) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else if (start == NULL) - { - delete mStart; - mStart = NULL; - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - delete mStart; - mStart = (start != NULL) ? start->clone() : NULL; - if (mStart != NULL) - { - mStart->setElementName("start"); - mStart->connectToParent(this); - } - - return LIBSBGN_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "end" element of this Arc. - */ -int -Arc::setEnd(const Point* end) -{ - if (mEnd == end) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else if (end == NULL) - { - delete mEnd; - mEnd = NULL; - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - delete mEnd; - mEnd = (end != NULL) ? end->clone() : NULL; - if (mEnd != NULL) - { - mEnd->setElementName("end"); - mEnd->connectToParent(this); - } - - return LIBSBGN_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new Point object, adds it to this Arc object and returns the Point - * object created. - */ -Point* -Arc::createStart() -{ - if (mStart != NULL) - { - delete mStart; - } - - mStart = new Point(getSbgnNamespaces()); - - mStart->setElementName("start"); - - connectToChild(); - - return mStart; -} - - -/* - * Creates a new Point object, adds it to this Arc object and returns the Point - * object created. - */ -Point* -Arc::createEnd() -{ - if (mEnd != NULL) - { - delete mEnd; - } - - mEnd = new Point(getSbgnNamespaces()); - - mEnd->setElementName("end"); - - connectToChild(); - - return mEnd; -} - - -/* - * Unsets the value of the "start" element of this Arc. - */ -int -Arc::unsetStart() -{ - delete mStart; - mStart = NULL; - return LIBSBGN_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "end" element of this Arc. - */ -int -Arc::unsetEnd() -{ - delete mEnd; - mEnd = NULL; - return LIBSBGN_OPERATION_SUCCESS; -} - - -/* - * Returns the SbgnListOfGlyphs from this Arc. - */ -const SbgnListOfGlyphs* -Arc::getListOfGlyphs() const -{ - return &mGlyphs; -} - - -/* - * Returns the SbgnListOfGlyphs from this Arc. - */ -SbgnListOfGlyphs* -Arc::getListOfGlyphs() -{ - return &mGlyphs; -} - - -/* - * Get a Glyph from the Arc. - */ -Glyph* -Arc::getGlyph(unsigned int n) -{ - return mGlyphs.get(n); -} - - -/* - * Get a Glyph from the Arc. - */ -const Glyph* -Arc::getGlyph(unsigned int n) const -{ - return mGlyphs.get(n); -} - - -/* - * Get a Glyph from the Arc based on its identifier. - */ -Glyph* -Arc::getGlyph(const std::string& sid) -{ - return mGlyphs.get(sid); -} - - -/* - * Get a Glyph from the Arc based on its identifier. - */ -const Glyph* -Arc::getGlyph(const std::string& sid) const -{ - return mGlyphs.get(sid); -} - - -/* - * Adds a copy of the given Glyph to this Arc. - */ -int -Arc::addGlyph(const Glyph* g) -{ - if (g == NULL) - { - return LIBSBGN_OPERATION_FAILED; - } - else if (g->hasRequiredAttributes() == false) - { - return LIBSBGN_INVALID_OBJECT; - } - else if (getLevel() != g->getLevel()) - { - return LIBSBGN_LEVEL_MISMATCH; - } - else if (getVersion() != g->getVersion()) - { - return LIBSBGN_VERSION_MISMATCH; - } - else if (matchesRequiredSbgnNamespacesForAddition(static_cast(g)) == false) - { - return LIBSBGN_NAMESPACES_MISMATCH; - } - else if (g->isSetId() && (mGlyphs.get(g->getId())) != NULL) - { - return LIBSBGN_DUPLICATE_OBJECT_ID; - } - else - { - return mGlyphs.append(g); - } -} - - -/* - * Get the number of Glyph objects in this Arc. - */ -unsigned int -Arc::getNumGlyphs() const -{ - return mGlyphs.size(); -} - - -/* - * Creates a new Glyph object, adds it to this Arc object and returns the Glyph - * object created. - */ -Glyph* -Arc::createGlyph() -{ - Glyph* g = NULL; - - try - { - g = new Glyph(getSbgnNamespaces()); - } - catch (...) - { - } - - if (g != NULL) - { - mGlyphs.appendAndOwn(g); - } - - return g; -} - - -/* - * Removes the nth Glyph from this Arc and returns a pointer to it. - */ -Glyph* -Arc::removeGlyph(unsigned int n) -{ - return mGlyphs.remove(n); -} - - -/* - * Removes the Glyph from this Arc based on its identifier and returns a - * pointer to it. - */ -Glyph* -Arc::removeGlyph(const std::string& sid) -{ - return mGlyphs.remove(sid); -} - - -/* - * Returns the SbgnListOfPoints from this Arc. - */ -const SbgnListOfPoints* -Arc::getListOfNexts() const -{ - return &mPoints; -} - - -/* - * Returns the SbgnListOfPoints from this Arc. - */ -SbgnListOfPoints* -Arc::getListOfNexts() -{ - return &mPoints; -} - - -/* - * Get a Point from the Arc. - */ -Point* -Arc::getNext(unsigned int n) -{ - return mPoints.get(n); -} - - -/* - * Get a Point from the Arc. - */ -const Point* -Arc::getNext(unsigned int n) const -{ - return mPoints.get(n); -} - - -/* - * Adds a copy of the given Point to this Arc. - */ -int -Arc::addNext(const Point* p) -{ - if (p == NULL) - { - return LIBSBGN_OPERATION_FAILED; - } - else if (p->hasRequiredAttributes() == false) - { - return LIBSBGN_INVALID_OBJECT; - } - else if (getLevel() != p->getLevel()) - { - return LIBSBGN_LEVEL_MISMATCH; - } - else if (getVersion() != p->getVersion()) - { - return LIBSBGN_VERSION_MISMATCH; - } - else if (matchesRequiredSbgnNamespacesForAddition(static_cast(p)) == false) - { - return LIBSBGN_NAMESPACES_MISMATCH; - } - else - { - return mPoints.append(p); - } -} - - -/* - * Get the number of Point objects in this Arc. - */ -unsigned int -Arc::getNumNexts() const -{ - return mPoints.size(); -} - - -/* - * Creates a new Point object, adds it to this Arc object and returns the Point - * object created. - */ -Point* -Arc::createNext() -{ - Point* p = NULL; - - try - { - p = new Point(getSbgnNamespaces()); - } - catch (...) - { - } - - if (p != NULL) - { - p->setElementName("next"); - mPoints.appendAndOwn(p); - } - - return p; -} - - -/* - * Removes the nth Point from this Arc and returns a pointer to it. - */ -Point* -Arc::removeNext(unsigned int n) -{ - return mPoints.remove(n); -} - - -/* - * Returns the SbgnListOfPorts from this Arc. - */ -const SbgnListOfPorts* -Arc::getListOfPorts() const -{ - return &mPorts; -} - - -/* - * Returns the SbgnListOfPorts from this Arc. - */ -SbgnListOfPorts* -Arc::getListOfPorts() -{ - return &mPorts; -} - - -/* - * Get a Port from the Arc. - */ -Port* -Arc::getPort(unsigned int n) -{ - return mPorts.get(n); -} - - -/* - * Get a Port from the Arc. - */ -const Port* -Arc::getPort(unsigned int n) const -{ - return mPorts.get(n); -} - - -/* - * Get a Port from the Arc based on its identifier. - */ -Port* -Arc::getPort(const std::string& sid) -{ - return mPorts.get(sid); -} - - -/* - * Get a Port from the Arc based on its identifier. - */ -const Port* -Arc::getPort(const std::string& sid) const -{ - return mPorts.get(sid); -} - - -/* - * Adds a copy of the given Port to this Arc. - */ -int -Arc::addPort(const Port* p) -{ - if (p == NULL) - { - return LIBSBGN_OPERATION_FAILED; - } - else if (p->hasRequiredAttributes() == false) - { - return LIBSBGN_INVALID_OBJECT; - } - else if (getLevel() != p->getLevel()) - { - return LIBSBGN_LEVEL_MISMATCH; - } - else if (getVersion() != p->getVersion()) - { - return LIBSBGN_VERSION_MISMATCH; - } - else if (matchesRequiredSbgnNamespacesForAddition(static_cast(p)) == false) - { - return LIBSBGN_NAMESPACES_MISMATCH; - } - else if (p->isSetId() && (mPorts.get(p->getId())) != NULL) - { - return LIBSBGN_DUPLICATE_OBJECT_ID; - } - else - { - return mPorts.append(p); - } -} - - -/* - * Get the number of Port objects in this Arc. - */ -unsigned int -Arc::getNumPorts() const -{ - return mPorts.size(); -} - - -/* - * Creates a new Port object, adds it to this Arc object and returns the Port - * object created. - */ -Port* -Arc::createPort() -{ - Port* p = NULL; - - try - { - p = new Port(getSbgnNamespaces()); - } - catch (...) - { - } - - if (p != NULL) - { - mPorts.appendAndOwn(p); - } - - return p; -} - - -/* - * Removes the nth Port from this Arc and returns a pointer to it. - */ -Port* -Arc::removePort(unsigned int n) -{ - return mPorts.remove(n); -} - - -/* - * Removes the Port from this Arc based on its identifier and returns a pointer - * to it. - */ -Port* -Arc::removePort(const std::string& sid) -{ - return mPorts.remove(sid); -} - - -/* - * Returns the XML element name of this Arc object. - */ -const std::string& -Arc::getElementName() const -{ - static const string name = "arc"; - return name; -} - - -/* - * Returns the libSBGN type code for this Arc object. - */ -int -Arc::getTypeCode() const -{ - return SBGN_SBGNML_ARC; -} - - -/* - * Predicate returning @c true if all the required attributes for this Arc - * object have been set. - */ -bool -Arc::hasRequiredAttributes() const -{ - bool allPresent = SBase::hasRequiredAttributes(); - - if (isSetId() == false) - { - allPresent = false; - } - - if (isSetClazz() == false) - { - allPresent = false; - } - - if (isSetSource() == false) - { - allPresent = false; - } - - if (isSetTarget() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this Arc object - * have been set. - */ -bool -Arc::hasRequiredElements() const -{ - bool allPresent = SBase::hasRequiredElements(); - - if (isSetStart() == false) - { - allPresent = false; - } - - if (isSetEnd() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Write any contained elements - */ -void -Arc::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) - const -{ - SBase::writeElements(stream); - - if (isSetStart() == true) - { - mStart->write(stream); - } - - if (isSetEnd() == true) - { - mEnd->write(stream); - } - - for (unsigned int i = 0; i < getNumGlyphs(); i++) - { - getGlyph(i)->write(stream); - } - - for (unsigned int i = 0; i < getNumNexts(); i++) - { - getNext(i)->write(stream); - } - - for (unsigned int i = 0; i < getNumPorts(); i++) - { - getPort(i)->write(stream); - } -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Accepts the given SbgnVisitor - */ -bool -Arc::accept(SbgnVisitor& v) const -{ - return false; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the parent SbgnDocument - */ -void -Arc::setSbgnDocument(SbgnDocument* d) -{ - SBase::setSbgnDocument(d); - - if (mStart != NULL) - { - mStart->setSbgnDocument(d); - } - - if (mEnd != NULL) - { - mEnd->setSbgnDocument(d); - } - - mGlyphs.setSbgnDocument(d); - - mPoints.setSbgnDocument(d); - - mPorts.setSbgnDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Connects to child elements - */ -void -Arc::connectToChild() -{ - SBase::connectToChild(); - - if (mStart != NULL) - { - mStart->connectToParent(this); - } - - if (mEnd != NULL) - { - mEnd->connectToParent(this); - } - - mGlyphs.connectToParent(this); - - mPoints.connectToParent(this); - - mPorts.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::getAttribute(const std::string& attributeName, unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::getAttribute(const std::string& attributeName, std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBGN_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBGN_OPERATION_SUCCESS; - } - else if (attributeName == "class") - { - value = getClazz(); - return_value = LIBSBGN_OPERATION_SUCCESS; - } - else if (attributeName == "source") - { - value = getSource(); - return_value = LIBSBGN_OPERATION_SUCCESS; - } - else if (attributeName == "target") - { - value = getTarget(); - return_value = LIBSBGN_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Predicate returning @c true if this Arc's attribute "attributeName" is set. - */ -bool -Arc::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "class") - { - value = isSetClazz(); - } - else if (attributeName == "source") - { - value = isSetSource(); - } - else if (attributeName == "target") - { - value = isSetTarget(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::setAttribute(const std::string& attributeName, const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "class") - { - return_value = setClazz(value); - } - else if (attributeName == "source") - { - return_value = setSource(value); - } - else if (attributeName == "target") - { - return_value = setTarget(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Arc. - */ -int -Arc::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "class") - { - value = unsetClazz(); - } - else if (attributeName == "source") - { - value = unsetSource(); - } - else if (attributeName == "target") - { - value = unsetTarget(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Creates and returns an new "elementName" object in this Arc. - */ -SbgnBase* -Arc::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "start") - { - return createStart(); - } - else if (elementName == "end") - { - return createEnd(); - } - else if (elementName == "glyph") - { - return createGlyph(); - } - else if (elementName == "next") - { - return createNext(); - } - else if (elementName == "port") - { - return createPort(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Adds a new "elementName" object to this Arc. - */ -int -Arc::addChildObject(const std::string& elementName, const SbgnBase* element) -{ - if (elementName == "start" && element->getTypeCode() == SBGN_SBGNML_POINT) - { - return setStart((const Point*)(element)); - } - else if (elementName == "end" && element->getTypeCode() == SBGN_SBGNML_POINT) - { - return setEnd((const Point*)(element)); - } - else if (elementName == "glyph" && element->getTypeCode() == - SBGN_SBGNML_GLYPH) - { - return addGlyph((const Glyph*)(element)); - } - else if (elementName == "next" && element->getTypeCode() == - SBGN_SBGNML_POINT) - { - return addNext((const Point*)(element)); - } - else if (elementName == "port" && element->getTypeCode() == SBGN_SBGNML_PORT) - { - return addPort((const Port*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Arc. - */ -SbgnBase* -Arc::removeChildObject(const std::string& elementName, const std::string& id) -{ - if (elementName == "start") - { - Point * obj = mStart; - mStart = NULL; return obj; - } - else if (elementName == "end") - { - Point * obj = mEnd; - mEnd = NULL; return obj; - } - else if (elementName == "glyph") - { - return removeGlyph(id); - } - else if (elementName == "next") - { - for (unsigned int i = 0; i < getNumNexts(); i++) - { - if (getNext(i)->getId() == id) - { - return removeNext(i); - } - } - } - else if (elementName == "port") - { - return removePort(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Returns the number of "elementName" in this Arc. - */ -unsigned int -Arc::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "start") - { - if (isSetStart()) - { - return 1; - } - } - else if (elementName == "end") - { - if (isSetEnd()) - { - return 1; - } - } - else if (elementName == "glyph") - { - return getNumGlyphs(); - } - else if (elementName == "next") - { - return getNumNexts(); - } - else if (elementName == "port") - { - return getNumPorts(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Returns the nth object of "objectName" in this Arc. - */ -SbgnBase* -Arc::getObject(const std::string& elementName, unsigned int index) -{ - SbgnBase* obj = NULL; - - if (elementName == "start") - { - return getStart(); - } - else if (elementName == "end") - { - return getEnd(); - } - else if (elementName == "glyph") - { - return getGlyph(index); - } - else if (elementName == "next") - { - return getNext(index); - } - else if (elementName == "port") - { - return getPort(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SbgnBase* -Arc::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SbgnBase* obj = NULL; - - if (mStart != NULL) - { - if (mStart->getId() == id) - { - return mStart; - } - - obj = mStart->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mEnd != NULL) - { - if (mEnd->getId() == id) - { - return mEnd; - } - - obj = mEnd->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mGlyphs.getId() == id) - { - return &mGlyphs; - } - - obj = mGlyphs.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - obj = mPoints.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - if (mPorts.getId() == id) - { - return &mPorts; - } - - obj = mPorts.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SbgnBase* -Arc::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) -{ - SbgnBase* obj = SBase::createObject(stream); - - const std::string& name = stream.peek().getName(); - - if (name == "start") - { - if (getErrorLog() && isSetStart()) - { - getErrorLog()->logError(SbgnmlArcAllowedElements, getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mStart; - mStart = new Point(getSbgnNamespaces()); - mStart->setElementName(name); - obj = mStart; - } - else if (name == "end") - { - if (getErrorLog() && isSetEnd()) - { - getErrorLog()->logError(SbgnmlArcAllowedElements, getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mEnd; - mEnd = new Point(getSbgnNamespaces()); - mEnd->setElementName(name); - obj = mEnd; - } - else if (name == "glyph") - { - obj = mGlyphs.createObject(stream); - } - else if (name == "next") - { - obj = mPoints.createObject(stream); - } - else if (name == "port") - { - obj = mPorts.createObject(stream); - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Arc::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& - attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("class"); - - attributes.add("source"); - - attributes.add("target"); -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Arc::readAttributes( - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& - attributes, - const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int numErrs; - bool assigned = false; - SbgnErrorLog* log = getErrorLog(); - - if (log && getParentSbgnObject() && - static_cast(getParentSbgnObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == SbgnUnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(SbgnUnknownCoreAttribute); - log->logError(SbgnmlMapLOArcsAllowedCoreAttributes, level, version, - details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == SbgnUnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(SbgnUnknownCoreAttribute); - log->logError(SbgnmlArcAllowedAttributes, level, version, details, - getLine(), getColumn()); - } - } - } - - // - // id ID (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidXMLID(mId) == false) - { - logError(SbgnmlArcIdMustBeID, level, version, "The attribute id='" + mId - + "' does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Sbgnml attribute 'id' is missing from the " - "element."; - log->logError(SbgnmlArcAllowedAttributes, level, version, message, - getLine(), getColumn()); - } - } - - // - // class string (use = "required" ) - // - - assigned = attributes.readInto("class", mClazz); - - if (assigned == true) - { - if (mClazz.empty() == true) - { - logEmptyString(mClazz, level, version, ""); - } - } - else - { - if (log) - { - std::string message = "Sbgnml attribute 'class' is missing from the " - "element."; - log->logError(SbgnmlArcAllowedAttributes, level, version, message, - getLine(), getColumn()); - } - } - - // - // source IDREF (use = "required" ) - // - - assigned = attributes.readInto("source", mSource); - - if (assigned == true) - { - if (mSource.empty() == true) - { - logEmptyString(mSource, level, version, ""); - } - else if (SyntaxChecker::isValidXMLID(mSource) == false) - { - std::string msg = "The source attribute on the <" + getElementName() + - ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mSource + "', which does not conform to the syntax."; - logError(SbgnmlArcSourceMustBeID, level, version, msg, getLine(), - getColumn()); - } - } - else - { - if (log) - { - std::string message = "Sbgnml attribute 'source' is missing from the " - " element."; - log->logError(SbgnmlArcAllowedAttributes, level, version, message, - getLine(), getColumn()); - } - } - - // - // target IDREF (use = "required" ) - // - - assigned = attributes.readInto("target", mTarget); - - if (assigned == true) - { - if (mTarget.empty() == true) - { - logEmptyString(mTarget, level, version, ""); - } - else if (SyntaxChecker::isValidXMLID(mTarget) == false) - { - std::string msg = "The target attribute on the <" + getElementName() + - ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mTarget + "', which does not conform to the syntax."; - logError(SbgnmlArcTargetMustBeID, level, version, msg, getLine(), - getColumn()); - } - } - else - { - if (log) - { - std::string message = "Sbgnml attribute 'target' is missing from the " - " element."; - log->logError(SbgnmlArcAllowedAttributes, level, version, message, - getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Writes the attributes to the stream - */ -void -Arc::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) - const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetClazz() == true) - { - stream.writeAttribute("class", getPrefix(), mClazz); - } - - if (isSetSource() == true) - { - stream.writeAttribute("source", getPrefix(), mSource); - } - - if (isSetTarget() == true) - { - stream.writeAttribute("target", getPrefix(), mTarget); - } -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Arc_t using the given SBGN Level and @ p version values. - */ -LIBSBGN_EXTERN -Arc_t * -Arc_create(unsigned int level, unsigned int version) -{ - return new Arc(level, version); -} - - -/* - * Creates and returns a deep copy of this Arc_t object. - */ -LIBSBGN_EXTERN -Arc_t* -Arc_clone(const Arc_t* a) -{ - if (a != NULL) - { - return static_cast(a->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Arc_t object. - */ -LIBSBGN_EXTERN -void -Arc_free(Arc_t* a) -{ - if (a != NULL) - { - delete a; - } -} - - -/* - * Returns the value of the "id" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -char * -Arc_getId(const Arc_t * a) -{ - if (a == NULL) - { - return NULL; - } - - return a->getId().empty() ? NULL : safe_strdup(a->getId().c_str()); -} - - -/* - * Returns the value of the "class" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -char * -Arc_getClazz(const Arc_t * a) -{ - if (a == NULL) - { - return NULL; - } - - return a->getClazz().empty() ? NULL : safe_strdup(a->getClazz().c_str()); -} - - -/* - * Returns the value of the "source" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -char * -Arc_getSource(const Arc_t * a) -{ - if (a == NULL) - { - return NULL; - } - - return a->getSource().empty() ? NULL : safe_strdup(a->getSource().c_str()); -} - - -/* - * Returns the value of the "target" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -char * -Arc_getTarget(const Arc_t * a) -{ - if (a == NULL) - { - return NULL; - } - - return a->getTarget().empty() ? NULL : safe_strdup(a->getTarget().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this Arc_t's "id" attribute is set. - */ -LIBSBGN_EXTERN -int -Arc_isSetId(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Arc_t's "class" attribute is set. - */ -LIBSBGN_EXTERN -int -Arc_isSetClazz(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->isSetClazz()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Arc_t's "source" attribute is set. - */ -LIBSBGN_EXTERN -int -Arc_isSetSource(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->isSetSource()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Arc_t's "target" attribute is set. - */ -LIBSBGN_EXTERN -int -Arc_isSetTarget(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->isSetTarget()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_setId(Arc_t * a, const char * id) -{ - return (a != NULL) ? a->setId(id) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Sets the value of the "class" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_setClazz(Arc_t * a, const char * clazz) -{ - return (a != NULL) ? a->setClazz(clazz) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Sets the value of the "source" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_setSource(Arc_t * a, const char * source) -{ - return (a != NULL) ? a->setSource(source) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Sets the value of the "target" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_setTarget(Arc_t * a, const char * target) -{ - return (a != NULL) ? a->setTarget(target) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_unsetId(Arc_t * a) -{ - return (a != NULL) ? a->unsetId() : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "class" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_unsetClazz(Arc_t * a) -{ - return (a != NULL) ? a->unsetClazz() : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "source" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_unsetSource(Arc_t * a) -{ - return (a != NULL) ? a->unsetSource() : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "target" attribute of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_unsetTarget(Arc_t * a) -{ - return (a != NULL) ? a->unsetTarget() : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Returns the value of the "start" element of this Arc_t. - */ -LIBSBGN_EXTERN -const Point_t* -Arc_getStart(const Arc_t * a) -{ - if (a == NULL) - { - return NULL; - } - - return (Point_t*)(a->getStart()); -} - - -/* - * Returns the value of the "end" element of this Arc_t. - */ -LIBSBGN_EXTERN -const Point_t* -Arc_getEnd(const Arc_t * a) -{ - if (a == NULL) - { - return NULL; - } - - return (Point_t*)(a->getEnd()); -} - - -/* - * Predicate returning @c 1 (true) if this Arc_t's "start" element is set. - */ -LIBSBGN_EXTERN -int -Arc_isSetStart(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->isSetStart()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Arc_t's "end" element is set. - */ -LIBSBGN_EXTERN -int -Arc_isSetEnd(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->isSetEnd()) : 0; -} - - -/* - * Sets the value of the "start" element of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_setStart(Arc_t * a, const Point_t* start) -{ - return (a != NULL) ? a->setStart(start) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Sets the value of the "end" element of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_setEnd(Arc_t * a, const Point_t* end) -{ - return (a != NULL) ? a->setEnd(end) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Creates a new Point_t object, adds it to this Arc_t object and returns the - * Point_t object created. - */ -LIBSBGN_EXTERN -Point_t* -Arc_createStart(Arc_t* a) -{ - if (a == NULL) - { - return NULL; - } - - return (Point_t*)(a->createStart()); -} - - -/* - * Creates a new Point_t object, adds it to this Arc_t object and returns the - * Point_t object created. - */ -LIBSBGN_EXTERN -Point_t* -Arc_createEnd(Arc_t* a) -{ - if (a == NULL) - { - return NULL; - } - - return (Point_t*)(a->createEnd()); -} - - -/* - * Unsets the value of the "start" element of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_unsetStart(Arc_t * a) -{ - return (a != NULL) ? a->unsetStart() : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "end" element of this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_unsetEnd(Arc_t * a) -{ - return (a != NULL) ? a->unsetEnd() : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing Glyph_t objects from this Arc_t. - */ -LIBSBGN_EXTERN -SbgnListOf_t* -Arc_getListOfGlyphs(Arc_t* a) -{ - return (a != NULL) ? a->getListOfGlyphs() : NULL; -} - - -/* - * Get a Glyph_t from the Arc_t. - */ -LIBSBGN_EXTERN -Glyph_t* -Arc_getGlyph(Arc_t* a, unsigned int n) -{ - return (a != NULL) ? a->getGlyph(n) : NULL; -} - - -/* - * Get a Glyph_t from the Arc_t based on its identifier. - */ -LIBSBGN_EXTERN -Glyph_t* -Arc_getGlyphById(Arc_t* a, const char *sid) -{ - return (a != NULL && sid != NULL) ? a->getGlyph(sid) : NULL; -} - - -/* - * Adds a copy of the given Glyph_t to this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_addGlyph(Arc_t* a, const Glyph_t* g) -{ - return (a != NULL) ? a->addGlyph(g) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Get the number of Glyph_t objects in this Arc_t. - */ -LIBSBGN_EXTERN -unsigned int -Arc_getNumGlyphs(Arc_t* a) -{ - return (a != NULL) ? a->getNumGlyphs() : SBGN_INT_MAX; -} - - -/* - * Creates a new Glyph_t object, adds it to this Arc_t object and returns the - * Glyph_t object created. - */ -LIBSBGN_EXTERN -Glyph_t* -Arc_createGlyph(Arc_t* a) -{ - return (a != NULL) ? a->createGlyph() : NULL; -} - - -/* - * Removes the nth Glyph_t from this Arc_t and returns a pointer to it. - */ -LIBSBGN_EXTERN -Glyph_t* -Arc_removeGlyph(Arc_t* a, unsigned int n) -{ - return (a != NULL) ? a->removeGlyph(n) : NULL; -} - - -/* - * Removes the Glyph_t from this Arc_t based on its identifier and returns a - * pointer to it. - */ -LIBSBGN_EXTERN -Glyph_t* -Arc_removeGlyphById(Arc_t* a, const char* sid) -{ - return (a != NULL && sid != NULL) ? a->removeGlyph(sid) : NULL; -} - - -/* - * Returns a ListOf_t * containing Point_t objects from this Arc_t. - */ -LIBSBGN_EXTERN -SbgnListOf_t* -Arc_getListOfNexts(Arc_t* a) -{ - return (a != NULL) ? a->getListOfNexts() : NULL; -} - - -/* - * Get a Point_t from the Arc_t. - */ -LIBSBGN_EXTERN -Point_t* -Arc_getNext(Arc_t* a, unsigned int n) -{ - return (a != NULL) ? a->getNext(n) : NULL; -} - - -/* - * Adds a copy of the given Point_t to this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_addNext(Arc_t* a, const Point_t* p) -{ - return (a != NULL) ? a->addNext(p) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Get the number of Point_t objects in this Arc_t. - */ -LIBSBGN_EXTERN -unsigned int -Arc_getNumNexts(Arc_t* a) -{ - return (a != NULL) ? a->getNumNexts() : SBGN_INT_MAX; -} - - -/* - * Creates a new Point_t object, adds it to this Arc_t object and returns the - * Point_t object created. - */ -LIBSBGN_EXTERN -Point_t* -Arc_createNext(Arc_t* a) -{ - return (a != NULL) ? a->createNext() : NULL; -} - - -/* - * Removes the nth Point_t from this Arc_t and returns a pointer to it. - */ -LIBSBGN_EXTERN -Point_t* -Arc_removeNext(Arc_t* a, unsigned int n) -{ - return (a != NULL) ? a->removeNext(n) : NULL; -} - - -/* - * Returns a ListOf_t * containing Port_t objects from this Arc_t. - */ -LIBSBGN_EXTERN -SbgnListOf_t* -Arc_getListOfPorts(Arc_t* a) -{ - return (a != NULL) ? a->getListOfPorts() : NULL; -} - - -/* - * Get a Port_t from the Arc_t. - */ -LIBSBGN_EXTERN -Port_t* -Arc_getPort(Arc_t* a, unsigned int n) -{ - return (a != NULL) ? a->getPort(n) : NULL; -} - - -/* - * Get a Port_t from the Arc_t based on its identifier. - */ -LIBSBGN_EXTERN -Port_t* -Arc_getPortById(Arc_t* a, const char *sid) -{ - return (a != NULL && sid != NULL) ? a->getPort(sid) : NULL; -} - - -/* - * Adds a copy of the given Port_t to this Arc_t. - */ -LIBSBGN_EXTERN -int -Arc_addPort(Arc_t* a, const Port_t* p) -{ - return (a != NULL) ? a->addPort(p) : LIBSBGN_INVALID_OBJECT; -} - - -/* - * Get the number of Port_t objects in this Arc_t. - */ -LIBSBGN_EXTERN -unsigned int -Arc_getNumPorts(Arc_t* a) -{ - return (a != NULL) ? a->getNumPorts() : SBGN_INT_MAX; -} - - -/* - * Creates a new Port_t object, adds it to this Arc_t object and returns the - * Port_t object created. - */ -LIBSBGN_EXTERN -Port_t* -Arc_createPort(Arc_t* a) -{ - return (a != NULL) ? a->createPort() : NULL; -} - - -/* - * Removes the nth Port_t from this Arc_t and returns a pointer to it. - */ -LIBSBGN_EXTERN -Port_t* -Arc_removePort(Arc_t* a, unsigned int n) -{ - return (a != NULL) ? a->removePort(n) : NULL; -} - - -/* - * Removes the Port_t from this Arc_t based on its identifier and returns a - * pointer to it. - */ -LIBSBGN_EXTERN -Port_t* -Arc_removePortById(Arc_t* a, const char* sid) -{ - return (a != NULL && sid != NULL) ? a->removePort(sid) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Arc_t object have been set. - */ -LIBSBGN_EXTERN -int -Arc_hasRequiredAttributes(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this Arc_t - * object have been set. - */ -LIBSBGN_EXTERN -int -Arc_hasRequiredElements(const Arc_t * a) -{ - return (a != NULL) ? static_cast(a->hasRequiredElements()) : 0; -} - - - - -LIBSBGN_CPP_NAMESPACE_END - - +/** + * @file Arc.cpp + * @brief Implementation of the Arc class. + * @author DEVISER + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBGN_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Arc using the given SBGN Level and @ p version values. + */ +Arc::Arc(unsigned int level, unsigned int version) + : SBase(level, version) + , mClazz ("") + , mSource ("") + , mTarget ("") + , mGlyphs (level, version) + , mStart (NULL) + , mPoints (level, version) + , mEnd (NULL) + , mPorts (level, version) +{ + setSbgnNamespacesAndOwn(new SbgnNamespaces(level, version)); + mPoints.setElementName("next"); + connectToChild(); +} + + +/* + * Creates a new Arc using the given SbgnNamespaces object @p sbgnns. + */ +Arc::Arc(SbgnNamespaces *sbgnns) + : SBase(sbgnns) + , mClazz ("") + , mSource ("") + , mTarget ("") + , mGlyphs (sbgnns) + , mStart (NULL) + , mPoints (sbgnns) + , mEnd (NULL) + , mPorts (sbgnns) +{ + setElementNamespace(sbgnns->getURI()); + mPoints.setElementName("next"); + connectToChild(); +} + + +/* + * Copy constructor for Arc. + */ +Arc::Arc(const Arc& orig) + : SBase( orig ) + , mClazz ( orig.mClazz ) + , mSource ( orig.mSource ) + , mTarget ( orig.mTarget ) + , mGlyphs ( orig.mGlyphs ) + , mStart ( NULL ) + , mPoints ( orig.mPoints ) + , mEnd ( NULL ) + , mPorts ( orig.mPorts ) +{ + if (orig.mStart != NULL) + { + mStart = orig.mStart->clone(); + } + + if (orig.mEnd != NULL) + { + mEnd = orig.mEnd->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for Arc. + */ +Arc& +Arc::operator=(const Arc& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mClazz = rhs.mClazz; + mSource = rhs.mSource; + mTarget = rhs.mTarget; + mGlyphs = rhs.mGlyphs; + mPoints = rhs.mPoints; + mPorts = rhs.mPorts; + delete mStart; + if (rhs.mStart != NULL) + { + mStart = rhs.mStart->clone(); + } + else + { + mStart = NULL; + } + + delete mEnd; + if (rhs.mEnd != NULL) + { + mEnd = rhs.mEnd->clone(); + } + else + { + mEnd = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Arc object. + */ +Arc* +Arc::clone() const +{ + return new Arc(*this); +} + + +/* + * Destructor for Arc. + */ +Arc::~Arc() +{ + delete mStart; + mStart = NULL; + delete mEnd; + mEnd = NULL; +} + + +/* + * Returns the value of the "id" attribute of this Arc. + */ +const std::string& +Arc::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "class" attribute of this Arc. + */ +const std::string& +Arc::getClazz() const +{ + return mClazz; +} + + +/* + * Returns the value of the "source" attribute of this Arc. + */ +const std::string& +Arc::getSource() const +{ + return mSource; +} + + +/* + * Returns the value of the "target" attribute of this Arc. + */ +const std::string& +Arc::getTarget() const +{ + return mTarget; +} + + +/* + * Predicate returning @c true if this Arc's "id" attribute is set. + */ +bool +Arc::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this Arc's "class" attribute is set. + */ +bool +Arc::isSetClazz() const +{ + return (mClazz.empty() == false); +} + + +/* + * Predicate returning @c true if this Arc's "source" attribute is set. + */ +bool +Arc::isSetSource() const +{ + return (mSource.empty() == false); +} + + +/* + * Predicate returning @c true if this Arc's "target" attribute is set. + */ +bool +Arc::isSetTarget() const +{ + return (mTarget.empty() == false); +} + + +/* + * Sets the value of the "id" attribute of this Arc. + */ +int +Arc::setId(const std::string& id) +{ + if (!(SyntaxChecker::isValidXMLID(id))) + { + return LIBSBGN_INVALID_ATTRIBUTE_VALUE; + } + else + { + mId = id; + return LIBSBGN_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "class" attribute of this Arc. + */ +int +Arc::setClazz(const std::string& clazz) +{ + mClazz = clazz; + return LIBSBGN_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "source" attribute of this Arc. + */ +int +Arc::setSource(const std::string& source) +{ + if (!(SyntaxChecker::isValidXMLID(source))) + { + return LIBSBGN_INVALID_ATTRIBUTE_VALUE; + } + else + { + mSource = source; + return LIBSBGN_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "target" attribute of this Arc. + */ +int +Arc::setTarget(const std::string& target) +{ + if (!(SyntaxChecker::isValidXMLID(target))) + { + return LIBSBGN_INVALID_ATTRIBUTE_VALUE; + } + else + { + mTarget = target; + return LIBSBGN_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "id" attribute of this Arc. + */ +int +Arc::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBGN_OPERATION_SUCCESS; + } + else + { + return LIBSBGN_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "class" attribute of this Arc. + */ +int +Arc::unsetClazz() +{ + mClazz.erase(); + + if (mClazz.empty() == true) + { + return LIBSBGN_OPERATION_SUCCESS; + } + else + { + return LIBSBGN_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "source" attribute of this Arc. + */ +int +Arc::unsetSource() +{ + mSource.erase(); + + if (mSource.empty() == true) + { + return LIBSBGN_OPERATION_SUCCESS; + } + else + { + return LIBSBGN_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "target" attribute of this Arc. + */ +int +Arc::unsetTarget() +{ + mTarget.erase(); + + if (mTarget.empty() == true) + { + return LIBSBGN_OPERATION_SUCCESS; + } + else + { + return LIBSBGN_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "start" element of this Arc. + */ +const Point* +Arc::getStart() const +{ + return mStart; +} + + +/* + * Returns the value of the "start" element of this Arc. + */ +Point* +Arc::getStart() +{ + return mStart; +} + + +/* + * Returns the value of the "end" element of this Arc. + */ +const Point* +Arc::getEnd() const +{ + return mEnd; +} + + +/* + * Returns the value of the "end" element of this Arc. + */ +Point* +Arc::getEnd() +{ + return mEnd; +} + + +/* + * Predicate returning @c true if this Arc's "start" element is set. + */ +bool +Arc::isSetStart() const +{ + return (mStart != NULL); +} + + +/* + * Predicate returning @c true if this Arc's "end" element is set. + */ +bool +Arc::isSetEnd() const +{ + return (mEnd != NULL); +} + + +/* + * Sets the value of the "start" element of this Arc. + */ +int +Arc::setStart(const Point* start) +{ + if (mStart == start) + { + return LIBSBGN_OPERATION_SUCCESS; + } + else if (start == NULL) + { + delete mStart; + mStart = NULL; + return LIBSBGN_OPERATION_SUCCESS; + } + else + { + delete mStart; + mStart = (start != NULL) ? start->clone() : NULL; + if (mStart != NULL) + { + mStart->setElementName("start"); + mStart->connectToParent(this); + } + + return LIBSBGN_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "end" element of this Arc. + */ +int +Arc::setEnd(const Point* end) +{ + if (mEnd == end) + { + return LIBSBGN_OPERATION_SUCCESS; + } + else if (end == NULL) + { + delete mEnd; + mEnd = NULL; + return LIBSBGN_OPERATION_SUCCESS; + } + else + { + delete mEnd; + mEnd = (end != NULL) ? end->clone() : NULL; + if (mEnd != NULL) + { + mEnd->setElementName("end"); + mEnd->connectToParent(this); + } + + return LIBSBGN_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new Point object, adds it to this Arc object and returns the Point + * object created. + */ +Point* +Arc::createStart() +{ + if (mStart != NULL) + { + delete mStart; + } + + mStart = new Point(getSbgnNamespaces()); + + mStart->setElementName("start"); + + connectToChild(); + + return mStart; +} + + +/* + * Creates a new Point object, adds it to this Arc object and returns the Point + * object created. + */ +Point* +Arc::createEnd() +{ + if (mEnd != NULL) + { + delete mEnd; + } + + mEnd = new Point(getSbgnNamespaces()); + + mEnd->setElementName("end"); + + connectToChild(); + + return mEnd; +} + + +/* + * Unsets the value of the "start" element of this Arc. + */ +int +Arc::unsetStart() +{ + delete mStart; + mStart = NULL; + return LIBSBGN_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "end" element of this Arc. + */ +int +Arc::unsetEnd() +{ + delete mEnd; + mEnd = NULL; + return LIBSBGN_OPERATION_SUCCESS; +} + + +/* + * Returns the SbgnListOfGlyphs from this Arc. + */ +const SbgnListOfGlyphs* +Arc::getListOfGlyphs() const +{ + return &mGlyphs; +} + + +/* + * Returns the SbgnListOfGlyphs from this Arc. + */ +SbgnListOfGlyphs* +Arc::getListOfGlyphs() +{ + return &mGlyphs; +} + + +/* + * Get a Glyph from the Arc. + */ +Glyph* +Arc::getGlyph(unsigned int n) +{ + return mGlyphs.get(n); +} + + +/* + * Get a Glyph from the Arc. + */ +const Glyph* +Arc::getGlyph(unsigned int n) const +{ + return mGlyphs.get(n); +} + + +/* + * Get a Glyph from the Arc based on its identifier. + */ +Glyph* +Arc::getGlyph(const std::string& sid) +{ + return mGlyphs.get(sid); +} + + +/* + * Get a Glyph from the Arc based on its identifier. + */ +const Glyph* +Arc::getGlyph(const std::string& sid) const +{ + return mGlyphs.get(sid); +} + + +/* + * Adds a copy of the given Glyph to this Arc. + */ +int +Arc::addGlyph(const Glyph* g) +{ + if (g == NULL) + { + return LIBSBGN_OPERATION_FAILED; + } + else if (g->hasRequiredAttributes() == false) + { + return LIBSBGN_INVALID_OBJECT; + } + else if (getLevel() != g->getLevel()) + { + return LIBSBGN_LEVEL_MISMATCH; + } + else if (getVersion() != g->getVersion()) + { + return LIBSBGN_VERSION_MISMATCH; + } + else if (matchesRequiredSbgnNamespacesForAddition(static_cast(g)) == false) + { + return LIBSBGN_NAMESPACES_MISMATCH; + } + else if (g->isSetId() && (mGlyphs.get(g->getId())) != NULL) + { + return LIBSBGN_DUPLICATE_OBJECT_ID; + } + else + { + return mGlyphs.append(g); + } +} + + +/* + * Get the number of Glyph objects in this Arc. + */ +unsigned int +Arc::getNumGlyphs() const +{ + return mGlyphs.size(); +} + + +/* + * Creates a new Glyph object, adds it to this Arc object and returns the Glyph + * object created. + */ +Glyph* +Arc::createGlyph() +{ + Glyph* g = NULL; + + try + { + g = new Glyph(getSbgnNamespaces()); + } + catch (...) + { + } + + if (g != NULL) + { + mGlyphs.appendAndOwn(g); + } + + return g; +} + + +/* + * Removes the nth Glyph from this Arc and returns a pointer to it. + */ +Glyph* +Arc::removeGlyph(unsigned int n) +{ + return mGlyphs.remove(n); +} + + +/* + * Removes the Glyph from this Arc based on its identifier and returns a + * pointer to it. + */ +Glyph* +Arc::removeGlyph(const std::string& sid) +{ + return mGlyphs.remove(sid); +} + + +/* + * Returns the SbgnListOfPoints from this Arc. + */ +const SbgnListOfPoints* +Arc::getListOfNexts() const +{ + return &mPoints; +} + + +/* + * Returns the SbgnListOfPoints from this Arc. + */ +SbgnListOfPoints* +Arc::getListOfNexts() +{ + return &mPoints; +} + + +/* + * Get a Point from the Arc. + */ +Point* +Arc::getNext(unsigned int n) +{ + return mPoints.get(n); +} + + +/* + * Get a Point from the Arc. + */ +const Point* +Arc::getNext(unsigned int n) const +{ + return mPoints.get(n); +} + + +/* + * Adds a copy of the given Point to this Arc. + */ +int +Arc::addNext(const Point* p) +{ + if (p == NULL) + { + return LIBSBGN_OPERATION_FAILED; + } + else if (p->hasRequiredAttributes() == false) + { + return LIBSBGN_INVALID_OBJECT; + } + else if (getLevel() != p->getLevel()) + { + return LIBSBGN_LEVEL_MISMATCH; + } + else if (getVersion() != p->getVersion()) + { + return LIBSBGN_VERSION_MISMATCH; + } + else if (matchesRequiredSbgnNamespacesForAddition(static_cast(p)) == false) + { + return LIBSBGN_NAMESPACES_MISMATCH; + } + else + { + return mPoints.append(p); + } +} + + +/* + * Get the number of Point objects in this Arc. + */ +unsigned int +Arc::getNumNexts() const +{ + return mPoints.size(); +} + + +/* + * Creates a new Point object, adds it to this Arc object and returns the Point + * object created. + */ +Point* +Arc::createNext() +{ + Point* p = NULL; + + try + { + p = new Point(getSbgnNamespaces()); + } + catch (...) + { + } + + if (p != NULL) + { + p->setElementName("next"); + mPoints.appendAndOwn(p); + } + + return p; +} + + +/* + * Removes the nth Point from this Arc and returns a pointer to it. + */ +Point* +Arc::removeNext(unsigned int n) +{ + return mPoints.remove(n); +} + + +/* + * Returns the SbgnListOfPorts from this Arc. + */ +const SbgnListOfPorts* +Arc::getListOfPorts() const +{ + return &mPorts; +} + + +/* + * Returns the SbgnListOfPorts from this Arc. + */ +SbgnListOfPorts* +Arc::getListOfPorts() +{ + return &mPorts; +} + + +/* + * Get a Port from the Arc. + */ +Port* +Arc::getPort(unsigned int n) +{ + return mPorts.get(n); +} + + +/* + * Get a Port from the Arc. + */ +const Port* +Arc::getPort(unsigned int n) const +{ + return mPorts.get(n); +} + + +/* + * Get a Port from the Arc based on its identifier. + */ +Port* +Arc::getPort(const std::string& sid) +{ + return mPorts.get(sid); +} + + +/* + * Get a Port from the Arc based on its identifier. + */ +const Port* +Arc::getPort(const std::string& sid) const +{ + return mPorts.get(sid); +} + + +/* + * Adds a copy of the given Port to this Arc. + */ +int +Arc::addPort(const Port* p) +{ + if (p == NULL) + { + return LIBSBGN_OPERATION_FAILED; + } + else if (p->hasRequiredAttributes() == false) + { + return LIBSBGN_INVALID_OBJECT; + } + else if (getLevel() != p->getLevel()) + { + return LIBSBGN_LEVEL_MISMATCH; + } + else if (getVersion() != p->getVersion()) + { + return LIBSBGN_VERSION_MISMATCH; + } + else if (matchesRequiredSbgnNamespacesForAddition(static_cast(p)) == false) + { + return LIBSBGN_NAMESPACES_MISMATCH; + } + else if (p->isSetId() && (mPorts.get(p->getId())) != NULL) + { + return LIBSBGN_DUPLICATE_OBJECT_ID; + } + else + { + return mPorts.append(p); + } +} + + +/* + * Get the number of Port objects in this Arc. + */ +unsigned int +Arc::getNumPorts() const +{ + return mPorts.size(); +} + + +/* + * Creates a new Port object, adds it to this Arc object and returns the Port + * object created. + */ +Port* +Arc::createPort() +{ + Port* p = NULL; + + try + { + p = new Port(getSbgnNamespaces()); + } + catch (...) + { + } + + if (p != NULL) + { + mPorts.appendAndOwn(p); + } + + return p; +} + + +/* + * Removes the nth Port from this Arc and returns a pointer to it. + */ +Port* +Arc::removePort(unsigned int n) +{ + return mPorts.remove(n); +} + + +/* + * Removes the Port from this Arc based on its identifier and returns a pointer + * to it. + */ +Port* +Arc::removePort(const std::string& sid) +{ + return mPorts.remove(sid); +} + + +/* + * Returns the XML element name of this Arc object. + */ +const std::string& +Arc::getElementName() const +{ + static const string name = "arc"; + return name; +} + + +/* + * Returns the libSBGN type code for this Arc object. + */ +int +Arc::getTypeCode() const +{ + return SBGN_SBGNML_ARC; +} + + +/* + * Predicate returning @c true if all the required attributes for this Arc + * object have been set. + */ +bool +Arc::hasRequiredAttributes() const +{ + bool allPresent = SBase::hasRequiredAttributes(); + + if (isSetId() == false) + { + allPresent = false; + } + + if (isSetClazz() == false) + { + allPresent = false; + } + + if (isSetSource() == false) + { + allPresent = false; + } + + if (isSetTarget() == false) + { + allPresent = false; + } + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this Arc object + * have been set. + */ +bool +Arc::hasRequiredElements() const +{ + bool allPresent = SBase::hasRequiredElements(); + + if (isSetStart() == false) + { + allPresent = false; + } + + if (isSetEnd() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Write any contained elements + */ +void +Arc::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) + const +{ + SBase::writeElements(stream); + + if (isSetStart() == true) + { + mStart->write(stream); + } + + if (isSetEnd() == true) + { + mEnd->write(stream); + } + + for (unsigned int i = 0; i < getNumGlyphs(); i++) + { + getGlyph(i)->write(stream); + } + + for (unsigned int i = 0; i < getNumNexts(); i++) + { + getNext(i)->write(stream); + } + + for (unsigned int i = 0; i < getNumPorts(); i++) + { + getPort(i)->write(stream); + } +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Accepts the given SbgnVisitor + */ +bool +Arc::accept(SbgnVisitor& v) const +{ + return false; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Sets the parent SbgnDocument + */ +void +Arc::setSbgnDocument(SbgnDocument* d) +{ + SBase::setSbgnDocument(d); + + if (mStart != NULL) + { + mStart->setSbgnDocument(d); + } + + if (mEnd != NULL) + { + mEnd->setSbgnDocument(d); + } + + mGlyphs.setSbgnDocument(d); + + mPoints.setSbgnDocument(d); + + mPorts.setSbgnDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Connects to child elements + */ +void +Arc::connectToChild() +{ + SBase::connectToChild(); + + if (mStart != NULL) + { + mStart->connectToParent(this); + } + + if (mEnd != NULL) + { + mEnd->connectToParent(this); + } + + mGlyphs.connectToParent(this); + + mPoints.connectToParent(this); + + mPorts.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::getAttribute(const std::string& attributeName, unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::getAttribute(const std::string& attributeName, std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBGN_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBGN_OPERATION_SUCCESS; + } + else if (attributeName == "class") + { + value = getClazz(); + return_value = LIBSBGN_OPERATION_SUCCESS; + } + else if (attributeName == "source") + { + value = getSource(); + return_value = LIBSBGN_OPERATION_SUCCESS; + } + else if (attributeName == "target") + { + value = getTarget(); + return_value = LIBSBGN_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Predicate returning @c true if this Arc's attribute "attributeName" is set. + */ +bool +Arc::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "class") + { + value = isSetClazz(); + } + else if (attributeName == "source") + { + value = isSetSource(); + } + else if (attributeName == "target") + { + value = isSetTarget(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::setAttribute(const std::string& attributeName, const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "class") + { + return_value = setClazz(value); + } + else if (attributeName == "source") + { + return_value = setSource(value); + } + else if (attributeName == "target") + { + return_value = setTarget(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Arc. + */ +int +Arc::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "class") + { + value = unsetClazz(); + } + else if (attributeName == "source") + { + value = unsetSource(); + } + else if (attributeName == "target") + { + value = unsetTarget(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Creates and returns an new "elementName" object in this Arc. + */ +SbgnBase* +Arc::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "start") + { + return createStart(); + } + else if (elementName == "end") + { + return createEnd(); + } + else if (elementName == "glyph") + { + return createGlyph(); + } + else if (elementName == "next") + { + return createNext(); + } + else if (elementName == "port") + { + return createPort(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Adds a new "elementName" object to this Arc. + */ +int +Arc::addChildObject(const std::string& elementName, const SbgnBase* element) +{ + if (elementName == "start" && element->getTypeCode() == SBGN_SBGNML_POINT) + { + return setStart((const Point*)(element)); + } + else if (elementName == "end" && element->getTypeCode() == SBGN_SBGNML_POINT) + { + return setEnd((const Point*)(element)); + } + else if (elementName == "glyph" && element->getTypeCode() == + SBGN_SBGNML_GLYPH) + { + return addGlyph((const Glyph*)(element)); + } + else if (elementName == "next" && element->getTypeCode() == + SBGN_SBGNML_POINT) + { + return addNext((const Point*)(element)); + } + else if (elementName == "port" && element->getTypeCode() == SBGN_SBGNML_PORT) + { + return addPort((const Port*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * Arc. + */ +SbgnBase* +Arc::removeChildObject(const std::string& elementName, const std::string& id) +{ + if (elementName == "start") + { + Point * obj = mStart; + mStart = NULL; return obj; + } + else if (elementName == "end") + { + Point * obj = mEnd; + mEnd = NULL; return obj; + } + else if (elementName == "glyph") + { + return removeGlyph(id); + } + else if (elementName == "next") + { + for (unsigned int i = 0; i < getNumNexts(); i++) + { + if (getNext(i)->getId() == id) + { + return removeNext(i); + } + } + } + else if (elementName == "port") + { + return removePort(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Returns the number of "elementName" in this Arc. + */ +unsigned int +Arc::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "start") + { + if (isSetStart()) + { + return 1; + } + } + else if (elementName == "end") + { + if (isSetEnd()) + { + return 1; + } + } + else if (elementName == "glyph") + { + return getNumGlyphs(); + } + else if (elementName == "next") + { + return getNumNexts(); + } + else if (elementName == "port") + { + return getNumPorts(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Returns the nth object of "objectName" in this Arc. + */ +SbgnBase* +Arc::getObject(const std::string& elementName, unsigned int index) +{ + SbgnBase* obj = NULL; + + if (elementName == "start") + { + return getStart(); + } + else if (elementName == "end") + { + return getEnd(); + } + else if (elementName == "glyph") + { + return getGlyph(index); + } + else if (elementName == "next") + { + return getNext(index); + } + else if (elementName == "port") + { + return getPort(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SbgnBase* +Arc::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SbgnBase* obj = NULL; + + if (mStart != NULL) + { + if (mStart->getId() == id) + { + return mStart; + } + + obj = mStart->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mEnd != NULL) + { + if (mEnd->getId() == id) + { + return mEnd; + } + + obj = mEnd->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mGlyphs.getId() == id) + { + return &mGlyphs; + } + + obj = mGlyphs.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + obj = mPoints.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + if (mPorts.getId() == id) + { + return &mPorts; + } + + obj = mPorts.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SbgnBase* +Arc::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) +{ + SbgnBase* obj = SBase::createObject(stream); + + const std::string& name = stream.peek().getName(); + + if (name == "start") + { + if (getErrorLog() && isSetStart()) + { + getErrorLog()->logError(SbgnmlArcAllowedElements, getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mStart; + mStart = new Point(getSbgnNamespaces()); + mStart->setElementName(name); + obj = mStart; + } + else if (name == "end") + { + if (getErrorLog() && isSetEnd()) + { + getErrorLog()->logError(SbgnmlArcAllowedElements, getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mEnd; + mEnd = new Point(getSbgnNamespaces()); + mEnd->setElementName(name); + obj = mEnd; + } + else if (name == "glyph") + { + obj = mGlyphs.createObject(stream); + } + else if (name == "next") + { + obj = mPoints.createObject(stream); + } + else if (name == "port") + { + obj = mPorts.createObject(stream); + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Arc::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& + attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("class"); + + attributes.add("source"); + + attributes.add("target"); +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Arc::readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& + attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int numErrs; + bool assigned = false; + SbgnErrorLog* log = getErrorLog(); + + if (log && getParentSbgnObject() && + static_cast(getParentSbgnObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == SbgnUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(SbgnUnknownCoreAttribute); + log->logError(SbgnmlMapLOArcsAllowedCoreAttributes, level, version, + details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == SbgnUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(SbgnUnknownCoreAttribute); + log->logError(SbgnmlArcAllowedAttributes, level, version, details, + getLine(), getColumn()); + } + } + } + + // + // id ID (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidXMLID(mId) == false) + { + logError(SbgnmlArcIdMustBeID, level, version, "The attribute id='" + mId + + "' does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Sbgnml attribute 'id' is missing from the " + "element."; + log->logError(SbgnmlArcAllowedAttributes, level, version, message, + getLine(), getColumn()); + } + } + + // + // class string (use = "required" ) + // + + assigned = attributes.readInto("class", mClazz); + + if (assigned == true) + { + if (mClazz.empty() == true) + { + logEmptyString(mClazz, level, version, ""); + } + } + else + { + if (log) + { + std::string message = "Sbgnml attribute 'class' is missing from the " + "element."; + log->logError(SbgnmlArcAllowedAttributes, level, version, message, + getLine(), getColumn()); + } + } + + // + // source IDREF (use = "required" ) + // + + assigned = attributes.readInto("source", mSource); + + if (assigned == true) + { + if (mSource.empty() == true) + { + logEmptyString(mSource, level, version, ""); + } + else if (SyntaxChecker::isValidXMLID(mSource) == false) + { + std::string msg = "The source attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mSource + "', which does not conform to the syntax."; + logError(SbgnmlArcSourceMustBeID, level, version, msg, getLine(), + getColumn()); + } + } + else + { + if (log) + { + std::string message = "Sbgnml attribute 'source' is missing from the " + " element."; + log->logError(SbgnmlArcAllowedAttributes, level, version, message, + getLine(), getColumn()); + } + } + + // + // target IDREF (use = "required" ) + // + + assigned = attributes.readInto("target", mTarget); + + if (assigned == true) + { + if (mTarget.empty() == true) + { + logEmptyString(mTarget, level, version, ""); + } + else if (SyntaxChecker::isValidXMLID(mTarget) == false) + { + std::string msg = "The target attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mTarget + "', which does not conform to the syntax."; + logError(SbgnmlArcTargetMustBeID, level, version, msg, getLine(), + getColumn()); + } + } + else + { + if (log) + { + std::string message = "Sbgnml attribute 'target' is missing from the " + " element."; + log->logError(SbgnmlArcAllowedAttributes, level, version, message, + getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenlibSBGNInternal */ + +/* + * Writes the attributes to the stream + */ +void +Arc::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) + const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetClazz() == true) + { + stream.writeAttribute("class", getPrefix(), mClazz); + } + + if (isSetSource() == true) + { + stream.writeAttribute("source", getPrefix(), mSource); + } + + if (isSetTarget() == true) + { + stream.writeAttribute("target", getPrefix(), mTarget); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Arc_t using the given SBGN Level and @ p version values. + */ +LIBSBGN_EXTERN +Arc_t * +Arc_create(unsigned int level, unsigned int version) +{ + return new Arc(level, version); +} + + +/* + * Creates and returns a deep copy of this Arc_t object. + */ +LIBSBGN_EXTERN +Arc_t* +Arc_clone(const Arc_t* a) +{ + if (a != NULL) + { + return static_cast(a->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Arc_t object. + */ +LIBSBGN_EXTERN +void +Arc_free(Arc_t* a) +{ + if (a != NULL) + { + delete a; + } +} + + +/* + * Returns the value of the "id" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +char * +Arc_getId(const Arc_t * a) +{ + if (a == NULL) + { + return NULL; + } + + return a->getId().empty() ? NULL : safe_strdup(a->getId().c_str()); +} + + +/* + * Returns the value of the "class" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +char * +Arc_getClazz(const Arc_t * a) +{ + if (a == NULL) + { + return NULL; + } + + return a->getClazz().empty() ? NULL : safe_strdup(a->getClazz().c_str()); +} + + +/* + * Returns the value of the "source" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +char * +Arc_getSource(const Arc_t * a) +{ + if (a == NULL) + { + return NULL; + } + + return a->getSource().empty() ? NULL : safe_strdup(a->getSource().c_str()); +} + + +/* + * Returns the value of the "target" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +char * +Arc_getTarget(const Arc_t * a) +{ + if (a == NULL) + { + return NULL; + } + + return a->getTarget().empty() ? NULL : safe_strdup(a->getTarget().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this Arc_t's "id" attribute is set. + */ +LIBSBGN_EXTERN +int +Arc_isSetId(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Arc_t's "class" attribute is set. + */ +LIBSBGN_EXTERN +int +Arc_isSetClazz(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->isSetClazz()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Arc_t's "source" attribute is set. + */ +LIBSBGN_EXTERN +int +Arc_isSetSource(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->isSetSource()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Arc_t's "target" attribute is set. + */ +LIBSBGN_EXTERN +int +Arc_isSetTarget(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->isSetTarget()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_setId(Arc_t * a, const char * id) +{ + return (a != NULL) ? a->setId(id) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Sets the value of the "class" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_setClazz(Arc_t * a, const char * clazz) +{ + return (a != NULL) ? a->setClazz(clazz) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Sets the value of the "source" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_setSource(Arc_t * a, const char * source) +{ + return (a != NULL) ? a->setSource(source) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Sets the value of the "target" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_setTarget(Arc_t * a, const char * target) +{ + return (a != NULL) ? a->setTarget(target) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_unsetId(Arc_t * a) +{ + return (a != NULL) ? a->unsetId() : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "class" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_unsetClazz(Arc_t * a) +{ + return (a != NULL) ? a->unsetClazz() : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "source" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_unsetSource(Arc_t * a) +{ + return (a != NULL) ? a->unsetSource() : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "target" attribute of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_unsetTarget(Arc_t * a) +{ + return (a != NULL) ? a->unsetTarget() : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Returns the value of the "start" element of this Arc_t. + */ +LIBSBGN_EXTERN +const Point_t* +Arc_getStart(const Arc_t * a) +{ + if (a == NULL) + { + return NULL; + } + + return (Point_t*)(a->getStart()); +} + + +/* + * Returns the value of the "end" element of this Arc_t. + */ +LIBSBGN_EXTERN +const Point_t* +Arc_getEnd(const Arc_t * a) +{ + if (a == NULL) + { + return NULL; + } + + return (Point_t*)(a->getEnd()); +} + + +/* + * Predicate returning @c 1 (true) if this Arc_t's "start" element is set. + */ +LIBSBGN_EXTERN +int +Arc_isSetStart(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->isSetStart()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Arc_t's "end" element is set. + */ +LIBSBGN_EXTERN +int +Arc_isSetEnd(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->isSetEnd()) : 0; +} + + +/* + * Sets the value of the "start" element of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_setStart(Arc_t * a, const Point_t* start) +{ + return (a != NULL) ? a->setStart(start) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Sets the value of the "end" element of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_setEnd(Arc_t * a, const Point_t* end) +{ + return (a != NULL) ? a->setEnd(end) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Creates a new Point_t object, adds it to this Arc_t object and returns the + * Point_t object created. + */ +LIBSBGN_EXTERN +Point_t* +Arc_createStart(Arc_t* a) +{ + if (a == NULL) + { + return NULL; + } + + return (Point_t*)(a->createStart()); +} + + +/* + * Creates a new Point_t object, adds it to this Arc_t object and returns the + * Point_t object created. + */ +LIBSBGN_EXTERN +Point_t* +Arc_createEnd(Arc_t* a) +{ + if (a == NULL) + { + return NULL; + } + + return (Point_t*)(a->createEnd()); +} + + +/* + * Unsets the value of the "start" element of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_unsetStart(Arc_t * a) +{ + return (a != NULL) ? a->unsetStart() : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "end" element of this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_unsetEnd(Arc_t * a) +{ + return (a != NULL) ? a->unsetEnd() : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing Glyph_t objects from this Arc_t. + */ +LIBSBGN_EXTERN +SbgnListOf_t* +Arc_getListOfGlyphs(Arc_t* a) +{ + return (a != NULL) ? a->getListOfGlyphs() : NULL; +} + + +/* + * Get a Glyph_t from the Arc_t. + */ +LIBSBGN_EXTERN +Glyph_t* +Arc_getGlyph(Arc_t* a, unsigned int n) +{ + return (a != NULL) ? a->getGlyph(n) : NULL; +} + + +/* + * Get a Glyph_t from the Arc_t based on its identifier. + */ +LIBSBGN_EXTERN +Glyph_t* +Arc_getGlyphById(Arc_t* a, const char *sid) +{ + return (a != NULL && sid != NULL) ? a->getGlyph(sid) : NULL; +} + + +/* + * Adds a copy of the given Glyph_t to this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_addGlyph(Arc_t* a, const Glyph_t* g) +{ + return (a != NULL) ? a->addGlyph(g) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Get the number of Glyph_t objects in this Arc_t. + */ +LIBSBGN_EXTERN +unsigned int +Arc_getNumGlyphs(Arc_t* a) +{ + return (a != NULL) ? a->getNumGlyphs() : SBGN_INT_MAX; +} + + +/* + * Creates a new Glyph_t object, adds it to this Arc_t object and returns the + * Glyph_t object created. + */ +LIBSBGN_EXTERN +Glyph_t* +Arc_createGlyph(Arc_t* a) +{ + return (a != NULL) ? a->createGlyph() : NULL; +} + + +/* + * Removes the nth Glyph_t from this Arc_t and returns a pointer to it. + */ +LIBSBGN_EXTERN +Glyph_t* +Arc_removeGlyph(Arc_t* a, unsigned int n) +{ + return (a != NULL) ? a->removeGlyph(n) : NULL; +} + + +/* + * Removes the Glyph_t from this Arc_t based on its identifier and returns a + * pointer to it. + */ +LIBSBGN_EXTERN +Glyph_t* +Arc_removeGlyphById(Arc_t* a, const char* sid) +{ + return (a != NULL && sid != NULL) ? a->removeGlyph(sid) : NULL; +} + + +/* + * Returns a ListOf_t * containing Point_t objects from this Arc_t. + */ +LIBSBGN_EXTERN +SbgnListOf_t* +Arc_getListOfNexts(Arc_t* a) +{ + return (a != NULL) ? a->getListOfNexts() : NULL; +} + + +/* + * Get a Point_t from the Arc_t. + */ +LIBSBGN_EXTERN +Point_t* +Arc_getNext(Arc_t* a, unsigned int n) +{ + return (a != NULL) ? a->getNext(n) : NULL; +} + + +/* + * Adds a copy of the given Point_t to this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_addNext(Arc_t* a, const Point_t* p) +{ + return (a != NULL) ? a->addNext(p) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Get the number of Point_t objects in this Arc_t. + */ +LIBSBGN_EXTERN +unsigned int +Arc_getNumNexts(Arc_t* a) +{ + return (a != NULL) ? a->getNumNexts() : SBGN_INT_MAX; +} + + +/* + * Creates a new Point_t object, adds it to this Arc_t object and returns the + * Point_t object created. + */ +LIBSBGN_EXTERN +Point_t* +Arc_createNext(Arc_t* a) +{ + return (a != NULL) ? a->createNext() : NULL; +} + + +/* + * Removes the nth Point_t from this Arc_t and returns a pointer to it. + */ +LIBSBGN_EXTERN +Point_t* +Arc_removeNext(Arc_t* a, unsigned int n) +{ + return (a != NULL) ? a->removeNext(n) : NULL; +} + + +/* + * Returns a ListOf_t * containing Port_t objects from this Arc_t. + */ +LIBSBGN_EXTERN +SbgnListOf_t* +Arc_getListOfPorts(Arc_t* a) +{ + return (a != NULL) ? a->getListOfPorts() : NULL; +} + + +/* + * Get a Port_t from the Arc_t. + */ +LIBSBGN_EXTERN +Port_t* +Arc_getPort(Arc_t* a, unsigned int n) +{ + return (a != NULL) ? a->getPort(n) : NULL; +} + + +/* + * Get a Port_t from the Arc_t based on its identifier. + */ +LIBSBGN_EXTERN +Port_t* +Arc_getPortById(Arc_t* a, const char *sid) +{ + return (a != NULL && sid != NULL) ? a->getPort(sid) : NULL; +} + + +/* + * Adds a copy of the given Port_t to this Arc_t. + */ +LIBSBGN_EXTERN +int +Arc_addPort(Arc_t* a, const Port_t* p) +{ + return (a != NULL) ? a->addPort(p) : LIBSBGN_INVALID_OBJECT; +} + + +/* + * Get the number of Port_t objects in this Arc_t. + */ +LIBSBGN_EXTERN +unsigned int +Arc_getNumPorts(Arc_t* a) +{ + return (a != NULL) ? a->getNumPorts() : SBGN_INT_MAX; +} + + +/* + * Creates a new Port_t object, adds it to this Arc_t object and returns the + * Port_t object created. + */ +LIBSBGN_EXTERN +Port_t* +Arc_createPort(Arc_t* a) +{ + return (a != NULL) ? a->createPort() : NULL; +} + + +/* + * Removes the nth Port_t from this Arc_t and returns a pointer to it. + */ +LIBSBGN_EXTERN +Port_t* +Arc_removePort(Arc_t* a, unsigned int n) +{ + return (a != NULL) ? a->removePort(n) : NULL; +} + + +/* + * Removes the Port_t from this Arc_t based on its identifier and returns a + * pointer to it. + */ +LIBSBGN_EXTERN +Port_t* +Arc_removePortById(Arc_t* a, const char* sid) +{ + return (a != NULL && sid != NULL) ? a->removePort(sid) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Arc_t object have been set. + */ +LIBSBGN_EXTERN +int +Arc_hasRequiredAttributes(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this Arc_t + * object have been set. + */ +LIBSBGN_EXTERN +int +Arc_hasRequiredElements(const Arc_t * a) +{ + return (a != NULL) ? static_cast(a->hasRequiredElements()) : 0; +} + + + + +LIBSBGN_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ArrayChild.cpp b/generator/tests/test_cpp_code/test-code/ArrayChild.cpp index 5cb11de9..3a493222 100644 --- a/generator/tests/test_cpp_code/test-code/ArrayChild.cpp +++ b/generator/tests/test_cpp_code/test-code/ArrayChild.cpp @@ -1,1246 +1,1246 @@ -/** - * @file ArrayChild.cpp - * @brief Implementation of the ArrayChild class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ArrayChild using the given SBML Level, Version and - * “test” package version. - */ -ArrayChild::ArrayChild(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mUnit (NULL) - , mNumber (NULL) -{ - setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new ArrayChild using the given TestPkgNamespaces object. - */ -ArrayChild::ArrayChild(TestPkgNamespaces *testns) - : SBase(testns) - , mUnit (NULL) - , mNumber (NULL) -{ - setElementNamespace(testns->getURI()); - connectToChild(); - loadPlugins(testns); -} - - -/* - * Copy constructor for ArrayChild. - */ -ArrayChild::ArrayChild(const ArrayChild& orig) - : SBase( orig ) - , mUnit ( NULL ) - , mNumber ( NULL ) -{ - setNumber(orig.mNumber, orig.mNumberLength); - - if (orig.mUnit != NULL) - { - mUnit = orig.mUnit->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for ArrayChild. - */ -ArrayChild& -ArrayChild::operator=(const ArrayChild& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mNumber = NULL; - setNumber(rhs.mNumber, rhs.mNumberLength); - delete mUnit; - if (rhs.mUnit != NULL) - { - mUnit = rhs.mUnit->clone(); - } - else - { - mUnit = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ArrayChild object. - */ -ArrayChild* -ArrayChild::clone() const -{ - return new ArrayChild(*this); -} - - -/* - * Destructor for ArrayChild. - */ -ArrayChild::~ArrayChild() -{ - if (mNumber != NULL) - { - delete [] mNumber; - } - - mNumber = NULL; - - delete mUnit; - mUnit = NULL; -} - - -/* - * Returns the value of the "number" attribute of this ArrayChild. - */ -void -ArrayChild::getNumber(double* outArray) const -{ - if (outArray == NULL || mNumber == NULL) - { - return; - } - - memcpy(outArray, mNumber, sizeof(double)*mNumberLength); -} - - -/* - * Predicate returning @c true if this ArrayChild's "number" attribute is set. - */ -bool -ArrayChild::isSetNumber() const -{ - return (mNumber != NULL); -} - - -/* - * Sets the value of the "number" attribute of this ArrayChild. - */ -int -ArrayChild::setNumber(double* inArray, int arrayLength) -{ - if (inArray == NULL) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - if (mNumber != NULL) - { - delete[] mNumber; - } - - mNumber = new double[arrayLength]; - memcpy(mNumber, inArray, sizeof(double)*arrayLength); - mIsSetNumberLength = true; - mNumberLength = arrayLength; - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "number" attribute of this ArrayChild. - */ -int -ArrayChild::unsetNumber() -{ - if (mNumber != NULL) - { - delete[] mNumber; - } - - mNumber = NULL; - - return unsetNumberLength(); -} - - -/* - * Returns the value of the "unit" element of this ArrayChild. - */ -const Unit* -ArrayChild::getUnit() const -{ - return mUnit; -} - - -/* - * Returns the value of the "unit" element of this ArrayChild. - */ -Unit* -ArrayChild::getUnit() -{ - return mUnit; -} - - -/* - * Predicate returning @c true if this ArrayChild's "unit" element is set. - */ -bool -ArrayChild::isSetUnit() const -{ - return (mUnit != NULL); -} - - -/* - * Sets the value of the "unit" element of this ArrayChild. - */ -int -ArrayChild::setUnit(const Unit* unit) -{ - if (mUnit == unit) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (unit == NULL) - { - delete mUnit; - mUnit = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mUnit; - mUnit = (unit != NULL) ? unit->clone() : NULL; - if (mUnit != NULL) - { - mUnit->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new Unit object, adds it to this ArrayChild object and returns the - * Unit object created. - */ -Unit* -ArrayChild::createUnit() -{ - if (mUnit != NULL) - { - delete mUnit; - } - - TEST_CREATE_NS(testns, getSBMLNamespaces()); - mUnit = new Unit(testns); - - delete testns; - - connectToChild(); - - return mUnit; -} - - -/* - * Unsets the value of the "unit" element of this ArrayChild. - */ -int -ArrayChild::unsetUnit() -{ - delete mUnit; - mUnit = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this ArrayChild object. - */ -const std::string& -ArrayChild::getElementName() const -{ - static const string name = "arrayChild"; - return name; -} - - -/* - * Returns the libSBML type code for this ArrayChild object. - */ -int -ArrayChild::getTypeCode() const -{ - return SBML_TEST_ARRAYCHILD; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * ArrayChild object have been set. - */ -bool -ArrayChild::hasRequiredAttributes() const -{ - bool allPresent = true; - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ArrayChild::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetUnit() == true) - { - mUnit->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ArrayChild::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mUnit != NULL) - { - mUnit->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ArrayChild::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mUnit != NULL) - { - mUnit->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * used to write arrays - */ -void -ArrayChild::write(XMLOutputStream& stream) const -{ - stream.startElement(getElementName(), getPrefix()); - writeAttributes(stream); - - if (isSetNumber()) - { - for (int i = 0; i < mNumberLength; ++i) - { - stream << (double)mNumber[i] << " "; - } - } - - stream.endElement(getElementName(), getPrefix()); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -ArrayChild::connectToChild() -{ - SBase::connectToChild(); - - if (mUnit != NULL) - { - mUnit->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ArrayChild::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetUnit()) - { - mUnit->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -ArrayChild::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mUnit != NULL) - { - mUnit->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ArrayChild's attribute "attributeName" - * is set. - */ -bool -ArrayChild::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "number") - { - value = isSetNumber(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this ArrayChild. - */ -int -ArrayChild::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "number") - { - value = unsetNumber(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this ArrayChild. - */ -SBase* -ArrayChild::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "unit") - { - return createUnit(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this ArrayChild. - */ -int -ArrayChild::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "unit" && element->getTypeCode() == SBML_TEST_UNIT) - { - return setUnit((const Unit*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * ArrayChild. - */ -SBase* -ArrayChild::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "unit") - { - Unit * obj = mUnit; - mUnit = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this ArrayChild. - */ -unsigned int -ArrayChild::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "unit") - { - if (isSetUnit()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this ArrayChild. - */ -SBase* -ArrayChild::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "unit") - { - return getUnit(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -ArrayChild::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mUnit != NULL) - { - if (mUnit->getId() == id) - { - return mUnit; - } - - obj = mUnit->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -ArrayChild::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mUnit != NULL) - { - if (mUnit->getMetaId() == metaid) - { - return mUnit; - } - - obj = mUnit->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -ArrayChild::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mUnit, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -ArrayChild::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - TEST_CREATE_NS(testns, getSBMLNamespaces()); - - if (name == "unit") - { - if (getErrorLog() && isSetUnit()) - { - getErrorLog()->logPackageError("test", TestArrayChildAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mUnit; - mUnit = new Unit(testns); - obj = mUnit; - } - - delete testns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -ArrayChild::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ArrayChild::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("test", TestArrayChildAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("test", TestArrayChildAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ArrayChild::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the array data as a text element - */ -void -ArrayChild::setElementText(const std::string& text) -{ - stringstream strStream(text); - double val; - vector valuesVector; - - while (strStream >> val) - { - valuesVector.push_back(val); - } - - unsigned int length = (unsigned int)valuesVector.size(); - - if (length > 0) - { - double* data = new double[length]; - for (unsigned int i = 0; i < length; ++i) - { - data[i] = valuesVector.at(i); - } - - setNumber(data, length); - delete[] data; - } -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ArrayChild_t using the given SBML Level, Version and - * “test” package version. - */ -LIBSBML_EXTERN -ArrayChild_t * -ArrayChild_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ArrayChild(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ArrayChild_t object. - */ -LIBSBML_EXTERN -ArrayChild_t* -ArrayChild_clone(const ArrayChild_t* ac) -{ - if (ac != NULL) - { - return static_cast(ac->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ArrayChild_t object. - */ -LIBSBML_EXTERN -void -ArrayChild_free(ArrayChild_t* ac) -{ - if (ac != NULL) - { - delete ac; - } -} - - -/* - * Predicate returning @c 1 (true) if this ArrayChild_t's "number" attribute is - * set. - */ -LIBSBML_EXTERN -int -ArrayChild_isSetNumber(const ArrayChild_t * ac) -{ - return (ac != NULL) ? static_cast(ac->isSetNumber()) : 0; -} - - -/* - * Sets the value of the "number" attribute of this ArrayChild_t. - */ -LIBSBML_EXTERN -int -ArrayChild_setNumber(ArrayChild_t* ac, double* number, int arrayLength) -{ - return (ac != NULL) ? ac->setNumber(number, arrayLength) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "number" attribute of this ArrayChild_t. - */ -LIBSBML_EXTERN -int -ArrayChild_unsetNumber(ArrayChild_t * ac) -{ - return (ac != NULL) ? ac->unsetNumber() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "unit" element of this ArrayChild_t. - */ -LIBSBML_EXTERN -const Unit_t* -ArrayChild_getUnit(const ArrayChild_t * ac) -{ - if (ac == NULL) - { - return NULL; - } - - return (Unit_t*)(ac->getUnit()); -} - - -/* - * Predicate returning @c 1 (true) if this ArrayChild_t's "unit" element is - * set. - */ -LIBSBML_EXTERN -int -ArrayChild_isSetUnit(const ArrayChild_t * ac) -{ - return (ac != NULL) ? static_cast(ac->isSetUnit()) : 0; -} - - -/* - * Sets the value of the "unit" element of this ArrayChild_t. - */ -LIBSBML_EXTERN -int -ArrayChild_setUnit(ArrayChild_t * ac, const Unit_t* unit) -{ - return (ac != NULL) ? ac->setUnit(unit) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new Unit_t object, adds it to this ArrayChild_t object and returns - * the Unit_t object created. - */ -LIBSBML_EXTERN -Unit_t* -ArrayChild_createUnit(ArrayChild_t* ac) -{ - if (ac == NULL) - { - return NULL; - } - - return (Unit_t*)(ac->createUnit()); -} - - -/* - * Unsets the value of the "unit" element of this ArrayChild_t. - */ -LIBSBML_EXTERN -int -ArrayChild_unsetUnit(ArrayChild_t * ac) -{ - return (ac != NULL) ? ac->unsetUnit() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * ArrayChild_t object have been set. - */ -LIBSBML_EXTERN -int -ArrayChild_hasRequiredAttributes(const ArrayChild_t * ac) -{ - return (ac != NULL) ? static_cast(ac->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ArrayChild.cpp + * @brief Implementation of the ArrayChild class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ArrayChild using the given SBML Level, Version and + * “test” package version. + */ +ArrayChild::ArrayChild(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mUnit (NULL) + , mNumber (NULL) +{ + setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new ArrayChild using the given TestPkgNamespaces object. + */ +ArrayChild::ArrayChild(TestPkgNamespaces *testns) + : SBase(testns) + , mUnit (NULL) + , mNumber (NULL) +{ + setElementNamespace(testns->getURI()); + connectToChild(); + loadPlugins(testns); +} + + +/* + * Copy constructor for ArrayChild. + */ +ArrayChild::ArrayChild(const ArrayChild& orig) + : SBase( orig ) + , mUnit ( NULL ) + , mNumber ( NULL ) +{ + setNumber(orig.mNumber, orig.mNumberLength); + + if (orig.mUnit != NULL) + { + mUnit = orig.mUnit->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for ArrayChild. + */ +ArrayChild& +ArrayChild::operator=(const ArrayChild& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mNumber = NULL; + setNumber(rhs.mNumber, rhs.mNumberLength); + delete mUnit; + if (rhs.mUnit != NULL) + { + mUnit = rhs.mUnit->clone(); + } + else + { + mUnit = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ArrayChild object. + */ +ArrayChild* +ArrayChild::clone() const +{ + return new ArrayChild(*this); +} + + +/* + * Destructor for ArrayChild. + */ +ArrayChild::~ArrayChild() +{ + if (mNumber != NULL) + { + delete [] mNumber; + } + + mNumber = NULL; + + delete mUnit; + mUnit = NULL; +} + + +/* + * Returns the value of the "number" attribute of this ArrayChild. + */ +void +ArrayChild::getNumber(double* outArray) const +{ + if (outArray == NULL || mNumber == NULL) + { + return; + } + + memcpy(outArray, mNumber, sizeof(double)*mNumberLength); +} + + +/* + * Predicate returning @c true if this ArrayChild's "number" attribute is set. + */ +bool +ArrayChild::isSetNumber() const +{ + return (mNumber != NULL); +} + + +/* + * Sets the value of the "number" attribute of this ArrayChild. + */ +int +ArrayChild::setNumber(double* inArray, int arrayLength) +{ + if (inArray == NULL) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + if (mNumber != NULL) + { + delete[] mNumber; + } + + mNumber = new double[arrayLength]; + memcpy(mNumber, inArray, sizeof(double)*arrayLength); + mIsSetNumberLength = true; + mNumberLength = arrayLength; + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "number" attribute of this ArrayChild. + */ +int +ArrayChild::unsetNumber() +{ + if (mNumber != NULL) + { + delete[] mNumber; + } + + mNumber = NULL; + + return unsetNumberLength(); +} + + +/* + * Returns the value of the "unit" element of this ArrayChild. + */ +const Unit* +ArrayChild::getUnit() const +{ + return mUnit; +} + + +/* + * Returns the value of the "unit" element of this ArrayChild. + */ +Unit* +ArrayChild::getUnit() +{ + return mUnit; +} + + +/* + * Predicate returning @c true if this ArrayChild's "unit" element is set. + */ +bool +ArrayChild::isSetUnit() const +{ + return (mUnit != NULL); +} + + +/* + * Sets the value of the "unit" element of this ArrayChild. + */ +int +ArrayChild::setUnit(const Unit* unit) +{ + if (mUnit == unit) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (unit == NULL) + { + delete mUnit; + mUnit = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mUnit; + mUnit = (unit != NULL) ? unit->clone() : NULL; + if (mUnit != NULL) + { + mUnit->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new Unit object, adds it to this ArrayChild object and returns the + * Unit object created. + */ +Unit* +ArrayChild::createUnit() +{ + if (mUnit != NULL) + { + delete mUnit; + } + + TEST_CREATE_NS(testns, getSBMLNamespaces()); + mUnit = new Unit(testns); + + delete testns; + + connectToChild(); + + return mUnit; +} + + +/* + * Unsets the value of the "unit" element of this ArrayChild. + */ +int +ArrayChild::unsetUnit() +{ + delete mUnit; + mUnit = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this ArrayChild object. + */ +const std::string& +ArrayChild::getElementName() const +{ + static const string name = "arrayChild"; + return name; +} + + +/* + * Returns the libSBML type code for this ArrayChild object. + */ +int +ArrayChild::getTypeCode() const +{ + return SBML_TEST_ARRAYCHILD; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * ArrayChild object have been set. + */ +bool +ArrayChild::hasRequiredAttributes() const +{ + bool allPresent = true; + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ArrayChild::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetUnit() == true) + { + mUnit->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ArrayChild::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mUnit != NULL) + { + mUnit->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ArrayChild::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mUnit != NULL) + { + mUnit->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * used to write arrays + */ +void +ArrayChild::write(XMLOutputStream& stream) const +{ + stream.startElement(getElementName(), getPrefix()); + writeAttributes(stream); + + if (isSetNumber()) + { + for (int i = 0; i < mNumberLength; ++i) + { + stream << (double)mNumber[i] << " "; + } + } + + stream.endElement(getElementName(), getPrefix()); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +ArrayChild::connectToChild() +{ + SBase::connectToChild(); + + if (mUnit != NULL) + { + mUnit->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ArrayChild::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetUnit()) + { + mUnit->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +ArrayChild::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mUnit != NULL) + { + mUnit->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ArrayChild's attribute "attributeName" + * is set. + */ +bool +ArrayChild::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "number") + { + value = isSetNumber(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this ArrayChild. + */ +int +ArrayChild::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "number") + { + value = unsetNumber(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this ArrayChild. + */ +SBase* +ArrayChild::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "unit") + { + return createUnit(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this ArrayChild. + */ +int +ArrayChild::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "unit" && element->getTypeCode() == SBML_TEST_UNIT) + { + return setUnit((const Unit*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * ArrayChild. + */ +SBase* +ArrayChild::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "unit") + { + Unit * obj = mUnit; + mUnit = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this ArrayChild. + */ +unsigned int +ArrayChild::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "unit") + { + if (isSetUnit()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this ArrayChild. + */ +SBase* +ArrayChild::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "unit") + { + return getUnit(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +ArrayChild::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mUnit != NULL) + { + if (mUnit->getId() == id) + { + return mUnit; + } + + obj = mUnit->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +ArrayChild::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mUnit != NULL) + { + if (mUnit->getMetaId() == metaid) + { + return mUnit; + } + + obj = mUnit->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +ArrayChild::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mUnit, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +ArrayChild::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + TEST_CREATE_NS(testns, getSBMLNamespaces()); + + if (name == "unit") + { + if (getErrorLog() && isSetUnit()) + { + getErrorLog()->logPackageError("test", TestArrayChildAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mUnit; + mUnit = new Unit(testns); + obj = mUnit; + } + + delete testns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +ArrayChild::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ArrayChild::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("test", TestArrayChildAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("test", TestArrayChildAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ArrayChild::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the array data as a text element + */ +void +ArrayChild::setElementText(const std::string& text) +{ + stringstream strStream(text); + double val; + vector valuesVector; + + while (strStream >> val) + { + valuesVector.push_back(val); + } + + unsigned int length = (unsigned int)valuesVector.size(); + + if (length > 0) + { + double* data = new double[length]; + for (unsigned int i = 0; i < length; ++i) + { + data[i] = valuesVector.at(i); + } + + setNumber(data, length); + delete[] data; + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ArrayChild_t using the given SBML Level, Version and + * “test” package version. + */ +LIBSBML_EXTERN +ArrayChild_t * +ArrayChild_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ArrayChild(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ArrayChild_t object. + */ +LIBSBML_EXTERN +ArrayChild_t* +ArrayChild_clone(const ArrayChild_t* ac) +{ + if (ac != NULL) + { + return static_cast(ac->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ArrayChild_t object. + */ +LIBSBML_EXTERN +void +ArrayChild_free(ArrayChild_t* ac) +{ + if (ac != NULL) + { + delete ac; + } +} + + +/* + * Predicate returning @c 1 (true) if this ArrayChild_t's "number" attribute is + * set. + */ +LIBSBML_EXTERN +int +ArrayChild_isSetNumber(const ArrayChild_t * ac) +{ + return (ac != NULL) ? static_cast(ac->isSetNumber()) : 0; +} + + +/* + * Sets the value of the "number" attribute of this ArrayChild_t. + */ +LIBSBML_EXTERN +int +ArrayChild_setNumber(ArrayChild_t* ac, double* number, int arrayLength) +{ + return (ac != NULL) ? ac->setNumber(number, arrayLength) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "number" attribute of this ArrayChild_t. + */ +LIBSBML_EXTERN +int +ArrayChild_unsetNumber(ArrayChild_t * ac) +{ + return (ac != NULL) ? ac->unsetNumber() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "unit" element of this ArrayChild_t. + */ +LIBSBML_EXTERN +const Unit_t* +ArrayChild_getUnit(const ArrayChild_t * ac) +{ + if (ac == NULL) + { + return NULL; + } + + return (Unit_t*)(ac->getUnit()); +} + + +/* + * Predicate returning @c 1 (true) if this ArrayChild_t's "unit" element is + * set. + */ +LIBSBML_EXTERN +int +ArrayChild_isSetUnit(const ArrayChild_t * ac) +{ + return (ac != NULL) ? static_cast(ac->isSetUnit()) : 0; +} + + +/* + * Sets the value of the "unit" element of this ArrayChild_t. + */ +LIBSBML_EXTERN +int +ArrayChild_setUnit(ArrayChild_t * ac, const Unit_t* unit) +{ + return (ac != NULL) ? ac->setUnit(unit) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new Unit_t object, adds it to this ArrayChild_t object and returns + * the Unit_t object created. + */ +LIBSBML_EXTERN +Unit_t* +ArrayChild_createUnit(ArrayChild_t* ac) +{ + if (ac == NULL) + { + return NULL; + } + + return (Unit_t*)(ac->createUnit()); +} + + +/* + * Unsets the value of the "unit" element of this ArrayChild_t. + */ +LIBSBML_EXTERN +int +ArrayChild_unsetUnit(ArrayChild_t * ac) +{ + return (ac != NULL) ? ac->unsetUnit() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * ArrayChild_t object have been set. + */ +LIBSBML_EXTERN +int +ArrayChild_hasRequiredAttributes(const ArrayChild_t * ac) +{ + return (ac != NULL) ? static_cast(ac->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ArrayChild.h b/generator/tests/test_cpp_code/test-code/ArrayChild.h index 2c09ff7c..d40b5109 100644 --- a/generator/tests/test_cpp_code/test-code/ArrayChild.h +++ b/generator/tests/test_cpp_code/test-code/ArrayChild.h @@ -1,1036 +1,1036 @@ -/** - * @file ArrayChild.h - * @brief Definition of the ArrayChild class. - * @author SBMLTeam - * - * - * - * @class ArrayChild - * @sbmlbrief{test} TODO:Definition of the ArrayChild class. - */ - - -#ifndef ArrayChild_H__ -#define ArrayChild_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ArrayChild : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - Unit* mUnit; - double* mNumber; - - /** @endcond */ - -public: - - /** - * Creates a new ArrayChild using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ArrayChild. - * - * @param version an unsigned int, the SBML Version to assign to this - * ArrayChild. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * ArrayChild. - * - * @copydetails doc_note_setting_lv_pkg - */ - ArrayChild(unsigned int level = TestExtension::getDefaultLevel(), - unsigned int version = TestExtension::getDefaultVersion(), - unsigned int pkgVersion = - TestExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ArrayChild using the given TestPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param testns the TestPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ArrayChild(TestPkgNamespaces *testns); - - - /** - * Copy constructor for ArrayChild. - * - * @param orig the ArrayChild instance to copy. - */ - ArrayChild(const ArrayChild& orig); - - - /** - * Assignment operator for ArrayChild. - * - * @param rhs the ArrayChild object whose values are to be used as the basis - * of the assignment. - */ - ArrayChild& operator=(const ArrayChild& rhs); - - - /** - * Creates and returns a deep copy of this ArrayChild object. - * - * @return a (deep) copy of this ArrayChild object. - */ - virtual ArrayChild* clone() const; - - - /** - * Destructor for ArrayChild. - */ - virtual ~ArrayChild(); - - - /** - * Returns the value of the "number" attribute of this ArrayChild. - * - * @param outArray double* array that will be used to return the value of the - * "number" attribute of this ArrayChild. - * - * @note the value of the "number" attribute of this ArrayChild is returned - * in the argument array. - */ - void getNumber(double* outArray) const; - - - /** - * Predicate returning @c true if this ArrayChild's "number" attribute is - * set. - * - * @return @c true if this ArrayChild's "number" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetNumber() const; - - - /** - * Sets the value of the "number" attribute of this ArrayChild. - * - * @param inArray double* array value of the "number" attribute to be set. - * - * @param arrayLength int value for the length of the "number" attribute to - * be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setNumber(double* inArray, int arrayLength); - - - /** - * Unsets the value of the "number" attribute of this ArrayChild. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetNumber(); - - - /** - * Returns the value of the "unit" element of this ArrayChild. - * - * @return the value of the "unit" element of this ArrayChild as a Unit*. - */ - const Unit* getUnit() const; - - - /** - * Returns the value of the "unit" element of this ArrayChild. - * - * @return the value of the "unit" element of this ArrayChild as a Unit*. - */ - Unit* getUnit(); - - - /** - * Predicate returning @c true if this ArrayChild's "unit" element is set. - * - * @return @c true if this ArrayChild's "unit" element has been set, - * otherwise @c false is returned. - */ - bool isSetUnit() const; - - - /** - * Sets the value of the "unit" element of this ArrayChild. - * - * @param unit Unit* value of the "unit" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setUnit(const Unit* unit); - - - /** - * Creates a new Unit object, adds it to this ArrayChild object and returns - * the Unit object created. - * - * @return a new Unit object instance. - */ - Unit* createUnit(); - - - /** - * Unsets the value of the "unit" element of this ArrayChild. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetUnit(); - - - /** - * Returns the XML element name of this ArrayChild object. - * - * For ArrayChild, the XML element name is always @c "arrayChild". - * - * @return the name of this element, i.e. @c "arrayChild". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ArrayChild object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_TEST_ARRAYCHILD, SBMLTestTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * ArrayChild object have been set. - * - * @return @c true to indicate that all the required attributes of this - * ArrayChild have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * used to write arrays - */ - virtual void write(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ArrayChild's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ArrayChild's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this ArrayChild. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this ArrayChild. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this ArrayChild. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * ArrayChild. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this ArrayChild. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this ArrayChild. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the array data as a text element - */ - virtual void setElementText(const std::string& text); - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ArrayChild_t using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ArrayChild_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ArrayChild_t. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * ArrayChild_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -ArrayChild_t * -ArrayChild_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ArrayChild_t object. - * - * @param ac the ArrayChild_t structure. - * - * @return a (deep) copy of this ArrayChild_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -ArrayChild_t* -ArrayChild_clone(const ArrayChild_t* ac); - - -/** - * Frees this ArrayChild_t object. - * - * @param ac the ArrayChild_t structure. - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -void -ArrayChild_free(ArrayChild_t* ac); - - -/** - * Predicate returning @c 1 (true) if this ArrayChild_t's "number" attribute is - * set. - * - * @param ac the ArrayChild_t structure. - * - * @return @c 1 (true) if this ArrayChild_t's "number" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -int -ArrayChild_isSetNumber(const ArrayChild_t * ac); - - -/** - * Sets the value of the "number" attribute of this ArrayChild_t. - * - * @param ac the ArrayChild_t structure. - * - * @param number pointer value of the "number" attribute to be set. - * - * @param arrayLength int value for the length of the "number" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -int -ArrayChild_setNumber(ArrayChild_t* ac, double* number, int arrayLength); - - -/** - * Unsets the value of the "number" attribute of this ArrayChild_t. - * - * @param ac the ArrayChild_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -int -ArrayChild_unsetNumber(ArrayChild_t * ac); - - -/** - * Returns the value of the "unit" element of this ArrayChild_t. - * - * @param ac the ArrayChild_t structure whose unit is sought. - * - * @return the value of the "unit" element of this ArrayChild_t as a Unit*. - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -const Unit_t* -ArrayChild_getUnit(const ArrayChild_t * ac); - - -/** - * Predicate returning @c 1 (true) if this ArrayChild_t's "unit" element is - * set. - * - * @param ac the ArrayChild_t structure. - * - * @return @c 1 (true) if this ArrayChild_t's "unit" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -int -ArrayChild_isSetUnit(const ArrayChild_t * ac); - - -/** - * Sets the value of the "unit" element of this ArrayChild_t. - * - * @param ac the ArrayChild_t structure. - * - * @param unit Unit_t* value of the "unit" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -int -ArrayChild_setUnit(ArrayChild_t * ac, const Unit_t* unit); - - -/** - * Creates a new Unit_t object, adds it to this ArrayChild_t object and returns - * the Unit_t object created. - * - * @param ac the ArrayChild_t structure to which the Unit_t should be added. - * - * @return a new Unit_t object instance. - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -Unit_t* -ArrayChild_createUnit(ArrayChild_t* ac); - - -/** - * Unsets the value of the "unit" element of this ArrayChild_t. - * - * @param ac the ArrayChild_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -int -ArrayChild_unsetUnit(ArrayChild_t * ac); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * ArrayChild_t object have been set. - * - * @param ac the ArrayChild_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * ArrayChild_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof ArrayChild_t - */ -LIBSBML_EXTERN -int -ArrayChild_hasRequiredAttributes(const ArrayChild_t * ac); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ArrayChild_H__ */ - - +/** + * @file ArrayChild.h + * @brief Definition of the ArrayChild class. + * @author SBMLTeam + * + * + * + * @class ArrayChild + * @sbmlbrief{test} TODO:Definition of the ArrayChild class. + */ + + +#ifndef ArrayChild_H__ +#define ArrayChild_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ArrayChild : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + Unit* mUnit; + double* mNumber; + + /** @endcond */ + +public: + + /** + * Creates a new ArrayChild using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ArrayChild. + * + * @param version an unsigned int, the SBML Version to assign to this + * ArrayChild. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * ArrayChild. + * + * @copydetails doc_note_setting_lv_pkg + */ + ArrayChild(unsigned int level = TestExtension::getDefaultLevel(), + unsigned int version = TestExtension::getDefaultVersion(), + unsigned int pkgVersion = + TestExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ArrayChild using the given TestPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param testns the TestPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ArrayChild(TestPkgNamespaces *testns); + + + /** + * Copy constructor for ArrayChild. + * + * @param orig the ArrayChild instance to copy. + */ + ArrayChild(const ArrayChild& orig); + + + /** + * Assignment operator for ArrayChild. + * + * @param rhs the ArrayChild object whose values are to be used as the basis + * of the assignment. + */ + ArrayChild& operator=(const ArrayChild& rhs); + + + /** + * Creates and returns a deep copy of this ArrayChild object. + * + * @return a (deep) copy of this ArrayChild object. + */ + virtual ArrayChild* clone() const; + + + /** + * Destructor for ArrayChild. + */ + virtual ~ArrayChild(); + + + /** + * Returns the value of the "number" attribute of this ArrayChild. + * + * @param outArray double* array that will be used to return the value of the + * "number" attribute of this ArrayChild. + * + * @note the value of the "number" attribute of this ArrayChild is returned + * in the argument array. + */ + void getNumber(double* outArray) const; + + + /** + * Predicate returning @c true if this ArrayChild's "number" attribute is + * set. + * + * @return @c true if this ArrayChild's "number" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetNumber() const; + + + /** + * Sets the value of the "number" attribute of this ArrayChild. + * + * @param inArray double* array value of the "number" attribute to be set. + * + * @param arrayLength int value for the length of the "number" attribute to + * be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setNumber(double* inArray, int arrayLength); + + + /** + * Unsets the value of the "number" attribute of this ArrayChild. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetNumber(); + + + /** + * Returns the value of the "unit" element of this ArrayChild. + * + * @return the value of the "unit" element of this ArrayChild as a Unit*. + */ + const Unit* getUnit() const; + + + /** + * Returns the value of the "unit" element of this ArrayChild. + * + * @return the value of the "unit" element of this ArrayChild as a Unit*. + */ + Unit* getUnit(); + + + /** + * Predicate returning @c true if this ArrayChild's "unit" element is set. + * + * @return @c true if this ArrayChild's "unit" element has been set, + * otherwise @c false is returned. + */ + bool isSetUnit() const; + + + /** + * Sets the value of the "unit" element of this ArrayChild. + * + * @param unit Unit* value of the "unit" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setUnit(const Unit* unit); + + + /** + * Creates a new Unit object, adds it to this ArrayChild object and returns + * the Unit object created. + * + * @return a new Unit object instance. + */ + Unit* createUnit(); + + + /** + * Unsets the value of the "unit" element of this ArrayChild. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetUnit(); + + + /** + * Returns the XML element name of this ArrayChild object. + * + * For ArrayChild, the XML element name is always @c "arrayChild". + * + * @return the name of this element, i.e. @c "arrayChild". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ArrayChild object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_TEST_ARRAYCHILD, SBMLTestTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * ArrayChild object have been set. + * + * @return @c true to indicate that all the required attributes of this + * ArrayChild have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * used to write arrays + */ + virtual void write(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ArrayChild's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ArrayChild's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this ArrayChild. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this ArrayChild. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this ArrayChild. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * ArrayChild. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this ArrayChild. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this ArrayChild. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the array data as a text element + */ + virtual void setElementText(const std::string& text); + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ArrayChild_t using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ArrayChild_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ArrayChild_t. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * ArrayChild_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +ArrayChild_t * +ArrayChild_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ArrayChild_t object. + * + * @param ac the ArrayChild_t structure. + * + * @return a (deep) copy of this ArrayChild_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +ArrayChild_t* +ArrayChild_clone(const ArrayChild_t* ac); + + +/** + * Frees this ArrayChild_t object. + * + * @param ac the ArrayChild_t structure. + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +void +ArrayChild_free(ArrayChild_t* ac); + + +/** + * Predicate returning @c 1 (true) if this ArrayChild_t's "number" attribute is + * set. + * + * @param ac the ArrayChild_t structure. + * + * @return @c 1 (true) if this ArrayChild_t's "number" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +int +ArrayChild_isSetNumber(const ArrayChild_t * ac); + + +/** + * Sets the value of the "number" attribute of this ArrayChild_t. + * + * @param ac the ArrayChild_t structure. + * + * @param number pointer value of the "number" attribute to be set. + * + * @param arrayLength int value for the length of the "number" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +int +ArrayChild_setNumber(ArrayChild_t* ac, double* number, int arrayLength); + + +/** + * Unsets the value of the "number" attribute of this ArrayChild_t. + * + * @param ac the ArrayChild_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +int +ArrayChild_unsetNumber(ArrayChild_t * ac); + + +/** + * Returns the value of the "unit" element of this ArrayChild_t. + * + * @param ac the ArrayChild_t structure whose unit is sought. + * + * @return the value of the "unit" element of this ArrayChild_t as a Unit*. + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +const Unit_t* +ArrayChild_getUnit(const ArrayChild_t * ac); + + +/** + * Predicate returning @c 1 (true) if this ArrayChild_t's "unit" element is + * set. + * + * @param ac the ArrayChild_t structure. + * + * @return @c 1 (true) if this ArrayChild_t's "unit" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +int +ArrayChild_isSetUnit(const ArrayChild_t * ac); + + +/** + * Sets the value of the "unit" element of this ArrayChild_t. + * + * @param ac the ArrayChild_t structure. + * + * @param unit Unit_t* value of the "unit" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +int +ArrayChild_setUnit(ArrayChild_t * ac, const Unit_t* unit); + + +/** + * Creates a new Unit_t object, adds it to this ArrayChild_t object and returns + * the Unit_t object created. + * + * @param ac the ArrayChild_t structure to which the Unit_t should be added. + * + * @return a new Unit_t object instance. + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +Unit_t* +ArrayChild_createUnit(ArrayChild_t* ac); + + +/** + * Unsets the value of the "unit" element of this ArrayChild_t. + * + * @param ac the ArrayChild_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +int +ArrayChild_unsetUnit(ArrayChild_t * ac); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * ArrayChild_t object have been set. + * + * @param ac the ArrayChild_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * ArrayChild_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof ArrayChild_t + */ +LIBSBML_EXTERN +int +ArrayChild_hasRequiredAttributes(const ArrayChild_t * ac); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ArrayChild_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Association.cpp b/generator/tests/test_cpp_code/test-code/Association.cpp index 32aa4539..480b0a1c 100644 --- a/generator/tests/test_cpp_code/test-code/Association.cpp +++ b/generator/tests/test_cpp_code/test-code/Association.cpp @@ -1,584 +1,584 @@ -/** - * @file Association.cpp - * @brief Implementation of the Association class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Association using the given SBML Level, Version and - * “fbc” package version. - */ -Association::Association(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mElementName("association") -{ - setSBMLNamespacesAndOwn(new FbcPkgNamespaces(level, version, pkgVersion)); -} - - -/* - * Creates a new Association using the given FbcPkgNamespaces object. - */ -Association::Association(FbcPkgNamespaces *fbcns) - : SBase(fbcns) - , mElementName("association") -{ - setElementNamespace(fbcns->getURI()); - loadPlugins(fbcns); -} - - -/* - * Copy constructor for Association. - */ -Association::Association(const Association& orig) - : SBase( orig ) - , mElementName ( orig.mElementName ) -{ -} - - -/* - * Assignment operator for Association. - */ -Association& -Association::operator=(const Association& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mElementName = rhs.mElementName; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Association object. - */ -Association* -Association::clone() const -{ - return new Association(*this); -} - - -/* - * Destructor for Association. - */ -Association::~Association() -{ -} - - -/* - * Predicate returning @c true if this abstract "Association" is of type FbcAnd - */ -bool -Association::isFbcAnd() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Association" is of type FbcOr - */ -bool -Association::isFbcOr() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Association" is of type - * GeneProductRef - */ -bool -Association::isGeneProductRef() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Returns the XML element name of this Association object. - */ -const std::string& -Association::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this Association object. - */ -void -Association::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this Association object. - */ -int -Association::getTypeCode() const -{ - return SBML_FBC_ASSOCIATION; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Association::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Association::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Association::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Association::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Association. - */ -int -Association::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Association. - */ -int -Association::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Association. - */ -int -Association::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Association. - */ -int -Association::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Association. - */ -int -Association::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Association's attribute "attributeName" - * is set. - */ -bool -Association::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Association. - */ -int -Association::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Association. - */ -int -Association::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Association. - */ -int -Association::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Association. - */ -int -Association::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Association. - */ -int -Association::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Association. - */ -int -Association::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new FbcAnd using the given SBML Level, Version and - * “fbc” package version. - */ -LIBSBML_EXTERN -FbcAnd_t * -Association_createAnd(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new FbcAnd(level, version, pkgVersion); -} - - -/* - * Creates a new FbcOr using the given SBML Level, Version and - * “fbc” package version. - */ -LIBSBML_EXTERN -FbcOr_t * -Association_createOr(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new FbcOr(level, version, pkgVersion); -} - - -/* - * Creates a new GeneProductRef using the given SBML Level, Version and - * “fbc” package version. - */ -LIBSBML_EXTERN -GeneProductRef_t * -Association_createGeneProductRef(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new GeneProductRef(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Association_t object. - */ -LIBSBML_EXTERN -Association_t* -Association_clone(const Association_t* a) -{ - if (a != NULL) - { - return static_cast(a->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Association_t object. - */ -LIBSBML_EXTERN -void -Association_free(Association_t* a) -{ - if (a != NULL) - { - delete a; - } -} - - -/* - * Predicate returning @c 1 if this Association_t is of type FbcAnd_t - */ -LIBSBML_EXTERN -int -Association_isFbcAnd(const Association_t * a) -{ - return (a != NULL) ? static_cast(a->isFbcAnd()) : 0; -} - - -/* - * Predicate returning @c 1 if this Association_t is of type FbcOr_t - */ -LIBSBML_EXTERN -int -Association_isFbcOr(const Association_t * a) -{ - return (a != NULL) ? static_cast(a->isFbcOr()) : 0; -} - - -/* - * Predicate returning @c 1 if this Association_t is of type GeneProductRef_t - */ -LIBSBML_EXTERN -int -Association_isGeneProductRef(const Association_t * a) -{ - return (a != NULL) ? static_cast(a->isGeneProductRef()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Association.cpp + * @brief Implementation of the Association class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Association using the given SBML Level, Version and + * “fbc” package version. + */ +Association::Association(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mElementName("association") +{ + setSBMLNamespacesAndOwn(new FbcPkgNamespaces(level, version, pkgVersion)); +} + + +/* + * Creates a new Association using the given FbcPkgNamespaces object. + */ +Association::Association(FbcPkgNamespaces *fbcns) + : SBase(fbcns) + , mElementName("association") +{ + setElementNamespace(fbcns->getURI()); + loadPlugins(fbcns); +} + + +/* + * Copy constructor for Association. + */ +Association::Association(const Association& orig) + : SBase( orig ) + , mElementName ( orig.mElementName ) +{ +} + + +/* + * Assignment operator for Association. + */ +Association& +Association::operator=(const Association& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mElementName = rhs.mElementName; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Association object. + */ +Association* +Association::clone() const +{ + return new Association(*this); +} + + +/* + * Destructor for Association. + */ +Association::~Association() +{ +} + + +/* + * Predicate returning @c true if this abstract "Association" is of type FbcAnd + */ +bool +Association::isFbcAnd() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Association" is of type FbcOr + */ +bool +Association::isFbcOr() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Association" is of type + * GeneProductRef + */ +bool +Association::isGeneProductRef() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Returns the XML element name of this Association object. + */ +const std::string& +Association::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this Association object. + */ +void +Association::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this Association object. + */ +int +Association::getTypeCode() const +{ + return SBML_FBC_ASSOCIATION; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Association::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Association::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Association::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Association::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Association. + */ +int +Association::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Association. + */ +int +Association::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Association. + */ +int +Association::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Association. + */ +int +Association::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Association. + */ +int +Association::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Association's attribute "attributeName" + * is set. + */ +bool +Association::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Association. + */ +int +Association::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Association. + */ +int +Association::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Association. + */ +int +Association::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Association. + */ +int +Association::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Association. + */ +int +Association::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Association. + */ +int +Association::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new FbcAnd using the given SBML Level, Version and + * “fbc” package version. + */ +LIBSBML_EXTERN +FbcAnd_t * +Association_createAnd(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new FbcAnd(level, version, pkgVersion); +} + + +/* + * Creates a new FbcOr using the given SBML Level, Version and + * “fbc” package version. + */ +LIBSBML_EXTERN +FbcOr_t * +Association_createOr(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new FbcOr(level, version, pkgVersion); +} + + +/* + * Creates a new GeneProductRef using the given SBML Level, Version and + * “fbc” package version. + */ +LIBSBML_EXTERN +GeneProductRef_t * +Association_createGeneProductRef(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new GeneProductRef(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Association_t object. + */ +LIBSBML_EXTERN +Association_t* +Association_clone(const Association_t* a) +{ + if (a != NULL) + { + return static_cast(a->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Association_t object. + */ +LIBSBML_EXTERN +void +Association_free(Association_t* a) +{ + if (a != NULL) + { + delete a; + } +} + + +/* + * Predicate returning @c 1 if this Association_t is of type FbcAnd_t + */ +LIBSBML_EXTERN +int +Association_isFbcAnd(const Association_t * a) +{ + return (a != NULL) ? static_cast(a->isFbcAnd()) : 0; +} + + +/* + * Predicate returning @c 1 if this Association_t is of type FbcOr_t + */ +LIBSBML_EXTERN +int +Association_isFbcOr(const Association_t * a) +{ + return (a != NULL) ? static_cast(a->isFbcOr()) : 0; +} + + +/* + * Predicate returning @c 1 if this Association_t is of type GeneProductRef_t + */ +LIBSBML_EXTERN +int +Association_isGeneProductRef(const Association_t * a) +{ + return (a != NULL) ? static_cast(a->isGeneProductRef()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Association.h b/generator/tests/test_cpp_code/test-code/Association.h index bcf244a8..d93db989 100644 --- a/generator/tests/test_cpp_code/test-code/Association.h +++ b/generator/tests/test_cpp_code/test-code/Association.h @@ -1,694 +1,694 @@ -/** - * @file Association.h - * @brief Definition of the Association class. - * @author SBMLTeam - * - * - * - * @class Association - * @sbmlbrief{fbc} TODO:Definition of the Association class. - */ - - -#ifndef Association_H__ -#define Association_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class FbcAnd; -class FbcOr; -class GeneProductRef; - -class LIBSBML_EXTERN Association : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new Association using the given SBML Level, Version and - * “fbc” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Association. - * - * @param version an unsigned int, the SBML Version to assign to this - * Association. - * - * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this - * Association. - * - * @copydetails doc_note_setting_lv_pkg - */ - Association(unsigned int level = FbcExtension::getDefaultLevel(), - unsigned int version = FbcExtension::getDefaultVersion(), - unsigned int pkgVersion = - FbcExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Association using the given FbcPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param fbcns the FbcPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Association(FbcPkgNamespaces *fbcns); - - - /** - * Copy constructor for Association. - * - * @param orig the Association instance to copy. - */ - Association(const Association& orig); - - - /** - * Assignment operator for Association. - * - * @param rhs the Association object whose values are to be used as the basis - * of the assignment. - */ - Association& operator=(const Association& rhs); - - - /** - * Creates and returns a deep copy of this Association object. - * - * @return a (deep) copy of this Association object. - */ - virtual Association* clone() const; - - - /** - * Destructor for Association. - */ - virtual ~Association(); - - - /** - * Predicate returning @c true if this abstract "Association" is of type - * FbcAnd - * - * @return @c true if this abstract "Association" is of type FbcAnd, @c false - * otherwise - */ - virtual bool isFbcAnd() const; - - - /** - * Predicate returning @c true if this abstract "Association" is of type - * FbcOr - * - * @return @c true if this abstract "Association" is of type FbcOr, @c false - * otherwise - */ - virtual bool isFbcOr() const; - - - /** - * Predicate returning @c true if this abstract "Association" is of type - * GeneProductRef - * - * @return @c true if this abstract "Association" is of type GeneProductRef, - * @c false otherwise - */ - virtual bool isGeneProductRef() const; - - - /** - * Returns the XML element name of this Association object. - * - * For Association, the XML element name is always @c "association". - * - * @return the name of this element, i.e. @c "association". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this Association object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this Association object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_FBC_ASSOCIATION, SBMLFbcTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Association's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Association's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Association. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new FbcAnd using the given SBML Level, Version and - * “fbc” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Association_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Association_t. - * - * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this - * Association_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Association_t - */ -LIBSBML_EXTERN -FbcAnd_t * -Association_createAnd(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new FbcOr using the given SBML Level, Version and - * “fbc” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Association_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Association_t. - * - * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this - * Association_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Association_t - */ -LIBSBML_EXTERN -FbcOr_t * -Association_createOr(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new GeneProductRef using the given SBML Level, Version and - * “fbc” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Association_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Association_t. - * - * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this - * Association_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Association_t - */ -LIBSBML_EXTERN -GeneProductRef_t * -Association_createGeneProductRef(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Association_t object. - * - * @param a the Association_t structure. - * - * @return a (deep) copy of this Association_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Association_t - */ -LIBSBML_EXTERN -Association_t* -Association_clone(const Association_t* a); - - -/** - * Frees this Association_t object. - * - * @param a the Association_t structure. - * - * @memberof Association_t - */ -LIBSBML_EXTERN -void -Association_free(Association_t* a); - - -/** - * Predicate returning @c 1 if this Association_t is of type FbcAnd_t - * - * @param a the Association_t structure. - * - * @return @c 1 if this Association_t is of type FbcAnd_t, @c 0 otherwise - * - * @memberof Association_t - */ -LIBSBML_EXTERN -int -Association_isFbcAnd(const Association_t * a); - - -/** - * Predicate returning @c 1 if this Association_t is of type FbcOr_t - * - * @param a the Association_t structure. - * - * @return @c 1 if this Association_t is of type FbcOr_t, @c 0 otherwise - * - * @memberof Association_t - */ -LIBSBML_EXTERN -int -Association_isFbcOr(const Association_t * a); - - -/** - * Predicate returning @c 1 if this Association_t is of type GeneProductRef_t - * - * @param a the Association_t structure. - * - * @return @c 1 if this Association_t is of type GeneProductRef_t, @c 0 - * otherwise - * - * @memberof Association_t - */ -LIBSBML_EXTERN -int -Association_isGeneProductRef(const Association_t * a); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Association_H__ */ - - +/** + * @file Association.h + * @brief Definition of the Association class. + * @author SBMLTeam + * + * + * + * @class Association + * @sbmlbrief{fbc} TODO:Definition of the Association class. + */ + + +#ifndef Association_H__ +#define Association_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class FbcAnd; +class FbcOr; +class GeneProductRef; + +class LIBSBML_EXTERN Association : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new Association using the given SBML Level, Version and + * “fbc” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Association. + * + * @param version an unsigned int, the SBML Version to assign to this + * Association. + * + * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this + * Association. + * + * @copydetails doc_note_setting_lv_pkg + */ + Association(unsigned int level = FbcExtension::getDefaultLevel(), + unsigned int version = FbcExtension::getDefaultVersion(), + unsigned int pkgVersion = + FbcExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Association using the given FbcPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param fbcns the FbcPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Association(FbcPkgNamespaces *fbcns); + + + /** + * Copy constructor for Association. + * + * @param orig the Association instance to copy. + */ + Association(const Association& orig); + + + /** + * Assignment operator for Association. + * + * @param rhs the Association object whose values are to be used as the basis + * of the assignment. + */ + Association& operator=(const Association& rhs); + + + /** + * Creates and returns a deep copy of this Association object. + * + * @return a (deep) copy of this Association object. + */ + virtual Association* clone() const; + + + /** + * Destructor for Association. + */ + virtual ~Association(); + + + /** + * Predicate returning @c true if this abstract "Association" is of type + * FbcAnd + * + * @return @c true if this abstract "Association" is of type FbcAnd, @c false + * otherwise + */ + virtual bool isFbcAnd() const; + + + /** + * Predicate returning @c true if this abstract "Association" is of type + * FbcOr + * + * @return @c true if this abstract "Association" is of type FbcOr, @c false + * otherwise + */ + virtual bool isFbcOr() const; + + + /** + * Predicate returning @c true if this abstract "Association" is of type + * GeneProductRef + * + * @return @c true if this abstract "Association" is of type GeneProductRef, + * @c false otherwise + */ + virtual bool isGeneProductRef() const; + + + /** + * Returns the XML element name of this Association object. + * + * For Association, the XML element name is always @c "association". + * + * @return the name of this element, i.e. @c "association". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this Association object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this Association object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_FBC_ASSOCIATION, SBMLFbcTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Association's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Association's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Association. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new FbcAnd using the given SBML Level, Version and + * “fbc” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Association_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Association_t. + * + * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this + * Association_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Association_t + */ +LIBSBML_EXTERN +FbcAnd_t * +Association_createAnd(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new FbcOr using the given SBML Level, Version and + * “fbc” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Association_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Association_t. + * + * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this + * Association_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Association_t + */ +LIBSBML_EXTERN +FbcOr_t * +Association_createOr(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new GeneProductRef using the given SBML Level, Version and + * “fbc” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Association_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Association_t. + * + * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this + * Association_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Association_t + */ +LIBSBML_EXTERN +GeneProductRef_t * +Association_createGeneProductRef(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Association_t object. + * + * @param a the Association_t structure. + * + * @return a (deep) copy of this Association_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Association_t + */ +LIBSBML_EXTERN +Association_t* +Association_clone(const Association_t* a); + + +/** + * Frees this Association_t object. + * + * @param a the Association_t structure. + * + * @memberof Association_t + */ +LIBSBML_EXTERN +void +Association_free(Association_t* a); + + +/** + * Predicate returning @c 1 if this Association_t is of type FbcAnd_t + * + * @param a the Association_t structure. + * + * @return @c 1 if this Association_t is of type FbcAnd_t, @c 0 otherwise + * + * @memberof Association_t + */ +LIBSBML_EXTERN +int +Association_isFbcAnd(const Association_t * a); + + +/** + * Predicate returning @c 1 if this Association_t is of type FbcOr_t + * + * @param a the Association_t structure. + * + * @return @c 1 if this Association_t is of type FbcOr_t, @c 0 otherwise + * + * @memberof Association_t + */ +LIBSBML_EXTERN +int +Association_isFbcOr(const Association_t * a); + + +/** + * Predicate returning @c 1 if this Association_t is of type GeneProductRef_t + * + * @param a the Association_t structure. + * + * @return @c 1 if this Association_t is of type GeneProductRef_t, @c 0 + * otherwise + * + * @memberof Association_t + */ +LIBSBML_EXTERN +int +Association_isGeneProductRef(const Association_t * a); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Association_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/BBB.cpp b/generator/tests/test_cpp_code/test-code/BBB.cpp index d93414a4..528482fe 100644 --- a/generator/tests/test_cpp_code/test-code/BBB.cpp +++ b/generator/tests/test_cpp_code/test-code/BBB.cpp @@ -1,1386 +1,1386 @@ -/** - * @file BBB.cpp - * @brief Implementation of the BBB class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new BBB using the given SBML Level, Version and “vers” - * package version. - */ -BBB::BBB(unsigned int level, unsigned int version, unsigned int pkgVersion) - : SBase(level, version) - , mAnothers (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new VersPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new BBB using the given VersPkgNamespaces object. - */ -BBB::BBB(VersPkgNamespaces *versns) - : SBase(versns) - , mAnothers (versns) -{ - setElementNamespace(versns->getURI()); - connectToChild(); - loadPlugins(versns); -} - - -/* - * Copy constructor for BBB. - */ -BBB::BBB(const BBB& orig) - : SBase( orig ) - , mAnothers ( orig.mAnothers ) -{ - connectToChild(); -} - - -/* - * Assignment operator for BBB. - */ -BBB& -BBB::operator=(const BBB& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mAnothers = rhs.mAnothers; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this BBB object. - */ -BBB* -BBB::clone() const -{ - return new BBB(*this); -} - - -/* - * Destructor for BBB. - */ -BBB::~BBB() -{ -} - - -/* - * Returns the value of the "id" attribute of this BBB. - */ -const std::string& -BBB::getId() const -{ - return mId; -} - - -/* - * Predicate returning @c true if this BBB's "id" attribute is set. - */ -bool -BBB::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this BBB. - */ -int -BBB::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Unsets the value of the "id" attribute of this BBB. - */ -int -BBB::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the ListOfAnothers from this BBB. - */ -const ListOfAnothers* -BBB::getListOfAnothers() const -{ - return &mAnothers; -} - - -/* - * Returns the ListOfAnothers from this BBB. - */ -ListOfAnothers* -BBB::getListOfAnothers() -{ - return &mAnothers; -} - - -/* - * Get an Another from the BBB. - */ -Another* -BBB::getAnother(unsigned int n) -{ - return mAnothers.get(n); -} - - -/* - * Get an Another from the BBB. - */ -const Another* -BBB::getAnother(unsigned int n) const -{ - return mAnothers.get(n); -} - - -/* - * Get an Another from the BBB based on its identifier. - */ -Another* -BBB::getAnother(const std::string& sid) -{ - return mAnothers.get(sid); -} - - -/* - * Get an Another from the BBB based on its identifier. - */ -const Another* -BBB::getAnother(const std::string& sid) const -{ - return mAnothers.get(sid); -} - - -/* - * Adds a copy of the given Another to this BBB. - */ -int -BBB::addAnother(const Another* a) -{ - if (a == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (a->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != a->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != a->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(a)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (a->isSetId() && (mAnothers.get(a->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mAnothers.append(a); - } -} - - -/* - * Get the number of Another objects in this BBB. - */ -unsigned int -BBB::getNumAnothers() const -{ - return mAnothers.size(); -} - - -/* - * Creates a new Another object, adds it to this BBB object and returns the - * Another object created. - */ -Another* -BBB::createAnother() -{ - Another* a = NULL; - - try - { - VERS_CREATE_NS_WITH_VERSION(versns, getSBMLNamespaces(), - getPackageVersion()); - a = new Another(versns); - delete versns; - } - catch (...) - { - } - - if (a != NULL) - { - mAnothers.appendAndOwn(a); - } - - return a; -} - - -/* - * Removes the nth Another from this BBB and returns a pointer to it. - */ -Another* -BBB::removeAnother(unsigned int n) -{ - return mAnothers.remove(n); -} - - -/* - * Removes the Another from this BBB based on its identifier and returns a - * pointer to it. - */ -Another* -BBB::removeAnother(const std::string& sid) -{ - return mAnothers.remove(sid); -} - - -/* - * Returns the XML element name of this BBB object. - */ -const std::string& -BBB::getElementName() const -{ - static const string name = "bBB"; - return name; -} - - -/* - * Returns the libSBML type code for this BBB object. - */ -int -BBB::getTypeCode() const -{ - return CLASS_B; -} - - -/* - * Predicate returning @c true if all the required attributes for this BBB - * object have been set. - */ -bool -BBB::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -BBB::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (getNumAnothers() > 0) - { - mAnothers.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -BBB::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mAnothers.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -BBB::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - mAnothers.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -BBB::connectToChild() -{ - SBase::connectToChild(); - - mAnothers.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -BBB::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mAnothers.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -BBB::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - mAnothers.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::getAttribute(const std::string& attributeName, unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::getAttribute(const std::string& attributeName, std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this BBB's attribute "attributeName" is set. - */ -bool -BBB::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::setAttribute(const std::string& attributeName, const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this BBB. - */ -int -BBB::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this BBB. - */ -SBase* -BBB::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "another") - { - return createAnother(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this BBB. - */ -int -BBB::addChildObject(const std::string& elementName, const SBase* element) -{ - if (elementName == "another" && element->getTypeCode() == CLASS_A) - { - return addAnother((const Another*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * BBB. - */ -SBase* -BBB::removeChildObject(const std::string& elementName, const std::string& id) -{ - if (elementName == "another") - { - return removeAnother(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this BBB. - */ -unsigned int -BBB::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "another") - { - return getNumAnothers(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this BBB. - */ -SBase* -BBB::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "another") - { - return getAnother(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -BBB::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - obj = mAnothers.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -BBB::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mAnothers.getMetaId() == metaid) - { - return &mAnothers; - } - - obj = mAnothers.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -BBB::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mAnothers, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -BBB::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - if (name == "listOfAnothers") - { - if (getErrorLog() && mAnothers.size() != 0) - { - getErrorLog()->logPackageError("vers", VersBBBAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mAnothers; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -BBB::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - unsigned int level = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && coreVersion == 1 && pkgVersion == 1) - { - attributes.add("id"); - } - - if (level == 3 && coreVersion == 1 && pkgVersion == 2) - { - attributes.add("id"); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -BBB::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("vers", VersBBBAllowedAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("vers", VersBBBAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } - - if (level == 3 && version == 1 && pkgVersion == 1) - { - readL3V1V1Attributes(attributes); - } - - if (level == 3 && version == 1 && pkgVersion == 2) - { - readL3V1V2Attributes(attributes); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -BBB::readL3V1V1Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - - // - // id SId (use = "required" ) - // - - XMLTriple tripleID("id", mURI, getPrefix()); - assigned = attributes.readInto(tripleID, mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Vers attribute 'id' is missing from the " - "element."; - log->logPackageError("vers", VersBBBAllowedAttributes, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -BBB::readL3V1V2Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - - // - // id SId (use = "required" ) - // - - XMLTriple tripleID("id", mURI, getPrefix()); - assigned = attributes.readInto(tripleID, mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Vers attribute 'id' is missing from the " - "element."; - log->logPackageError("vers", VersBBBAllowedAttributes, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -BBB::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && version == 1 && pkgVersion == 1) - { - writeL3V1V1Attributes(stream); - } - - if (level == 3 && version == 1 && pkgVersion == 2) - { - writeL3V1V2Attributes(stream); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -BBB::writeL3V1V1Attributes(XMLOutputStream& stream) const -{ - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -BBB::writeL3V1V2Attributes(XMLOutputStream& stream) const -{ - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new BBB_t using the given SBML Level, Version and - * “vers” package version. - */ -LIBSBML_EXTERN -BBB_t * -BBB_create(unsigned int level, unsigned int version, unsigned int pkgVersion) -{ - return new BBB(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this BBB_t object. - */ -LIBSBML_EXTERN -BBB_t* -BBB_clone(const BBB_t* bbb) -{ - if (bbb != NULL) - { - return static_cast(bbb->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this BBB_t object. - */ -LIBSBML_EXTERN -void -BBB_free(BBB_t* bbb) -{ - if (bbb != NULL) - { - delete bbb; - } -} - - -/* - * Returns the value of the "id" attribute of this BBB_t. - */ -LIBSBML_EXTERN -char * -BBB_getId(const BBB_t * bbb) -{ - if (bbb == NULL) - { - return NULL; - } - - return bbb->getId().empty() ? NULL : safe_strdup(bbb->getId().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this BBB_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -BBB_isSetId(const BBB_t * bbb) -{ - return (bbb != NULL) ? static_cast(bbb->isSetId()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this BBB_t. - */ -LIBSBML_EXTERN -int -BBB_setId(BBB_t * bbb, const char * id) -{ - return (bbb != NULL) ? bbb->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this BBB_t. - */ -LIBSBML_EXTERN -int -BBB_unsetId(BBB_t * bbb) -{ - return (bbb != NULL) ? bbb->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing Another_t objects from this BBB_t. - */ -LIBSBML_EXTERN -ListOf_t* -BBB_getListOfAnothers(BBB_t* bbb) -{ - return (bbb != NULL) ? bbb->getListOfAnothers() : NULL; -} - - -/* - * Get an Another_t from the BBB_t. - */ -LIBSBML_EXTERN -Another_t* -BBB_getAnother(BBB_t* bbb, unsigned int n) -{ - return (bbb != NULL) ? bbb->getAnother(n) : NULL; -} - - -/* - * Get an Another_t from the BBB_t based on its identifier. - */ -LIBSBML_EXTERN -Another_t* -BBB_getAnotherById(BBB_t* bbb, const char *sid) -{ - return (bbb != NULL && sid != NULL) ? bbb->getAnother(sid) : NULL; -} - - -/* - * Adds a copy of the given Another_t to this BBB_t. - */ -LIBSBML_EXTERN -int -BBB_addAnother(BBB_t* bbb, const Another_t* a) -{ - return (bbb != NULL) ? bbb->addAnother(a) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of Another_t objects in this BBB_t. - */ -LIBSBML_EXTERN -unsigned int -BBB_getNumAnothers(BBB_t* bbb) -{ - return (bbb != NULL) ? bbb->getNumAnothers() : SBML_INT_MAX; -} - - -/* - * Creates a new Another_t object, adds it to this BBB_t object and returns the - * Another_t object created. - */ -LIBSBML_EXTERN -Another_t* -BBB_createAnother(BBB_t* bbb) -{ - return (bbb != NULL) ? bbb->createAnother() : NULL; -} - - -/* - * Removes the nth Another_t from this BBB_t and returns a pointer to it. - */ -LIBSBML_EXTERN -Another_t* -BBB_removeAnother(BBB_t* bbb, unsigned int n) -{ - return (bbb != NULL) ? bbb->removeAnother(n) : NULL; -} - - -/* - * Removes the Another_t from this BBB_t based on its identifier and returns a - * pointer to it. - */ -LIBSBML_EXTERN -Another_t* -BBB_removeAnotherById(BBB_t* bbb, const char* sid) -{ - return (bbb != NULL && sid != NULL) ? bbb->removeAnother(sid) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * BBB_t object have been set. - */ -LIBSBML_EXTERN -int -BBB_hasRequiredAttributes(const BBB_t * bbb) -{ - return (bbb != NULL) ? static_cast(bbb->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file BBB.cpp + * @brief Implementation of the BBB class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new BBB using the given SBML Level, Version and “vers” + * package version. + */ +BBB::BBB(unsigned int level, unsigned int version, unsigned int pkgVersion) + : SBase(level, version) + , mAnothers (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new VersPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new BBB using the given VersPkgNamespaces object. + */ +BBB::BBB(VersPkgNamespaces *versns) + : SBase(versns) + , mAnothers (versns) +{ + setElementNamespace(versns->getURI()); + connectToChild(); + loadPlugins(versns); +} + + +/* + * Copy constructor for BBB. + */ +BBB::BBB(const BBB& orig) + : SBase( orig ) + , mAnothers ( orig.mAnothers ) +{ + connectToChild(); +} + + +/* + * Assignment operator for BBB. + */ +BBB& +BBB::operator=(const BBB& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mAnothers = rhs.mAnothers; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this BBB object. + */ +BBB* +BBB::clone() const +{ + return new BBB(*this); +} + + +/* + * Destructor for BBB. + */ +BBB::~BBB() +{ +} + + +/* + * Returns the value of the "id" attribute of this BBB. + */ +const std::string& +BBB::getId() const +{ + return mId; +} + + +/* + * Predicate returning @c true if this BBB's "id" attribute is set. + */ +bool +BBB::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Sets the value of the "id" attribute of this BBB. + */ +int +BBB::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Unsets the value of the "id" attribute of this BBB. + */ +int +BBB::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the ListOfAnothers from this BBB. + */ +const ListOfAnothers* +BBB::getListOfAnothers() const +{ + return &mAnothers; +} + + +/* + * Returns the ListOfAnothers from this BBB. + */ +ListOfAnothers* +BBB::getListOfAnothers() +{ + return &mAnothers; +} + + +/* + * Get an Another from the BBB. + */ +Another* +BBB::getAnother(unsigned int n) +{ + return mAnothers.get(n); +} + + +/* + * Get an Another from the BBB. + */ +const Another* +BBB::getAnother(unsigned int n) const +{ + return mAnothers.get(n); +} + + +/* + * Get an Another from the BBB based on its identifier. + */ +Another* +BBB::getAnother(const std::string& sid) +{ + return mAnothers.get(sid); +} + + +/* + * Get an Another from the BBB based on its identifier. + */ +const Another* +BBB::getAnother(const std::string& sid) const +{ + return mAnothers.get(sid); +} + + +/* + * Adds a copy of the given Another to this BBB. + */ +int +BBB::addAnother(const Another* a) +{ + if (a == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (a->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != a->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != a->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(a)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (a->isSetId() && (mAnothers.get(a->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mAnothers.append(a); + } +} + + +/* + * Get the number of Another objects in this BBB. + */ +unsigned int +BBB::getNumAnothers() const +{ + return mAnothers.size(); +} + + +/* + * Creates a new Another object, adds it to this BBB object and returns the + * Another object created. + */ +Another* +BBB::createAnother() +{ + Another* a = NULL; + + try + { + VERS_CREATE_NS_WITH_VERSION(versns, getSBMLNamespaces(), + getPackageVersion()); + a = new Another(versns); + delete versns; + } + catch (...) + { + } + + if (a != NULL) + { + mAnothers.appendAndOwn(a); + } + + return a; +} + + +/* + * Removes the nth Another from this BBB and returns a pointer to it. + */ +Another* +BBB::removeAnother(unsigned int n) +{ + return mAnothers.remove(n); +} + + +/* + * Removes the Another from this BBB based on its identifier and returns a + * pointer to it. + */ +Another* +BBB::removeAnother(const std::string& sid) +{ + return mAnothers.remove(sid); +} + + +/* + * Returns the XML element name of this BBB object. + */ +const std::string& +BBB::getElementName() const +{ + static const string name = "bBB"; + return name; +} + + +/* + * Returns the libSBML type code for this BBB object. + */ +int +BBB::getTypeCode() const +{ + return CLASS_B; +} + + +/* + * Predicate returning @c true if all the required attributes for this BBB + * object have been set. + */ +bool +BBB::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +BBB::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (getNumAnothers() > 0) + { + mAnothers.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +BBB::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mAnothers.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +BBB::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + mAnothers.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +BBB::connectToChild() +{ + SBase::connectToChild(); + + mAnothers.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +BBB::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mAnothers.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +BBB::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + mAnothers.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::getAttribute(const std::string& attributeName, unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::getAttribute(const std::string& attributeName, std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this BBB's attribute "attributeName" is set. + */ +bool +BBB::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::setAttribute(const std::string& attributeName, const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this BBB. + */ +int +BBB::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this BBB. + */ +SBase* +BBB::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "another") + { + return createAnother(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this BBB. + */ +int +BBB::addChildObject(const std::string& elementName, const SBase* element) +{ + if (elementName == "another" && element->getTypeCode() == CLASS_A) + { + return addAnother((const Another*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * BBB. + */ +SBase* +BBB::removeChildObject(const std::string& elementName, const std::string& id) +{ + if (elementName == "another") + { + return removeAnother(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this BBB. + */ +unsigned int +BBB::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "another") + { + return getNumAnothers(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this BBB. + */ +SBase* +BBB::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "another") + { + return getAnother(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +BBB::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + obj = mAnothers.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +BBB::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mAnothers.getMetaId() == metaid) + { + return &mAnothers; + } + + obj = mAnothers.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +BBB::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mAnothers, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +BBB::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "listOfAnothers") + { + if (getErrorLog() && mAnothers.size() != 0) + { + getErrorLog()->logPackageError("vers", VersBBBAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mAnothers; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +BBB::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + unsigned int level = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && coreVersion == 1 && pkgVersion == 1) + { + attributes.add("id"); + } + + if (level == 3 && coreVersion == 1 && pkgVersion == 2) + { + attributes.add("id"); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +BBB::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("vers", VersBBBAllowedAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("vers", VersBBBAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } + + if (level == 3 && version == 1 && pkgVersion == 1) + { + readL3V1V1Attributes(attributes); + } + + if (level == 3 && version == 1 && pkgVersion == 2) + { + readL3V1V2Attributes(attributes); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +BBB::readL3V1V1Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + + // + // id SId (use = "required" ) + // + + XMLTriple tripleID("id", mURI, getPrefix()); + assigned = attributes.readInto(tripleID, mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Vers attribute 'id' is missing from the " + "element."; + log->logPackageError("vers", VersBBBAllowedAttributes, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +BBB::readL3V1V2Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + + // + // id SId (use = "required" ) + // + + XMLTriple tripleID("id", mURI, getPrefix()); + assigned = attributes.readInto(tripleID, mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Vers attribute 'id' is missing from the " + "element."; + log->logPackageError("vers", VersBBBAllowedAttributes, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +BBB::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && version == 1 && pkgVersion == 1) + { + writeL3V1V1Attributes(stream); + } + + if (level == 3 && version == 1 && pkgVersion == 2) + { + writeL3V1V2Attributes(stream); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +BBB::writeL3V1V1Attributes(XMLOutputStream& stream) const +{ + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +BBB::writeL3V1V2Attributes(XMLOutputStream& stream) const +{ + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new BBB_t using the given SBML Level, Version and + * “vers” package version. + */ +LIBSBML_EXTERN +BBB_t * +BBB_create(unsigned int level, unsigned int version, unsigned int pkgVersion) +{ + return new BBB(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this BBB_t object. + */ +LIBSBML_EXTERN +BBB_t* +BBB_clone(const BBB_t* bbb) +{ + if (bbb != NULL) + { + return static_cast(bbb->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this BBB_t object. + */ +LIBSBML_EXTERN +void +BBB_free(BBB_t* bbb) +{ + if (bbb != NULL) + { + delete bbb; + } +} + + +/* + * Returns the value of the "id" attribute of this BBB_t. + */ +LIBSBML_EXTERN +char * +BBB_getId(const BBB_t * bbb) +{ + if (bbb == NULL) + { + return NULL; + } + + return bbb->getId().empty() ? NULL : safe_strdup(bbb->getId().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this BBB_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +BBB_isSetId(const BBB_t * bbb) +{ + return (bbb != NULL) ? static_cast(bbb->isSetId()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this BBB_t. + */ +LIBSBML_EXTERN +int +BBB_setId(BBB_t * bbb, const char * id) +{ + return (bbb != NULL) ? bbb->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this BBB_t. + */ +LIBSBML_EXTERN +int +BBB_unsetId(BBB_t * bbb) +{ + return (bbb != NULL) ? bbb->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing Another_t objects from this BBB_t. + */ +LIBSBML_EXTERN +ListOf_t* +BBB_getListOfAnothers(BBB_t* bbb) +{ + return (bbb != NULL) ? bbb->getListOfAnothers() : NULL; +} + + +/* + * Get an Another_t from the BBB_t. + */ +LIBSBML_EXTERN +Another_t* +BBB_getAnother(BBB_t* bbb, unsigned int n) +{ + return (bbb != NULL) ? bbb->getAnother(n) : NULL; +} + + +/* + * Get an Another_t from the BBB_t based on its identifier. + */ +LIBSBML_EXTERN +Another_t* +BBB_getAnotherById(BBB_t* bbb, const char *sid) +{ + return (bbb != NULL && sid != NULL) ? bbb->getAnother(sid) : NULL; +} + + +/* + * Adds a copy of the given Another_t to this BBB_t. + */ +LIBSBML_EXTERN +int +BBB_addAnother(BBB_t* bbb, const Another_t* a) +{ + return (bbb != NULL) ? bbb->addAnother(a) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of Another_t objects in this BBB_t. + */ +LIBSBML_EXTERN +unsigned int +BBB_getNumAnothers(BBB_t* bbb) +{ + return (bbb != NULL) ? bbb->getNumAnothers() : SBML_INT_MAX; +} + + +/* + * Creates a new Another_t object, adds it to this BBB_t object and returns the + * Another_t object created. + */ +LIBSBML_EXTERN +Another_t* +BBB_createAnother(BBB_t* bbb) +{ + return (bbb != NULL) ? bbb->createAnother() : NULL; +} + + +/* + * Removes the nth Another_t from this BBB_t and returns a pointer to it. + */ +LIBSBML_EXTERN +Another_t* +BBB_removeAnother(BBB_t* bbb, unsigned int n) +{ + return (bbb != NULL) ? bbb->removeAnother(n) : NULL; +} + + +/* + * Removes the Another_t from this BBB_t based on its identifier and returns a + * pointer to it. + */ +LIBSBML_EXTERN +Another_t* +BBB_removeAnotherById(BBB_t* bbb, const char* sid) +{ + return (bbb != NULL && sid != NULL) ? bbb->removeAnother(sid) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * BBB_t object have been set. + */ +LIBSBML_EXTERN +int +BBB_hasRequiredAttributes(const BBB_t * bbb) +{ + return (bbb != NULL) ? static_cast(bbb->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/BBB.h b/generator/tests/test_cpp_code/test-code/BBB.h index 4cebcf6f..ceb00f50 100644 --- a/generator/tests/test_cpp_code/test-code/BBB.h +++ b/generator/tests/test_cpp_code/test-code/BBB.h @@ -1,1309 +1,1309 @@ -/** - * @file BBB.h - * @brief Definition of the BBB class. - * @author SBMLTeam - * - * - * - * @class BBB - * @sbmlbrief{vers} TODO:Definition of the BBB class. - */ - - -#ifndef BBB_H__ -#define BBB_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN BBB : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - ListOfAnothers mAnothers; - - /** @endcond */ - -public: - - /** - * Creates a new BBB using the given SBML Level, Version and - * “vers” package version. - * - * @param level an unsigned int, the SBML Level to assign to this BBB. - * - * @param version an unsigned int, the SBML Version to assign to this BBB. - * - * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this - * BBB. - * - * @copydetails doc_note_setting_lv_pkg - */ - BBB(unsigned int level = VersExtension::getDefaultLevel(), - unsigned int version = VersExtension::getDefaultVersion(), - unsigned int pkgVersion = VersExtension::getDefaultPackageVersion()); - - - /** - * Creates a new BBB using the given VersPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param versns the VersPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - BBB(VersPkgNamespaces *versns); - - - /** - * Copy constructor for BBB. - * - * @param orig the BBB instance to copy. - */ - BBB(const BBB& orig); - - - /** - * Assignment operator for BBB. - * - * @param rhs the BBB object whose values are to be used as the basis of the - * assignment. - */ - BBB& operator=(const BBB& rhs); - - - /** - * Creates and returns a deep copy of this BBB object. - * - * @return a (deep) copy of this BBB object. - */ - virtual BBB* clone() const; - - - /** - * Destructor for BBB. - */ - virtual ~BBB(); - - - /** - * Returns the value of the "id" attribute of this BBB. - * - * @return the value of the "id" attribute of this BBB as a string. - */ - virtual const std::string& getId() const; - - - /** - * Predicate returning @c true if this BBB's "id" attribute is set. - * - * @return @c true if this BBB's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Sets the value of the "id" attribute of this BBB. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Unsets the value of the "id" attribute of this BBB. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Returns the ListOfAnothers from this BBB. - * - * @return the ListOfAnothers from this BBB. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - const ListOfAnothers* getListOfAnothers() const; - - - /** - * Returns the ListOfAnothers from this BBB. - * - * @return the ListOfAnothers from this BBB. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - ListOfAnothers* getListOfAnothers(); - - - /** - * Get an Another from the BBB. - * - * @param n an unsigned int representing the index of the Another to - * retrieve. - * - * @return the nth Another in the ListOfAnothers within this BBB or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - Another* getAnother(unsigned int n); - - - /** - * Get an Another from the BBB. - * - * @param n an unsigned int representing the index of the Another to - * retrieve. - * - * @return the nth Another in the ListOfAnothers within this BBB or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - const Another* getAnother(unsigned int n) const; - - - /** - * Get an Another from the BBB based on its identifier. - * - * @param sid a string representing the identifier of the Another to - * retrieve. - * - * @return the Another in the ListOfAnothers within this BBB with the given - * @p sid or @c NULL if no such Another exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - Another* getAnother(const std::string& sid); - - - /** - * Get an Another from the BBB based on its identifier. - * - * @param sid a string representing the identifier of the Another to - * retrieve. - * - * @return the Another in the ListOfAnothers within this BBB with the given - * @p sid or @c NULL if no such Another exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - const Another* getAnother(const std::string& sid) const; - - - /** - * Adds a copy of the given Another to this BBB. - * - * @param a the Another object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - int addAnother(const Another* a); - - - /** - * Get the number of Another objects in this BBB. - * - * @return the number of Another objects in this BBB. - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getAnother(unsigned int n) - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - unsigned int getNumAnothers() const; - - - /** - * Creates a new Another object, adds it to this BBB object and returns the - * Another object created. - * - * @return a new Another object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAnother(const Another* object) - * @see getAnother(const std::string& sid) - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - * @see removeAnother(unsigned int n) - */ - Another* createAnother(); - - - /** - * Removes the nth Another from this BBB and returns a pointer to it. - * - * @param n an unsigned int representing the index of the Another to remove. - * - * @return a pointer to the nth Another in this BBB. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(const std::string& sid) - */ - Another* removeAnother(unsigned int n); - - - /** - * Removes the Another from this BBB based on its identifier and returns a - * pointer to it. - * - * @param sid a string representing the identifier of the Another to remove. - * - * @return the Another in this BBB based on the identifier or NULL if no such - * Another exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addAnother(const Another* object) - * @see createAnother() - * @see getAnother(const std::string& sid) - * @see getAnother(unsigned int n) - * @see getNumAnothers() - * @see removeAnother(unsigned int n) - */ - Another* removeAnother(const std::string& sid); - - - /** - * Returns the XML element name of this BBB object. - * - * For BBB, the XML element name is always @c "bBB". - * - * @return the name of this element, i.e. @c "bBB". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this BBB object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{CLASS_B, SBMLVersTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this BBB - * object have been set. - * - * @return @c true to indicate that all the required attributes of this BBB - * have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the BBB object are: - * @li "id" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this BBB's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this BBB's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this BBB. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this BBB. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this BBB. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * BBB. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this BBB. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this BBB. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V1V1Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V1V2Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V1V1Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V1V2Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new BBB_t using the given SBML Level, Version and - * “vers” package version. - * - * @param level an unsigned int, the SBML Level to assign to this BBB_t. - * - * @param version an unsigned int, the SBML Version to assign to this BBB_t. - * - * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this - * BBB_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -BBB_t * -BBB_create(unsigned int level, unsigned int version, unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this BBB_t object. - * - * @param bbb the BBB_t structure. - * - * @return a (deep) copy of this BBB_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -BBB_t* -BBB_clone(const BBB_t* bbb); - - -/** - * Frees this BBB_t object. - * - * @param bbb the BBB_t structure. - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -void -BBB_free(BBB_t* bbb); - - -/** - * Returns the value of the "id" attribute of this BBB_t. - * - * @param bbb the BBB_t structure whose id is sought. - * - * @return the value of the "id" attribute of this BBB_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -char * -BBB_getId(const BBB_t * bbb); - - -/** - * Predicate returning @c 1 (true) if this BBB_t's "id" attribute is set. - * - * @param bbb the BBB_t structure. - * - * @return @c 1 (true) if this BBB_t's "id" attribute has been set, otherwise - * @c 0 (false) is returned. - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -int -BBB_isSetId(const BBB_t * bbb); - - -/** - * Sets the value of the "id" attribute of this BBB_t. - * - * @param bbb the BBB_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling BBB_unsetId(). - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -int -BBB_setId(BBB_t * bbb, const char * id); - - -/** - * Unsets the value of the "id" attribute of this BBB_t. - * - * @param bbb the BBB_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -int -BBB_unsetId(BBB_t * bbb); - - -/** - * Returns a ListOf_t * containing Another_t objects from this BBB_t. - * - * @param bbb the BBB_t structure whose ListOfAnothers is sought. - * - * @return the ListOfAnothers from this BBB_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see BBB_addAnother() - * @see BBB_createAnother() - * @see BBB_getAnotherById() - * @see BBB_getAnother() - * @see BBB_getNumAnothers() - * @see BBB_removeAnotherById() - * @see BBB_removeAnother() - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -ListOf_t* -BBB_getListOfAnothers(BBB_t* bbb); - - -/** - * Get an Another_t from the BBB_t. - * - * @param bbb the BBB_t structure to search. - * - * @param n an unsigned int representing the index of the Another_t to - * retrieve. - * - * @return the nth Another_t in the ListOfAnothers within this BBB or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -Another_t* -BBB_getAnother(BBB_t* bbb, unsigned int n); - - -/** - * Get an Another_t from the BBB_t based on its identifier. - * - * @param bbb the BBB_t structure to search. - * - * @param sid a string representing the identifier of the Another_t to - * retrieve. - * - * @return the Another_t in the ListOfAnothers within this BBB with the given - * @p sid or @c NULL if no such Another_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -Another_t* -BBB_getAnotherById(BBB_t* bbb, const char *sid); - - -/** - * Adds a copy of the given Another_t to this BBB_t. - * - * @param bbb the BBB_t structure to which the Another_t should be added. - * - * @param a the Another_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -int -BBB_addAnother(BBB_t* bbb, const Another_t* a); - - -/** - * Get the number of Another_t objects in this BBB_t. - * - * @param bbb the BBB_t structure to query. - * - * @return the number of Another_t objects in this BBB_t. - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -unsigned int -BBB_getNumAnothers(BBB_t* bbb); - - -/** - * Creates a new Another_t object, adds it to this BBB_t object and returns the - * Another_t object created. - * - * @param bbb the BBB_t structure to which the Another_t should be added. - * - * @return a new Another_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -Another_t* -BBB_createAnother(BBB_t* bbb); - - -/** - * Removes the nth Another_t from this BBB_t and returns a pointer to it. - * - * @param bbb the BBB_t structure to search. - * - * @param n an unsigned int representing the index of the Another_t to remove. - * - * @return a pointer to the nth Another_t in this BBB_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -Another_t* -BBB_removeAnother(BBB_t* bbb, unsigned int n); - - -/** - * Removes the Another_t from this BBB_t based on its identifier and returns a - * pointer to it. - * - * @param bbb the BBB_t structure to search. - * - * @param sid a string representing the identifier of the Another_t to remove. - * - * @return the Another_t in this BBB_t based on the identifier or NULL if no - * such Another_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -Another_t* -BBB_removeAnotherById(BBB_t* bbb, const char* sid); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * BBB_t object have been set. - * - * @param bbb the BBB_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * BBB_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the BBB_t object are: - * @li "id" - * - * @memberof BBB_t - */ -LIBSBML_EXTERN -int -BBB_hasRequiredAttributes(const BBB_t * bbb); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !BBB_H__ */ - - +/** + * @file BBB.h + * @brief Definition of the BBB class. + * @author SBMLTeam + * + * + * + * @class BBB + * @sbmlbrief{vers} TODO:Definition of the BBB class. + */ + + +#ifndef BBB_H__ +#define BBB_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN BBB : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + ListOfAnothers mAnothers; + + /** @endcond */ + +public: + + /** + * Creates a new BBB using the given SBML Level, Version and + * “vers” package version. + * + * @param level an unsigned int, the SBML Level to assign to this BBB. + * + * @param version an unsigned int, the SBML Version to assign to this BBB. + * + * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this + * BBB. + * + * @copydetails doc_note_setting_lv_pkg + */ + BBB(unsigned int level = VersExtension::getDefaultLevel(), + unsigned int version = VersExtension::getDefaultVersion(), + unsigned int pkgVersion = VersExtension::getDefaultPackageVersion()); + + + /** + * Creates a new BBB using the given VersPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param versns the VersPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + BBB(VersPkgNamespaces *versns); + + + /** + * Copy constructor for BBB. + * + * @param orig the BBB instance to copy. + */ + BBB(const BBB& orig); + + + /** + * Assignment operator for BBB. + * + * @param rhs the BBB object whose values are to be used as the basis of the + * assignment. + */ + BBB& operator=(const BBB& rhs); + + + /** + * Creates and returns a deep copy of this BBB object. + * + * @return a (deep) copy of this BBB object. + */ + virtual BBB* clone() const; + + + /** + * Destructor for BBB. + */ + virtual ~BBB(); + + + /** + * Returns the value of the "id" attribute of this BBB. + * + * @return the value of the "id" attribute of this BBB as a string. + */ + virtual const std::string& getId() const; + + + /** + * Predicate returning @c true if this BBB's "id" attribute is set. + * + * @return @c true if this BBB's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Sets the value of the "id" attribute of this BBB. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Unsets the value of the "id" attribute of this BBB. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Returns the ListOfAnothers from this BBB. + * + * @return the ListOfAnothers from this BBB. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + const ListOfAnothers* getListOfAnothers() const; + + + /** + * Returns the ListOfAnothers from this BBB. + * + * @return the ListOfAnothers from this BBB. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + ListOfAnothers* getListOfAnothers(); + + + /** + * Get an Another from the BBB. + * + * @param n an unsigned int representing the index of the Another to + * retrieve. + * + * @return the nth Another in the ListOfAnothers within this BBB or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + Another* getAnother(unsigned int n); + + + /** + * Get an Another from the BBB. + * + * @param n an unsigned int representing the index of the Another to + * retrieve. + * + * @return the nth Another in the ListOfAnothers within this BBB or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + const Another* getAnother(unsigned int n) const; + + + /** + * Get an Another from the BBB based on its identifier. + * + * @param sid a string representing the identifier of the Another to + * retrieve. + * + * @return the Another in the ListOfAnothers within this BBB with the given + * @p sid or @c NULL if no such Another exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + Another* getAnother(const std::string& sid); + + + /** + * Get an Another from the BBB based on its identifier. + * + * @param sid a string representing the identifier of the Another to + * retrieve. + * + * @return the Another in the ListOfAnothers within this BBB with the given + * @p sid or @c NULL if no such Another exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + const Another* getAnother(const std::string& sid) const; + + + /** + * Adds a copy of the given Another to this BBB. + * + * @param a the Another object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + int addAnother(const Another* a); + + + /** + * Get the number of Another objects in this BBB. + * + * @return the number of Another objects in this BBB. + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getAnother(unsigned int n) + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + unsigned int getNumAnothers() const; + + + /** + * Creates a new Another object, adds it to this BBB object and returns the + * Another object created. + * + * @return a new Another object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAnother(const Another* object) + * @see getAnother(const std::string& sid) + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + * @see removeAnother(unsigned int n) + */ + Another* createAnother(); + + + /** + * Removes the nth Another from this BBB and returns a pointer to it. + * + * @param n an unsigned int representing the index of the Another to remove. + * + * @return a pointer to the nth Another in this BBB. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(const std::string& sid) + */ + Another* removeAnother(unsigned int n); + + + /** + * Removes the Another from this BBB based on its identifier and returns a + * pointer to it. + * + * @param sid a string representing the identifier of the Another to remove. + * + * @return the Another in this BBB based on the identifier or NULL if no such + * Another exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addAnother(const Another* object) + * @see createAnother() + * @see getAnother(const std::string& sid) + * @see getAnother(unsigned int n) + * @see getNumAnothers() + * @see removeAnother(unsigned int n) + */ + Another* removeAnother(const std::string& sid); + + + /** + * Returns the XML element name of this BBB object. + * + * For BBB, the XML element name is always @c "bBB". + * + * @return the name of this element, i.e. @c "bBB". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this BBB object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{CLASS_B, SBMLVersTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this BBB + * object have been set. + * + * @return @c true to indicate that all the required attributes of this BBB + * have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the BBB object are: + * @li "id" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this BBB's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this BBB's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this BBB. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this BBB. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this BBB. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * BBB. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this BBB. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this BBB. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V1V1Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V1V2Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V1V1Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V1V2Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new BBB_t using the given SBML Level, Version and + * “vers” package version. + * + * @param level an unsigned int, the SBML Level to assign to this BBB_t. + * + * @param version an unsigned int, the SBML Version to assign to this BBB_t. + * + * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this + * BBB_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +BBB_t * +BBB_create(unsigned int level, unsigned int version, unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this BBB_t object. + * + * @param bbb the BBB_t structure. + * + * @return a (deep) copy of this BBB_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +BBB_t* +BBB_clone(const BBB_t* bbb); + + +/** + * Frees this BBB_t object. + * + * @param bbb the BBB_t structure. + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +void +BBB_free(BBB_t* bbb); + + +/** + * Returns the value of the "id" attribute of this BBB_t. + * + * @param bbb the BBB_t structure whose id is sought. + * + * @return the value of the "id" attribute of this BBB_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +char * +BBB_getId(const BBB_t * bbb); + + +/** + * Predicate returning @c 1 (true) if this BBB_t's "id" attribute is set. + * + * @param bbb the BBB_t structure. + * + * @return @c 1 (true) if this BBB_t's "id" attribute has been set, otherwise + * @c 0 (false) is returned. + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +int +BBB_isSetId(const BBB_t * bbb); + + +/** + * Sets the value of the "id" attribute of this BBB_t. + * + * @param bbb the BBB_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling BBB_unsetId(). + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +int +BBB_setId(BBB_t * bbb, const char * id); + + +/** + * Unsets the value of the "id" attribute of this BBB_t. + * + * @param bbb the BBB_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +int +BBB_unsetId(BBB_t * bbb); + + +/** + * Returns a ListOf_t * containing Another_t objects from this BBB_t. + * + * @param bbb the BBB_t structure whose ListOfAnothers is sought. + * + * @return the ListOfAnothers from this BBB_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see BBB_addAnother() + * @see BBB_createAnother() + * @see BBB_getAnotherById() + * @see BBB_getAnother() + * @see BBB_getNumAnothers() + * @see BBB_removeAnotherById() + * @see BBB_removeAnother() + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +ListOf_t* +BBB_getListOfAnothers(BBB_t* bbb); + + +/** + * Get an Another_t from the BBB_t. + * + * @param bbb the BBB_t structure to search. + * + * @param n an unsigned int representing the index of the Another_t to + * retrieve. + * + * @return the nth Another_t in the ListOfAnothers within this BBB or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +Another_t* +BBB_getAnother(BBB_t* bbb, unsigned int n); + + +/** + * Get an Another_t from the BBB_t based on its identifier. + * + * @param bbb the BBB_t structure to search. + * + * @param sid a string representing the identifier of the Another_t to + * retrieve. + * + * @return the Another_t in the ListOfAnothers within this BBB with the given + * @p sid or @c NULL if no such Another_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +Another_t* +BBB_getAnotherById(BBB_t* bbb, const char *sid); + + +/** + * Adds a copy of the given Another_t to this BBB_t. + * + * @param bbb the BBB_t structure to which the Another_t should be added. + * + * @param a the Another_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +int +BBB_addAnother(BBB_t* bbb, const Another_t* a); + + +/** + * Get the number of Another_t objects in this BBB_t. + * + * @param bbb the BBB_t structure to query. + * + * @return the number of Another_t objects in this BBB_t. + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +unsigned int +BBB_getNumAnothers(BBB_t* bbb); + + +/** + * Creates a new Another_t object, adds it to this BBB_t object and returns the + * Another_t object created. + * + * @param bbb the BBB_t structure to which the Another_t should be added. + * + * @return a new Another_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +Another_t* +BBB_createAnother(BBB_t* bbb); + + +/** + * Removes the nth Another_t from this BBB_t and returns a pointer to it. + * + * @param bbb the BBB_t structure to search. + * + * @param n an unsigned int representing the index of the Another_t to remove. + * + * @return a pointer to the nth Another_t in this BBB_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +Another_t* +BBB_removeAnother(BBB_t* bbb, unsigned int n); + + +/** + * Removes the Another_t from this BBB_t based on its identifier and returns a + * pointer to it. + * + * @param bbb the BBB_t structure to search. + * + * @param sid a string representing the identifier of the Another_t to remove. + * + * @return the Another_t in this BBB_t based on the identifier or NULL if no + * such Another_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +Another_t* +BBB_removeAnotherById(BBB_t* bbb, const char* sid); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * BBB_t object have been set. + * + * @param bbb the BBB_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * BBB_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the BBB_t object are: + * @li "id" + * + * @memberof BBB_t + */ +LIBSBML_EXTERN +int +BBB_hasRequiredAttributes(const BBB_t * bbb); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !BBB_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/BernoulliDistribution.cpp b/generator/tests/test_cpp_code/test-code/BernoulliDistribution.cpp index cf213307..9970b59f 100644 --- a/generator/tests/test_cpp_code/test-code/BernoulliDistribution.cpp +++ b/generator/tests/test_cpp_code/test-code/BernoulliDistribution.cpp @@ -1,1133 +1,1133 @@ -/** - * @file BernoulliDistribution.cpp - * @brief Implementation of the BernoulliDistribution class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new BernoulliDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -BernoulliDistribution::BernoulliDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : CategoricalUnivariateDistribution(level, version, pkgVersion) - , mProb (NULL) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new BernoulliDistribution using the given DistribPkgNamespaces - * object. - */ -BernoulliDistribution::BernoulliDistribution(DistribPkgNamespaces *distribns) - : CategoricalUnivariateDistribution(distribns) - , mProb (NULL) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for BernoulliDistribution. - */ -BernoulliDistribution::BernoulliDistribution(const BernoulliDistribution& orig) - : CategoricalUnivariateDistribution( orig ) - , mProb ( NULL ) -{ - if (orig.mProb != NULL) - { - mProb = orig.mProb->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for BernoulliDistribution. - */ -BernoulliDistribution& -BernoulliDistribution::operator=(const BernoulliDistribution& rhs) -{ - if (&rhs != this) - { - CategoricalUnivariateDistribution::operator=(rhs); - delete mProb; - if (rhs.mProb != NULL) - { - mProb = rhs.mProb->clone(); - } - else - { - mProb = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this BernoulliDistribution object. - */ -BernoulliDistribution* -BernoulliDistribution::clone() const -{ - return new BernoulliDistribution(*this); -} - - -/* - * Destructor for BernoulliDistribution. - */ -BernoulliDistribution::~BernoulliDistribution() -{ - delete mProb; - mProb = NULL; -} - - -/* - * Returns the value of the "prob" element of this BernoulliDistribution. - */ -const UncertValue* -BernoulliDistribution::getProb() const -{ - return mProb; -} - - -/* - * Returns the value of the "prob" element of this BernoulliDistribution. - */ -UncertValue* -BernoulliDistribution::getProb() -{ - return mProb; -} - - -/* - * Predicate returning @c true if this BernoulliDistribution's "prob" element - * is set. - */ -bool -BernoulliDistribution::isSetProb() const -{ - return (mProb != NULL); -} - - -/* - * Sets the value of the "prob" element of this BernoulliDistribution. - */ -int -BernoulliDistribution::setProb(const UncertValue* prob) -{ - if (mProb == prob) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (prob == NULL) - { - delete mProb; - mProb = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mProb; - mProb = (prob != NULL) ? prob->clone() : NULL; - if (mProb != NULL) - { - mProb->setElementName("prob"); - mProb->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new UncertValue object, adds it to this BernoulliDistribution - * object and returns the UncertValue object created. - */ -UncertValue* -BernoulliDistribution::createProb() -{ - if (mProb != NULL) - { - delete mProb; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mProb = new UncertValue(distribns); - - mProb->setElementName("prob"); - - delete distribns; - - connectToChild(); - - return mProb; -} - - -/* - * Unsets the value of the "prob" element of this BernoulliDistribution. - */ -int -BernoulliDistribution::unsetProb() -{ - delete mProb; - mProb = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this BernoulliDistribution object. - */ -const std::string& -BernoulliDistribution::getElementName() const -{ - static const string name = "bernoulliDistribution"; - return name; -} - - -/* - * Returns the libSBML type code for this BernoulliDistribution object. - */ -int -BernoulliDistribution::getTypeCode() const -{ - return SBML_DISTRIB_BERNOULLIDISTRIBUTION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * BernoulliDistribution object have been set. - */ -bool -BernoulliDistribution::hasRequiredAttributes() const -{ - bool allPresent = CategoricalUnivariateDistribution::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * BernoulliDistribution object have been set. - */ -bool -BernoulliDistribution::hasRequiredElements() const -{ - bool allPresent = CategoricalUnivariateDistribution::hasRequiredElements(); - - if (isSetProb() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -BernoulliDistribution::writeElements(XMLOutputStream& stream) const -{ - CategoricalUnivariateDistribution::writeElements(stream); - - if (isSetProb() == true) - { - mProb->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -BernoulliDistribution::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mProb != NULL) - { - mProb->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -BernoulliDistribution::setSBMLDocument(SBMLDocument* d) -{ - CategoricalUnivariateDistribution::setSBMLDocument(d); - - if (mProb != NULL) - { - mProb->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -BernoulliDistribution::connectToChild() -{ - CategoricalUnivariateDistribution::connectToChild(); - - if (mProb != NULL) - { - mProb->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -BernoulliDistribution::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - CategoricalUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, - flag); - - if (isSetProb()) - { - mProb->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -BernoulliDistribution::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - CategoricalUnivariateDistribution::updateSBMLNamespace(package, level, - version); - - if (mProb != NULL) - { - mProb->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this BernoulliDistribution's attribute - * "attributeName" is set. - */ -bool -BernoulliDistribution::isSetAttribute(const std::string& attributeName) const -{ - bool value = - CategoricalUnivariateDistribution::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::setAttribute(const std::string& attributeName, - int value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * BernoulliDistribution. - */ -int -BernoulliDistribution::unsetAttribute(const std::string& attributeName) -{ - int value = CategoricalUnivariateDistribution::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this - * BernoulliDistribution. - */ -SBase* -BernoulliDistribution::createChildObject(const std::string& elementName) -{ - CategoricalUnivariateDistribution* obj = NULL; - - if (elementName == "prob") - { - return createProb(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this BernoulliDistribution. - */ -int -BernoulliDistribution::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "prob" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setProb((const UncertValue*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * BernoulliDistribution. - */ -SBase* -BernoulliDistribution::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "prob") - { - UncertValue * obj = mProb; - mProb = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this BernoulliDistribution. - */ -unsigned int -BernoulliDistribution::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "prob") - { - if (isSetProb()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this BernoulliDistribution. - */ -SBase* -BernoulliDistribution::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "prob") - { - return getProb(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -BernoulliDistribution::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mProb != NULL) - { - if (mProb->getId() == id) - { - return mProb; - } - - obj = mProb->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -BernoulliDistribution::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mProb != NULL) - { - if (mProb->getMetaId() == metaid) - { - return mProb; - } - - obj = mProb->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -BernoulliDistribution::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mProb, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -BernoulliDistribution::createObject(XMLInputStream& stream) -{ - SBase* obj = CategoricalUnivariateDistribution::createObject(stream); - - const std::string& name = stream.peek().getName(); - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - - if (name == "prob") - { - if (getErrorLog() && isSetProb()) - { - getErrorLog()->logPackageError("distrib", - DistribBernoulliDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mProb; - mProb = new UncertValue(distribns); - mProb->setElementName(name); - obj = mProb; - } - - delete distribns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -BernoulliDistribution::addExpectedAttributes(ExpectedAttributes& attributes) -{ - CategoricalUnivariateDistribution::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -BernoulliDistribution::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - CategoricalUnivariateDistribution::readAttributes(attributes, - expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribBernoulliDistributionAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribBernoulliDistributionAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -BernoulliDistribution::writeAttributes(XMLOutputStream& stream) const -{ - CategoricalUnivariateDistribution::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new BernoulliDistribution_t using the given SBML Level, Version - * and “distrib” package version. - */ -LIBSBML_EXTERN -BernoulliDistribution_t * -BernoulliDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new BernoulliDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this BernoulliDistribution_t object. - */ -LIBSBML_EXTERN -BernoulliDistribution_t* -BernoulliDistribution_clone(const BernoulliDistribution_t* bd) -{ - if (bd != NULL) - { - return static_cast(bd->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this BernoulliDistribution_t object. - */ -LIBSBML_EXTERN -void -BernoulliDistribution_free(BernoulliDistribution_t* bd) -{ - if (bd != NULL) - { - delete bd; - } -} - - -/* - * Returns the value of the "prob" element of this BernoulliDistribution_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -BernoulliDistribution_getProb(const BernoulliDistribution_t * bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->getProb()); -} - - -/* - * Predicate returning @c 1 (true) if this BernoulliDistribution_t's "prob" - * element is set. - */ -LIBSBML_EXTERN -int -BernoulliDistribution_isSetProb(const BernoulliDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->isSetProb()) : 0; -} - - -/* - * Sets the value of the "prob" element of this BernoulliDistribution_t. - */ -LIBSBML_EXTERN -int -BernoulliDistribution_setProb(BernoulliDistribution_t * bd, - const UncertValue_t* prob) -{ - return (bd != NULL) ? bd->setProb(prob) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new UncertValue_t object, adds it to this BernoulliDistribution_t - * object and returns the UncertValue_t object created. - */ -LIBSBML_EXTERN -UncertValue_t* -BernoulliDistribution_createProb(BernoulliDistribution_t* bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->createProb()); -} - - -/* - * Unsets the value of the "prob" element of this BernoulliDistribution_t. - */ -LIBSBML_EXTERN -int -BernoulliDistribution_unsetProb(BernoulliDistribution_t * bd) -{ - return (bd != NULL) ? bd->unsetProb() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * BernoulliDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -BernoulliDistribution_hasRequiredAttributes(const BernoulliDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * BernoulliDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -BernoulliDistribution_hasRequiredElements(const BernoulliDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file BernoulliDistribution.cpp + * @brief Implementation of the BernoulliDistribution class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new BernoulliDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +BernoulliDistribution::BernoulliDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : CategoricalUnivariateDistribution(level, version, pkgVersion) + , mProb (NULL) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new BernoulliDistribution using the given DistribPkgNamespaces + * object. + */ +BernoulliDistribution::BernoulliDistribution(DistribPkgNamespaces *distribns) + : CategoricalUnivariateDistribution(distribns) + , mProb (NULL) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for BernoulliDistribution. + */ +BernoulliDistribution::BernoulliDistribution(const BernoulliDistribution& orig) + : CategoricalUnivariateDistribution( orig ) + , mProb ( NULL ) +{ + if (orig.mProb != NULL) + { + mProb = orig.mProb->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for BernoulliDistribution. + */ +BernoulliDistribution& +BernoulliDistribution::operator=(const BernoulliDistribution& rhs) +{ + if (&rhs != this) + { + CategoricalUnivariateDistribution::operator=(rhs); + delete mProb; + if (rhs.mProb != NULL) + { + mProb = rhs.mProb->clone(); + } + else + { + mProb = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this BernoulliDistribution object. + */ +BernoulliDistribution* +BernoulliDistribution::clone() const +{ + return new BernoulliDistribution(*this); +} + + +/* + * Destructor for BernoulliDistribution. + */ +BernoulliDistribution::~BernoulliDistribution() +{ + delete mProb; + mProb = NULL; +} + + +/* + * Returns the value of the "prob" element of this BernoulliDistribution. + */ +const UncertValue* +BernoulliDistribution::getProb() const +{ + return mProb; +} + + +/* + * Returns the value of the "prob" element of this BernoulliDistribution. + */ +UncertValue* +BernoulliDistribution::getProb() +{ + return mProb; +} + + +/* + * Predicate returning @c true if this BernoulliDistribution's "prob" element + * is set. + */ +bool +BernoulliDistribution::isSetProb() const +{ + return (mProb != NULL); +} + + +/* + * Sets the value of the "prob" element of this BernoulliDistribution. + */ +int +BernoulliDistribution::setProb(const UncertValue* prob) +{ + if (mProb == prob) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (prob == NULL) + { + delete mProb; + mProb = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mProb; + mProb = (prob != NULL) ? prob->clone() : NULL; + if (mProb != NULL) + { + mProb->setElementName("prob"); + mProb->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new UncertValue object, adds it to this BernoulliDistribution + * object and returns the UncertValue object created. + */ +UncertValue* +BernoulliDistribution::createProb() +{ + if (mProb != NULL) + { + delete mProb; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mProb = new UncertValue(distribns); + + mProb->setElementName("prob"); + + delete distribns; + + connectToChild(); + + return mProb; +} + + +/* + * Unsets the value of the "prob" element of this BernoulliDistribution. + */ +int +BernoulliDistribution::unsetProb() +{ + delete mProb; + mProb = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this BernoulliDistribution object. + */ +const std::string& +BernoulliDistribution::getElementName() const +{ + static const string name = "bernoulliDistribution"; + return name; +} + + +/* + * Returns the libSBML type code for this BernoulliDistribution object. + */ +int +BernoulliDistribution::getTypeCode() const +{ + return SBML_DISTRIB_BERNOULLIDISTRIBUTION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * BernoulliDistribution object have been set. + */ +bool +BernoulliDistribution::hasRequiredAttributes() const +{ + bool allPresent = CategoricalUnivariateDistribution::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * BernoulliDistribution object have been set. + */ +bool +BernoulliDistribution::hasRequiredElements() const +{ + bool allPresent = CategoricalUnivariateDistribution::hasRequiredElements(); + + if (isSetProb() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +BernoulliDistribution::writeElements(XMLOutputStream& stream) const +{ + CategoricalUnivariateDistribution::writeElements(stream); + + if (isSetProb() == true) + { + mProb->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +BernoulliDistribution::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mProb != NULL) + { + mProb->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +BernoulliDistribution::setSBMLDocument(SBMLDocument* d) +{ + CategoricalUnivariateDistribution::setSBMLDocument(d); + + if (mProb != NULL) + { + mProb->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +BernoulliDistribution::connectToChild() +{ + CategoricalUnivariateDistribution::connectToChild(); + + if (mProb != NULL) + { + mProb->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +BernoulliDistribution::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + CategoricalUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, + flag); + + if (isSetProb()) + { + mProb->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +BernoulliDistribution::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + CategoricalUnivariateDistribution::updateSBMLNamespace(package, level, + version); + + if (mProb != NULL) + { + mProb->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this BernoulliDistribution's attribute + * "attributeName" is set. + */ +bool +BernoulliDistribution::isSetAttribute(const std::string& attributeName) const +{ + bool value = + CategoricalUnivariateDistribution::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::setAttribute(const std::string& attributeName, + int value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * BernoulliDistribution. + */ +int +BernoulliDistribution::unsetAttribute(const std::string& attributeName) +{ + int value = CategoricalUnivariateDistribution::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this + * BernoulliDistribution. + */ +SBase* +BernoulliDistribution::createChildObject(const std::string& elementName) +{ + CategoricalUnivariateDistribution* obj = NULL; + + if (elementName == "prob") + { + return createProb(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this BernoulliDistribution. + */ +int +BernoulliDistribution::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "prob" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setProb((const UncertValue*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * BernoulliDistribution. + */ +SBase* +BernoulliDistribution::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "prob") + { + UncertValue * obj = mProb; + mProb = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this BernoulliDistribution. + */ +unsigned int +BernoulliDistribution::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "prob") + { + if (isSetProb()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this BernoulliDistribution. + */ +SBase* +BernoulliDistribution::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "prob") + { + return getProb(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +BernoulliDistribution::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mProb != NULL) + { + if (mProb->getId() == id) + { + return mProb; + } + + obj = mProb->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +BernoulliDistribution::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mProb != NULL) + { + if (mProb->getMetaId() == metaid) + { + return mProb; + } + + obj = mProb->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +BernoulliDistribution::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mProb, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +BernoulliDistribution::createObject(XMLInputStream& stream) +{ + SBase* obj = CategoricalUnivariateDistribution::createObject(stream); + + const std::string& name = stream.peek().getName(); + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + + if (name == "prob") + { + if (getErrorLog() && isSetProb()) + { + getErrorLog()->logPackageError("distrib", + DistribBernoulliDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mProb; + mProb = new UncertValue(distribns); + mProb->setElementName(name); + obj = mProb; + } + + delete distribns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +BernoulliDistribution::addExpectedAttributes(ExpectedAttributes& attributes) +{ + CategoricalUnivariateDistribution::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +BernoulliDistribution::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + CategoricalUnivariateDistribution::readAttributes(attributes, + expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribBernoulliDistributionAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribBernoulliDistributionAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +BernoulliDistribution::writeAttributes(XMLOutputStream& stream) const +{ + CategoricalUnivariateDistribution::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new BernoulliDistribution_t using the given SBML Level, Version + * and “distrib” package version. + */ +LIBSBML_EXTERN +BernoulliDistribution_t * +BernoulliDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new BernoulliDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this BernoulliDistribution_t object. + */ +LIBSBML_EXTERN +BernoulliDistribution_t* +BernoulliDistribution_clone(const BernoulliDistribution_t* bd) +{ + if (bd != NULL) + { + return static_cast(bd->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this BernoulliDistribution_t object. + */ +LIBSBML_EXTERN +void +BernoulliDistribution_free(BernoulliDistribution_t* bd) +{ + if (bd != NULL) + { + delete bd; + } +} + + +/* + * Returns the value of the "prob" element of this BernoulliDistribution_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +BernoulliDistribution_getProb(const BernoulliDistribution_t * bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->getProb()); +} + + +/* + * Predicate returning @c 1 (true) if this BernoulliDistribution_t's "prob" + * element is set. + */ +LIBSBML_EXTERN +int +BernoulliDistribution_isSetProb(const BernoulliDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->isSetProb()) : 0; +} + + +/* + * Sets the value of the "prob" element of this BernoulliDistribution_t. + */ +LIBSBML_EXTERN +int +BernoulliDistribution_setProb(BernoulliDistribution_t * bd, + const UncertValue_t* prob) +{ + return (bd != NULL) ? bd->setProb(prob) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new UncertValue_t object, adds it to this BernoulliDistribution_t + * object and returns the UncertValue_t object created. + */ +LIBSBML_EXTERN +UncertValue_t* +BernoulliDistribution_createProb(BernoulliDistribution_t* bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->createProb()); +} + + +/* + * Unsets the value of the "prob" element of this BernoulliDistribution_t. + */ +LIBSBML_EXTERN +int +BernoulliDistribution_unsetProb(BernoulliDistribution_t * bd) +{ + return (bd != NULL) ? bd->unsetProb() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * BernoulliDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +BernoulliDistribution_hasRequiredAttributes(const BernoulliDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * BernoulliDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +BernoulliDistribution_hasRequiredElements(const BernoulliDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/BernoulliDistribution.h b/generator/tests/test_cpp_code/test-code/BernoulliDistribution.h index d6bafb32..263545bc 100644 --- a/generator/tests/test_cpp_code/test-code/BernoulliDistribution.h +++ b/generator/tests/test_cpp_code/test-code/BernoulliDistribution.h @@ -1,971 +1,971 @@ -/** - * @file BernoulliDistribution.h - * @brief Definition of the BernoulliDistribution class. - * @author SBMLTeam - * - * - * - * @class BernoulliDistribution - * @sbmlbrief{distrib} TODO:Definition of the BernoulliDistribution class. - */ - - -#ifndef BernoulliDistribution_H__ -#define BernoulliDistribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN BernoulliDistribution : public - CategoricalUnivariateDistribution -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - UncertValue* mProb; - - /** @endcond */ - -public: - - /** - * Creates a new BernoulliDistribution using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * BernoulliDistribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * BernoulliDistribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this BernoulliDistribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - BernoulliDistribution(unsigned int level = - DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new BernoulliDistribution using the given DistribPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - BernoulliDistribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for BernoulliDistribution. - * - * @param orig the BernoulliDistribution instance to copy. - */ - BernoulliDistribution(const BernoulliDistribution& orig); - - - /** - * Assignment operator for BernoulliDistribution. - * - * @param rhs the BernoulliDistribution object whose values are to be used as - * the basis of the assignment. - */ - BernoulliDistribution& operator=(const BernoulliDistribution& rhs); - - - /** - * Creates and returns a deep copy of this BernoulliDistribution object. - * - * @return a (deep) copy of this BernoulliDistribution object. - */ - virtual BernoulliDistribution* clone() const; - - - /** - * Destructor for BernoulliDistribution. - */ - virtual ~BernoulliDistribution(); - - - /** - * Returns the value of the "prob" element of this BernoulliDistribution. - * - * @return the value of the "prob" element of this BernoulliDistribution as a - * UncertValue*. - */ - const UncertValue* getProb() const; - - - /** - * Returns the value of the "prob" element of this BernoulliDistribution. - * - * @return the value of the "prob" element of this BernoulliDistribution as a - * UncertValue*. - */ - UncertValue* getProb(); - - - /** - * Predicate returning @c true if this BernoulliDistribution's "prob" element - * is set. - * - * @return @c true if this BernoulliDistribution's "prob" element has been - * set, otherwise @c false is returned. - */ - bool isSetProb() const; - - - /** - * Sets the value of the "prob" element of this BernoulliDistribution. - * - * @param prob UncertValue* value of the "prob" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setProb(const UncertValue* prob); - - - /** - * Creates a new UncertValue object, adds it to this BernoulliDistribution - * object and returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createProb(); - - - /** - * Unsets the value of the "prob" element of this BernoulliDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetProb(); - - - /** - * Returns the XML element name of this BernoulliDistribution object. - * - * For BernoulliDistribution, the XML element name is always - * @c "bernoulliDistribution". - * - * @return the name of this element, i.e. @c "bernoulliDistribution". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this BernoulliDistribution object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_BERNOULLIDISTRIBUTION, SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * BernoulliDistribution object have been set. - * - * @return @c true to indicate that all the required attributes of this - * BernoulliDistribution have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * BernoulliDistribution object have been set. - * - * @return @c true to indicate that all the required elements of this - * BernoulliDistribution have been set, otherwise @c false is returned. - * - * - * @note The required elements for the BernoulliDistribution object are: - * @li "prob" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this BernoulliDistribution's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this BernoulliDistribution's attribute "attributeName" - * has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * BernoulliDistribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this - * BernoulliDistribution. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this BernoulliDistribution. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * BernoulliDistribution. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this BernoulliDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this BernoulliDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new BernoulliDistribution_t using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * BernoulliDistribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * BernoulliDistribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this BernoulliDistribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -BernoulliDistribution_t * -BernoulliDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this BernoulliDistribution_t object. - * - * @param bd the BernoulliDistribution_t structure. - * - * @return a (deep) copy of this BernoulliDistribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -BernoulliDistribution_t* -BernoulliDistribution_clone(const BernoulliDistribution_t* bd); - - -/** - * Frees this BernoulliDistribution_t object. - * - * @param bd the BernoulliDistribution_t structure. - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -void -BernoulliDistribution_free(BernoulliDistribution_t* bd); - - -/** - * Returns the value of the "prob" element of this BernoulliDistribution_t. - * - * @param bd the BernoulliDistribution_t structure whose prob is sought. - * - * @return the value of the "prob" element of this BernoulliDistribution_t as a - * UncertValue*. - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -const UncertValue_t* -BernoulliDistribution_getProb(const BernoulliDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if this BernoulliDistribution_t's "prob" - * element is set. - * - * @param bd the BernoulliDistribution_t structure. - * - * @return @c 1 (true) if this BernoulliDistribution_t's "prob" element has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -int -BernoulliDistribution_isSetProb(const BernoulliDistribution_t * bd); - - -/** - * Sets the value of the "prob" element of this BernoulliDistribution_t. - * - * @param bd the BernoulliDistribution_t structure. - * - * @param prob UncertValue_t* value of the "prob" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -int -BernoulliDistribution_setProb(BernoulliDistribution_t * bd, - const UncertValue_t* prob); - - -/** - * Creates a new UncertValue_t object, adds it to this BernoulliDistribution_t - * object and returns the UncertValue_t object created. - * - * @param bd the BernoulliDistribution_t structure to which the UncertValue_t - * should be added. - * - * @return a new UncertValue_t object instance. - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -UncertValue_t* -BernoulliDistribution_createProb(BernoulliDistribution_t* bd); - - -/** - * Unsets the value of the "prob" element of this BernoulliDistribution_t. - * - * @param bd the BernoulliDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -int -BernoulliDistribution_unsetProb(BernoulliDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * BernoulliDistribution_t object have been set. - * - * @param bd the BernoulliDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * BernoulliDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -int -BernoulliDistribution_hasRequiredAttributes(const BernoulliDistribution_t * - bd); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * BernoulliDistribution_t object have been set. - * - * @param bd the BernoulliDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * BernoulliDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the BernoulliDistribution_t object are: - * @li "prob" - * - * @memberof BernoulliDistribution_t - */ -LIBSBML_EXTERN -int -BernoulliDistribution_hasRequiredElements(const BernoulliDistribution_t * bd); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !BernoulliDistribution_H__ */ - - +/** + * @file BernoulliDistribution.h + * @brief Definition of the BernoulliDistribution class. + * @author SBMLTeam + * + * + * + * @class BernoulliDistribution + * @sbmlbrief{distrib} TODO:Definition of the BernoulliDistribution class. + */ + + +#ifndef BernoulliDistribution_H__ +#define BernoulliDistribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN BernoulliDistribution : public + CategoricalUnivariateDistribution +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + UncertValue* mProb; + + /** @endcond */ + +public: + + /** + * Creates a new BernoulliDistribution using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * BernoulliDistribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * BernoulliDistribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this BernoulliDistribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + BernoulliDistribution(unsigned int level = + DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new BernoulliDistribution using the given DistribPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + BernoulliDistribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for BernoulliDistribution. + * + * @param orig the BernoulliDistribution instance to copy. + */ + BernoulliDistribution(const BernoulliDistribution& orig); + + + /** + * Assignment operator for BernoulliDistribution. + * + * @param rhs the BernoulliDistribution object whose values are to be used as + * the basis of the assignment. + */ + BernoulliDistribution& operator=(const BernoulliDistribution& rhs); + + + /** + * Creates and returns a deep copy of this BernoulliDistribution object. + * + * @return a (deep) copy of this BernoulliDistribution object. + */ + virtual BernoulliDistribution* clone() const; + + + /** + * Destructor for BernoulliDistribution. + */ + virtual ~BernoulliDistribution(); + + + /** + * Returns the value of the "prob" element of this BernoulliDistribution. + * + * @return the value of the "prob" element of this BernoulliDistribution as a + * UncertValue*. + */ + const UncertValue* getProb() const; + + + /** + * Returns the value of the "prob" element of this BernoulliDistribution. + * + * @return the value of the "prob" element of this BernoulliDistribution as a + * UncertValue*. + */ + UncertValue* getProb(); + + + /** + * Predicate returning @c true if this BernoulliDistribution's "prob" element + * is set. + * + * @return @c true if this BernoulliDistribution's "prob" element has been + * set, otherwise @c false is returned. + */ + bool isSetProb() const; + + + /** + * Sets the value of the "prob" element of this BernoulliDistribution. + * + * @param prob UncertValue* value of the "prob" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setProb(const UncertValue* prob); + + + /** + * Creates a new UncertValue object, adds it to this BernoulliDistribution + * object and returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createProb(); + + + /** + * Unsets the value of the "prob" element of this BernoulliDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetProb(); + + + /** + * Returns the XML element name of this BernoulliDistribution object. + * + * For BernoulliDistribution, the XML element name is always + * @c "bernoulliDistribution". + * + * @return the name of this element, i.e. @c "bernoulliDistribution". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this BernoulliDistribution object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_BERNOULLIDISTRIBUTION, SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * BernoulliDistribution object have been set. + * + * @return @c true to indicate that all the required attributes of this + * BernoulliDistribution have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * BernoulliDistribution object have been set. + * + * @return @c true to indicate that all the required elements of this + * BernoulliDistribution have been set, otherwise @c false is returned. + * + * + * @note The required elements for the BernoulliDistribution object are: + * @li "prob" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this BernoulliDistribution's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this BernoulliDistribution's attribute "attributeName" + * has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * BernoulliDistribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this + * BernoulliDistribution. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this BernoulliDistribution. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * BernoulliDistribution. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this BernoulliDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this BernoulliDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new BernoulliDistribution_t using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * BernoulliDistribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * BernoulliDistribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this BernoulliDistribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +BernoulliDistribution_t * +BernoulliDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this BernoulliDistribution_t object. + * + * @param bd the BernoulliDistribution_t structure. + * + * @return a (deep) copy of this BernoulliDistribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +BernoulliDistribution_t* +BernoulliDistribution_clone(const BernoulliDistribution_t* bd); + + +/** + * Frees this BernoulliDistribution_t object. + * + * @param bd the BernoulliDistribution_t structure. + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +void +BernoulliDistribution_free(BernoulliDistribution_t* bd); + + +/** + * Returns the value of the "prob" element of this BernoulliDistribution_t. + * + * @param bd the BernoulliDistribution_t structure whose prob is sought. + * + * @return the value of the "prob" element of this BernoulliDistribution_t as a + * UncertValue*. + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +const UncertValue_t* +BernoulliDistribution_getProb(const BernoulliDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if this BernoulliDistribution_t's "prob" + * element is set. + * + * @param bd the BernoulliDistribution_t structure. + * + * @return @c 1 (true) if this BernoulliDistribution_t's "prob" element has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +int +BernoulliDistribution_isSetProb(const BernoulliDistribution_t * bd); + + +/** + * Sets the value of the "prob" element of this BernoulliDistribution_t. + * + * @param bd the BernoulliDistribution_t structure. + * + * @param prob UncertValue_t* value of the "prob" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +int +BernoulliDistribution_setProb(BernoulliDistribution_t * bd, + const UncertValue_t* prob); + + +/** + * Creates a new UncertValue_t object, adds it to this BernoulliDistribution_t + * object and returns the UncertValue_t object created. + * + * @param bd the BernoulliDistribution_t structure to which the UncertValue_t + * should be added. + * + * @return a new UncertValue_t object instance. + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +UncertValue_t* +BernoulliDistribution_createProb(BernoulliDistribution_t* bd); + + +/** + * Unsets the value of the "prob" element of this BernoulliDistribution_t. + * + * @param bd the BernoulliDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +int +BernoulliDistribution_unsetProb(BernoulliDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * BernoulliDistribution_t object have been set. + * + * @param bd the BernoulliDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * BernoulliDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +int +BernoulliDistribution_hasRequiredAttributes(const BernoulliDistribution_t * + bd); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * BernoulliDistribution_t object have been set. + * + * @param bd the BernoulliDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * BernoulliDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the BernoulliDistribution_t object are: + * @li "prob" + * + * @memberof BernoulliDistribution_t + */ +LIBSBML_EXTERN +int +BernoulliDistribution_hasRequiredElements(const BernoulliDistribution_t * bd); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !BernoulliDistribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/BetaDistribution.cpp b/generator/tests/test_cpp_code/test-code/BetaDistribution.cpp index 2bdef273..1fdd3fdc 100644 --- a/generator/tests/test_cpp_code/test-code/BetaDistribution.cpp +++ b/generator/tests/test_cpp_code/test-code/BetaDistribution.cpp @@ -1,1403 +1,1403 @@ -/** - * @file BetaDistribution.cpp - * @brief Implementation of the BetaDistribution class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new BetaDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -BetaDistribution::BetaDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : ContinuousUnivariateDistribution(level, version, pkgVersion) - , mAlpha (NULL) - , mBeta (NULL) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new BetaDistribution using the given DistribPkgNamespaces object. - */ -BetaDistribution::BetaDistribution(DistribPkgNamespaces *distribns) - : ContinuousUnivariateDistribution(distribns) - , mAlpha (NULL) - , mBeta (NULL) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for BetaDistribution. - */ -BetaDistribution::BetaDistribution(const BetaDistribution& orig) - : ContinuousUnivariateDistribution( orig ) - , mAlpha ( NULL ) - , mBeta ( NULL ) -{ - if (orig.mAlpha != NULL) - { - mAlpha = orig.mAlpha->clone(); - } - - if (orig.mBeta != NULL) - { - mBeta = orig.mBeta->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for BetaDistribution. - */ -BetaDistribution& -BetaDistribution::operator=(const BetaDistribution& rhs) -{ - if (&rhs != this) - { - ContinuousUnivariateDistribution::operator=(rhs); - delete mAlpha; - if (rhs.mAlpha != NULL) - { - mAlpha = rhs.mAlpha->clone(); - } - else - { - mAlpha = NULL; - } - - delete mBeta; - if (rhs.mBeta != NULL) - { - mBeta = rhs.mBeta->clone(); - } - else - { - mBeta = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this BetaDistribution object. - */ -BetaDistribution* -BetaDistribution::clone() const -{ - return new BetaDistribution(*this); -} - - -/* - * Destructor for BetaDistribution. - */ -BetaDistribution::~BetaDistribution() -{ - delete mAlpha; - mAlpha = NULL; - delete mBeta; - mBeta = NULL; -} - - -/* - * Returns the value of the "alpha" element of this BetaDistribution. - */ -const UncertValue* -BetaDistribution::getAlpha() const -{ - return mAlpha; -} - - -/* - * Returns the value of the "alpha" element of this BetaDistribution. - */ -UncertValue* -BetaDistribution::getAlpha() -{ - return mAlpha; -} - - -/* - * Returns the value of the "beta" element of this BetaDistribution. - */ -const UncertValue* -BetaDistribution::getBeta() const -{ - return mBeta; -} - - -/* - * Returns the value of the "beta" element of this BetaDistribution. - */ -UncertValue* -BetaDistribution::getBeta() -{ - return mBeta; -} - - -/* - * Predicate returning @c true if this BetaDistribution's "alpha" element is - * set. - */ -bool -BetaDistribution::isSetAlpha() const -{ - return (mAlpha != NULL); -} - - -/* - * Predicate returning @c true if this BetaDistribution's "beta" element is - * set. - */ -bool -BetaDistribution::isSetBeta() const -{ - return (mBeta != NULL); -} - - -/* - * Sets the value of the "alpha" element of this BetaDistribution. - */ -int -BetaDistribution::setAlpha(const UncertValue* alpha) -{ - if (mAlpha == alpha) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (alpha == NULL) - { - delete mAlpha; - mAlpha = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mAlpha; - mAlpha = (alpha != NULL) ? alpha->clone() : NULL; - if (mAlpha != NULL) - { - mAlpha->setElementName("alpha"); - mAlpha->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "beta" element of this BetaDistribution. - */ -int -BetaDistribution::setBeta(const UncertValue* beta) -{ - if (mBeta == beta) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (beta == NULL) - { - delete mBeta; - mBeta = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mBeta; - mBeta = (beta != NULL) ? beta->clone() : NULL; - if (mBeta != NULL) - { - mBeta->setElementName("beta"); - mBeta->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new UncertValue object, adds it to this BetaDistribution object - * and returns the UncertValue object created. - */ -UncertValue* -BetaDistribution::createAlpha() -{ - if (mAlpha != NULL) - { - delete mAlpha; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mAlpha = new UncertValue(distribns); - - mAlpha->setElementName("alpha"); - - delete distribns; - - connectToChild(); - - return mAlpha; -} - - -/* - * Creates a new UncertValue object, adds it to this BetaDistribution object - * and returns the UncertValue object created. - */ -UncertValue* -BetaDistribution::createBeta() -{ - if (mBeta != NULL) - { - delete mBeta; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mBeta = new UncertValue(distribns); - - mBeta->setElementName("beta"); - - delete distribns; - - connectToChild(); - - return mBeta; -} - - -/* - * Unsets the value of the "alpha" element of this BetaDistribution. - */ -int -BetaDistribution::unsetAlpha() -{ - delete mAlpha; - mAlpha = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "beta" element of this BetaDistribution. - */ -int -BetaDistribution::unsetBeta() -{ - delete mBeta; - mBeta = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this BetaDistribution object. - */ -const std::string& -BetaDistribution::getElementName() const -{ - static const string name = "betaDistribution"; - return name; -} - - -/* - * Returns the libSBML type code for this BetaDistribution object. - */ -int -BetaDistribution::getTypeCode() const -{ - return SBML_DISTRIB_BETADISTRIBUTION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * BetaDistribution object have been set. - */ -bool -BetaDistribution::hasRequiredAttributes() const -{ - bool allPresent = ContinuousUnivariateDistribution::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * BetaDistribution object have been set. - */ -bool -BetaDistribution::hasRequiredElements() const -{ - bool allPresent = ContinuousUnivariateDistribution::hasRequiredElements(); - - if (isSetAlpha() == false) - { - allPresent = false; - } - - if (isSetBeta() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -BetaDistribution::writeElements(XMLOutputStream& stream) const -{ - ContinuousUnivariateDistribution::writeElements(stream); - - if (isSetAlpha() == true) - { - mAlpha->write(stream); - } - - if (isSetBeta() == true) - { - mBeta->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -BetaDistribution::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mAlpha != NULL) - { - mAlpha->accept(v); - } - - if (mBeta != NULL) - { - mBeta->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -BetaDistribution::setSBMLDocument(SBMLDocument* d) -{ - ContinuousUnivariateDistribution::setSBMLDocument(d); - - if (mAlpha != NULL) - { - mAlpha->setSBMLDocument(d); - } - - if (mBeta != NULL) - { - mBeta->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -BetaDistribution::connectToChild() -{ - ContinuousUnivariateDistribution::connectToChild(); - - if (mAlpha != NULL) - { - mAlpha->connectToParent(this); - } - - if (mBeta != NULL) - { - mBeta->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -BetaDistribution::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - ContinuousUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, - flag); - - if (isSetAlpha()) - { - mAlpha->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - if (isSetBeta()) - { - mBeta->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -BetaDistribution::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - ContinuousUnivariateDistribution::updateSBMLNamespace(package, level, - version); - - if (mAlpha != NULL) - { - mAlpha->updateSBMLNamespace(package, level, version); - } - - if (mBeta != NULL) - { - mBeta->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this BetaDistribution's attribute - * "attributeName" is set. - */ -bool -BetaDistribution::isSetAttribute(const std::string& attributeName) const -{ - bool value = ContinuousUnivariateDistribution::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::setAttribute(const std::string& attributeName, int value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::setAttribute(const std::string& attributeName, double value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this BetaDistribution. - */ -int -BetaDistribution::unsetAttribute(const std::string& attributeName) -{ - int value = ContinuousUnivariateDistribution::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this BetaDistribution. - */ -SBase* -BetaDistribution::createChildObject(const std::string& elementName) -{ - ContinuousUnivariateDistribution* obj = NULL; - - if (elementName == "alpha") - { - return createAlpha(); - } - else if (elementName == "beta") - { - return createBeta(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this BetaDistribution. - */ -int -BetaDistribution::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "alpha" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setAlpha((const UncertValue*)(element)); - } - else if (elementName == "beta" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setBeta((const UncertValue*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * BetaDistribution. - */ -SBase* -BetaDistribution::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "alpha") - { - UncertValue * obj = mAlpha; - mAlpha = NULL; return obj; - } - else if (elementName == "beta") - { - UncertValue * obj = mBeta; - mBeta = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this BetaDistribution. - */ -unsigned int -BetaDistribution::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "alpha") - { - if (isSetAlpha()) - { - return 1; - } - } - else if (elementName == "beta") - { - if (isSetBeta()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this BetaDistribution. - */ -SBase* -BetaDistribution::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "alpha") - { - return getAlpha(); - } - else if (elementName == "beta") - { - return getBeta(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -BetaDistribution::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mAlpha != NULL) - { - if (mAlpha->getId() == id) - { - return mAlpha; - } - - obj = mAlpha->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mBeta != NULL) - { - if (mBeta->getId() == id) - { - return mBeta; - } - - obj = mBeta->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -BetaDistribution::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mAlpha != NULL) - { - if (mAlpha->getMetaId() == metaid) - { - return mAlpha; - } - - obj = mAlpha->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mBeta != NULL) - { - if (mBeta->getMetaId() == metaid) - { - return mBeta; - } - - obj = mBeta->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -BetaDistribution::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mAlpha, filter); - ADD_FILTERED_POINTER(ret, sublist, mBeta, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -BetaDistribution::createObject(XMLInputStream& stream) -{ - SBase* obj = ContinuousUnivariateDistribution::createObject(stream); - - const std::string& name = stream.peek().getName(); - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - - if (name == "alpha") - { - if (getErrorLog() && isSetAlpha()) - { - getErrorLog()->logPackageError("distrib", - DistribBetaDistributionAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mAlpha; - mAlpha = new UncertValue(distribns); - mAlpha->setElementName(name); - obj = mAlpha; - } - else if (name == "beta") - { - if (getErrorLog() && isSetBeta()) - { - getErrorLog()->logPackageError("distrib", - DistribBetaDistributionAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mBeta; - mBeta = new UncertValue(distribns); - mBeta->setElementName(name); - obj = mBeta; - } - - delete distribns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -BetaDistribution::addExpectedAttributes(ExpectedAttributes& attributes) -{ - ContinuousUnivariateDistribution::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -BetaDistribution::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - ContinuousUnivariateDistribution::readAttributes(attributes, - expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribBetaDistributionAllowedAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribBetaDistributionAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -BetaDistribution::writeAttributes(XMLOutputStream& stream) const -{ - ContinuousUnivariateDistribution::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new BetaDistribution_t using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -BetaDistribution_t * -BetaDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new BetaDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this BetaDistribution_t object. - */ -LIBSBML_EXTERN -BetaDistribution_t* -BetaDistribution_clone(const BetaDistribution_t* bd) -{ - if (bd != NULL) - { - return static_cast(bd->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this BetaDistribution_t object. - */ -LIBSBML_EXTERN -void -BetaDistribution_free(BetaDistribution_t* bd) -{ - if (bd != NULL) - { - delete bd; - } -} - - -/* - * Returns the value of the "alpha" element of this BetaDistribution_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -BetaDistribution_getAlpha(const BetaDistribution_t * bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->getAlpha()); -} - - -/* - * Returns the value of the "beta" element of this BetaDistribution_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -BetaDistribution_getBeta(const BetaDistribution_t * bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->getBeta()); -} - - -/* - * Predicate returning @c 1 (true) if this BetaDistribution_t's "alpha" element - * is set. - */ -LIBSBML_EXTERN -int -BetaDistribution_isSetAlpha(const BetaDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->isSetAlpha()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this BetaDistribution_t's "beta" element - * is set. - */ -LIBSBML_EXTERN -int -BetaDistribution_isSetBeta(const BetaDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->isSetBeta()) : 0; -} - - -/* - * Sets the value of the "alpha" element of this BetaDistribution_t. - */ -LIBSBML_EXTERN -int -BetaDistribution_setAlpha(BetaDistribution_t * bd, const UncertValue_t* alpha) -{ - return (bd != NULL) ? bd->setAlpha(alpha) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "beta" element of this BetaDistribution_t. - */ -LIBSBML_EXTERN -int -BetaDistribution_setBeta(BetaDistribution_t * bd, const UncertValue_t* beta) -{ - return (bd != NULL) ? bd->setBeta(beta) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new UncertValue_t object, adds it to this BetaDistribution_t - * object and returns the UncertValue_t object created. - */ -LIBSBML_EXTERN -UncertValue_t* -BetaDistribution_createAlpha(BetaDistribution_t* bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->createAlpha()); -} - - -/* - * Creates a new UncertValue_t object, adds it to this BetaDistribution_t - * object and returns the UncertValue_t object created. - */ -LIBSBML_EXTERN -UncertValue_t* -BetaDistribution_createBeta(BetaDistribution_t* bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->createBeta()); -} - - -/* - * Unsets the value of the "alpha" element of this BetaDistribution_t. - */ -LIBSBML_EXTERN -int -BetaDistribution_unsetAlpha(BetaDistribution_t * bd) -{ - return (bd != NULL) ? bd->unsetAlpha() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "beta" element of this BetaDistribution_t. - */ -LIBSBML_EXTERN -int -BetaDistribution_unsetBeta(BetaDistribution_t * bd) -{ - return (bd != NULL) ? bd->unsetBeta() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * BetaDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -BetaDistribution_hasRequiredAttributes(const BetaDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * BetaDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -BetaDistribution_hasRequiredElements(const BetaDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file BetaDistribution.cpp + * @brief Implementation of the BetaDistribution class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new BetaDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +BetaDistribution::BetaDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : ContinuousUnivariateDistribution(level, version, pkgVersion) + , mAlpha (NULL) + , mBeta (NULL) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new BetaDistribution using the given DistribPkgNamespaces object. + */ +BetaDistribution::BetaDistribution(DistribPkgNamespaces *distribns) + : ContinuousUnivariateDistribution(distribns) + , mAlpha (NULL) + , mBeta (NULL) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for BetaDistribution. + */ +BetaDistribution::BetaDistribution(const BetaDistribution& orig) + : ContinuousUnivariateDistribution( orig ) + , mAlpha ( NULL ) + , mBeta ( NULL ) +{ + if (orig.mAlpha != NULL) + { + mAlpha = orig.mAlpha->clone(); + } + + if (orig.mBeta != NULL) + { + mBeta = orig.mBeta->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for BetaDistribution. + */ +BetaDistribution& +BetaDistribution::operator=(const BetaDistribution& rhs) +{ + if (&rhs != this) + { + ContinuousUnivariateDistribution::operator=(rhs); + delete mAlpha; + if (rhs.mAlpha != NULL) + { + mAlpha = rhs.mAlpha->clone(); + } + else + { + mAlpha = NULL; + } + + delete mBeta; + if (rhs.mBeta != NULL) + { + mBeta = rhs.mBeta->clone(); + } + else + { + mBeta = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this BetaDistribution object. + */ +BetaDistribution* +BetaDistribution::clone() const +{ + return new BetaDistribution(*this); +} + + +/* + * Destructor for BetaDistribution. + */ +BetaDistribution::~BetaDistribution() +{ + delete mAlpha; + mAlpha = NULL; + delete mBeta; + mBeta = NULL; +} + + +/* + * Returns the value of the "alpha" element of this BetaDistribution. + */ +const UncertValue* +BetaDistribution::getAlpha() const +{ + return mAlpha; +} + + +/* + * Returns the value of the "alpha" element of this BetaDistribution. + */ +UncertValue* +BetaDistribution::getAlpha() +{ + return mAlpha; +} + + +/* + * Returns the value of the "beta" element of this BetaDistribution. + */ +const UncertValue* +BetaDistribution::getBeta() const +{ + return mBeta; +} + + +/* + * Returns the value of the "beta" element of this BetaDistribution. + */ +UncertValue* +BetaDistribution::getBeta() +{ + return mBeta; +} + + +/* + * Predicate returning @c true if this BetaDistribution's "alpha" element is + * set. + */ +bool +BetaDistribution::isSetAlpha() const +{ + return (mAlpha != NULL); +} + + +/* + * Predicate returning @c true if this BetaDistribution's "beta" element is + * set. + */ +bool +BetaDistribution::isSetBeta() const +{ + return (mBeta != NULL); +} + + +/* + * Sets the value of the "alpha" element of this BetaDistribution. + */ +int +BetaDistribution::setAlpha(const UncertValue* alpha) +{ + if (mAlpha == alpha) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (alpha == NULL) + { + delete mAlpha; + mAlpha = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mAlpha; + mAlpha = (alpha != NULL) ? alpha->clone() : NULL; + if (mAlpha != NULL) + { + mAlpha->setElementName("alpha"); + mAlpha->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "beta" element of this BetaDistribution. + */ +int +BetaDistribution::setBeta(const UncertValue* beta) +{ + if (mBeta == beta) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (beta == NULL) + { + delete mBeta; + mBeta = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mBeta; + mBeta = (beta != NULL) ? beta->clone() : NULL; + if (mBeta != NULL) + { + mBeta->setElementName("beta"); + mBeta->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new UncertValue object, adds it to this BetaDistribution object + * and returns the UncertValue object created. + */ +UncertValue* +BetaDistribution::createAlpha() +{ + if (mAlpha != NULL) + { + delete mAlpha; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mAlpha = new UncertValue(distribns); + + mAlpha->setElementName("alpha"); + + delete distribns; + + connectToChild(); + + return mAlpha; +} + + +/* + * Creates a new UncertValue object, adds it to this BetaDistribution object + * and returns the UncertValue object created. + */ +UncertValue* +BetaDistribution::createBeta() +{ + if (mBeta != NULL) + { + delete mBeta; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mBeta = new UncertValue(distribns); + + mBeta->setElementName("beta"); + + delete distribns; + + connectToChild(); + + return mBeta; +} + + +/* + * Unsets the value of the "alpha" element of this BetaDistribution. + */ +int +BetaDistribution::unsetAlpha() +{ + delete mAlpha; + mAlpha = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "beta" element of this BetaDistribution. + */ +int +BetaDistribution::unsetBeta() +{ + delete mBeta; + mBeta = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this BetaDistribution object. + */ +const std::string& +BetaDistribution::getElementName() const +{ + static const string name = "betaDistribution"; + return name; +} + + +/* + * Returns the libSBML type code for this BetaDistribution object. + */ +int +BetaDistribution::getTypeCode() const +{ + return SBML_DISTRIB_BETADISTRIBUTION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * BetaDistribution object have been set. + */ +bool +BetaDistribution::hasRequiredAttributes() const +{ + bool allPresent = ContinuousUnivariateDistribution::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * BetaDistribution object have been set. + */ +bool +BetaDistribution::hasRequiredElements() const +{ + bool allPresent = ContinuousUnivariateDistribution::hasRequiredElements(); + + if (isSetAlpha() == false) + { + allPresent = false; + } + + if (isSetBeta() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +BetaDistribution::writeElements(XMLOutputStream& stream) const +{ + ContinuousUnivariateDistribution::writeElements(stream); + + if (isSetAlpha() == true) + { + mAlpha->write(stream); + } + + if (isSetBeta() == true) + { + mBeta->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +BetaDistribution::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mAlpha != NULL) + { + mAlpha->accept(v); + } + + if (mBeta != NULL) + { + mBeta->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +BetaDistribution::setSBMLDocument(SBMLDocument* d) +{ + ContinuousUnivariateDistribution::setSBMLDocument(d); + + if (mAlpha != NULL) + { + mAlpha->setSBMLDocument(d); + } + + if (mBeta != NULL) + { + mBeta->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +BetaDistribution::connectToChild() +{ + ContinuousUnivariateDistribution::connectToChild(); + + if (mAlpha != NULL) + { + mAlpha->connectToParent(this); + } + + if (mBeta != NULL) + { + mBeta->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +BetaDistribution::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + ContinuousUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, + flag); + + if (isSetAlpha()) + { + mAlpha->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + if (isSetBeta()) + { + mBeta->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +BetaDistribution::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + ContinuousUnivariateDistribution::updateSBMLNamespace(package, level, + version); + + if (mAlpha != NULL) + { + mAlpha->updateSBMLNamespace(package, level, version); + } + + if (mBeta != NULL) + { + mBeta->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this BetaDistribution's attribute + * "attributeName" is set. + */ +bool +BetaDistribution::isSetAttribute(const std::string& attributeName) const +{ + bool value = ContinuousUnivariateDistribution::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::setAttribute(const std::string& attributeName, int value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::setAttribute(const std::string& attributeName, double value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this BetaDistribution. + */ +int +BetaDistribution::unsetAttribute(const std::string& attributeName) +{ + int value = ContinuousUnivariateDistribution::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this BetaDistribution. + */ +SBase* +BetaDistribution::createChildObject(const std::string& elementName) +{ + ContinuousUnivariateDistribution* obj = NULL; + + if (elementName == "alpha") + { + return createAlpha(); + } + else if (elementName == "beta") + { + return createBeta(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this BetaDistribution. + */ +int +BetaDistribution::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "alpha" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setAlpha((const UncertValue*)(element)); + } + else if (elementName == "beta" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setBeta((const UncertValue*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * BetaDistribution. + */ +SBase* +BetaDistribution::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "alpha") + { + UncertValue * obj = mAlpha; + mAlpha = NULL; return obj; + } + else if (elementName == "beta") + { + UncertValue * obj = mBeta; + mBeta = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this BetaDistribution. + */ +unsigned int +BetaDistribution::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "alpha") + { + if (isSetAlpha()) + { + return 1; + } + } + else if (elementName == "beta") + { + if (isSetBeta()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this BetaDistribution. + */ +SBase* +BetaDistribution::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "alpha") + { + return getAlpha(); + } + else if (elementName == "beta") + { + return getBeta(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +BetaDistribution::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mAlpha != NULL) + { + if (mAlpha->getId() == id) + { + return mAlpha; + } + + obj = mAlpha->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mBeta != NULL) + { + if (mBeta->getId() == id) + { + return mBeta; + } + + obj = mBeta->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +BetaDistribution::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mAlpha != NULL) + { + if (mAlpha->getMetaId() == metaid) + { + return mAlpha; + } + + obj = mAlpha->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mBeta != NULL) + { + if (mBeta->getMetaId() == metaid) + { + return mBeta; + } + + obj = mBeta->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +BetaDistribution::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mAlpha, filter); + ADD_FILTERED_POINTER(ret, sublist, mBeta, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +BetaDistribution::createObject(XMLInputStream& stream) +{ + SBase* obj = ContinuousUnivariateDistribution::createObject(stream); + + const std::string& name = stream.peek().getName(); + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + + if (name == "alpha") + { + if (getErrorLog() && isSetAlpha()) + { + getErrorLog()->logPackageError("distrib", + DistribBetaDistributionAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mAlpha; + mAlpha = new UncertValue(distribns); + mAlpha->setElementName(name); + obj = mAlpha; + } + else if (name == "beta") + { + if (getErrorLog() && isSetBeta()) + { + getErrorLog()->logPackageError("distrib", + DistribBetaDistributionAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mBeta; + mBeta = new UncertValue(distribns); + mBeta->setElementName(name); + obj = mBeta; + } + + delete distribns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +BetaDistribution::addExpectedAttributes(ExpectedAttributes& attributes) +{ + ContinuousUnivariateDistribution::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +BetaDistribution::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + ContinuousUnivariateDistribution::readAttributes(attributes, + expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribBetaDistributionAllowedAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribBetaDistributionAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +BetaDistribution::writeAttributes(XMLOutputStream& stream) const +{ + ContinuousUnivariateDistribution::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new BetaDistribution_t using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +BetaDistribution_t * +BetaDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new BetaDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this BetaDistribution_t object. + */ +LIBSBML_EXTERN +BetaDistribution_t* +BetaDistribution_clone(const BetaDistribution_t* bd) +{ + if (bd != NULL) + { + return static_cast(bd->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this BetaDistribution_t object. + */ +LIBSBML_EXTERN +void +BetaDistribution_free(BetaDistribution_t* bd) +{ + if (bd != NULL) + { + delete bd; + } +} + + +/* + * Returns the value of the "alpha" element of this BetaDistribution_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +BetaDistribution_getAlpha(const BetaDistribution_t * bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->getAlpha()); +} + + +/* + * Returns the value of the "beta" element of this BetaDistribution_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +BetaDistribution_getBeta(const BetaDistribution_t * bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->getBeta()); +} + + +/* + * Predicate returning @c 1 (true) if this BetaDistribution_t's "alpha" element + * is set. + */ +LIBSBML_EXTERN +int +BetaDistribution_isSetAlpha(const BetaDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->isSetAlpha()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this BetaDistribution_t's "beta" element + * is set. + */ +LIBSBML_EXTERN +int +BetaDistribution_isSetBeta(const BetaDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->isSetBeta()) : 0; +} + + +/* + * Sets the value of the "alpha" element of this BetaDistribution_t. + */ +LIBSBML_EXTERN +int +BetaDistribution_setAlpha(BetaDistribution_t * bd, const UncertValue_t* alpha) +{ + return (bd != NULL) ? bd->setAlpha(alpha) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "beta" element of this BetaDistribution_t. + */ +LIBSBML_EXTERN +int +BetaDistribution_setBeta(BetaDistribution_t * bd, const UncertValue_t* beta) +{ + return (bd != NULL) ? bd->setBeta(beta) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new UncertValue_t object, adds it to this BetaDistribution_t + * object and returns the UncertValue_t object created. + */ +LIBSBML_EXTERN +UncertValue_t* +BetaDistribution_createAlpha(BetaDistribution_t* bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->createAlpha()); +} + + +/* + * Creates a new UncertValue_t object, adds it to this BetaDistribution_t + * object and returns the UncertValue_t object created. + */ +LIBSBML_EXTERN +UncertValue_t* +BetaDistribution_createBeta(BetaDistribution_t* bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->createBeta()); +} + + +/* + * Unsets the value of the "alpha" element of this BetaDistribution_t. + */ +LIBSBML_EXTERN +int +BetaDistribution_unsetAlpha(BetaDistribution_t * bd) +{ + return (bd != NULL) ? bd->unsetAlpha() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "beta" element of this BetaDistribution_t. + */ +LIBSBML_EXTERN +int +BetaDistribution_unsetBeta(BetaDistribution_t * bd) +{ + return (bd != NULL) ? bd->unsetBeta() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * BetaDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +BetaDistribution_hasRequiredAttributes(const BetaDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * BetaDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +BetaDistribution_hasRequiredElements(const BetaDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/BetaDistribution.h b/generator/tests/test_cpp_code/test-code/BetaDistribution.h index 2b9d030b..c562a3c8 100644 --- a/generator/tests/test_cpp_code/test-code/BetaDistribution.h +++ b/generator/tests/test_cpp_code/test-code/BetaDistribution.h @@ -1,1103 +1,1103 @@ -/** - * @file BetaDistribution.h - * @brief Definition of the BetaDistribution class. - * @author SBMLTeam - * - * - * - * @class BetaDistribution - * @sbmlbrief{distrib} TODO:Definition of the BetaDistribution class. - */ - - -#ifndef BetaDistribution_H__ -#define BetaDistribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN BetaDistribution : public ContinuousUnivariateDistribution -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - UncertValue* mAlpha; - UncertValue* mBeta; - - /** @endcond */ - -public: - - /** - * Creates a new BetaDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * BetaDistribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * BetaDistribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this BetaDistribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - BetaDistribution(unsigned int level = DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new BetaDistribution using the given DistribPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - BetaDistribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for BetaDistribution. - * - * @param orig the BetaDistribution instance to copy. - */ - BetaDistribution(const BetaDistribution& orig); - - - /** - * Assignment operator for BetaDistribution. - * - * @param rhs the BetaDistribution object whose values are to be used as the - * basis of the assignment. - */ - BetaDistribution& operator=(const BetaDistribution& rhs); - - - /** - * Creates and returns a deep copy of this BetaDistribution object. - * - * @return a (deep) copy of this BetaDistribution object. - */ - virtual BetaDistribution* clone() const; - - - /** - * Destructor for BetaDistribution. - */ - virtual ~BetaDistribution(); - - - /** - * Returns the value of the "alpha" element of this BetaDistribution. - * - * @return the value of the "alpha" element of this BetaDistribution as a - * UncertValue*. - */ - const UncertValue* getAlpha() const; - - - /** - * Returns the value of the "alpha" element of this BetaDistribution. - * - * @return the value of the "alpha" element of this BetaDistribution as a - * UncertValue*. - */ - UncertValue* getAlpha(); - - - /** - * Returns the value of the "beta" element of this BetaDistribution. - * - * @return the value of the "beta" element of this BetaDistribution as a - * UncertValue*. - */ - const UncertValue* getBeta() const; - - - /** - * Returns the value of the "beta" element of this BetaDistribution. - * - * @return the value of the "beta" element of this BetaDistribution as a - * UncertValue*. - */ - UncertValue* getBeta(); - - - /** - * Predicate returning @c true if this BetaDistribution's "alpha" element is - * set. - * - * @return @c true if this BetaDistribution's "alpha" element has been set, - * otherwise @c false is returned. - */ - bool isSetAlpha() const; - - - /** - * Predicate returning @c true if this BetaDistribution's "beta" element is - * set. - * - * @return @c true if this BetaDistribution's "beta" element has been set, - * otherwise @c false is returned. - */ - bool isSetBeta() const; - - - /** - * Sets the value of the "alpha" element of this BetaDistribution. - * - * @param alpha UncertValue* value of the "alpha" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAlpha(const UncertValue* alpha); - - - /** - * Sets the value of the "beta" element of this BetaDistribution. - * - * @param beta UncertValue* value of the "beta" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setBeta(const UncertValue* beta); - - - /** - * Creates a new UncertValue object, adds it to this BetaDistribution object - * and returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createAlpha(); - - - /** - * Creates a new UncertValue object, adds it to this BetaDistribution object - * and returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createBeta(); - - - /** - * Unsets the value of the "alpha" element of this BetaDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAlpha(); - - - /** - * Unsets the value of the "beta" element of this BetaDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetBeta(); - - - /** - * Returns the XML element name of this BetaDistribution object. - * - * For BetaDistribution, the XML element name is always - * @c "betaDistribution". - * - * @return the name of this element, i.e. @c "betaDistribution". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this BetaDistribution object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_BETADISTRIBUTION, SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * BetaDistribution object have been set. - * - * @return @c true to indicate that all the required attributes of this - * BetaDistribution have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * BetaDistribution object have been set. - * - * @return @c true to indicate that all the required elements of this - * BetaDistribution have been set, otherwise @c false is returned. - * - * - * @note The required elements for the BetaDistribution object are: - * @li "alpha" - * @li "beta" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this BetaDistribution's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this BetaDistribution's attribute "attributeName" has - * been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this BetaDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * BetaDistribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this BetaDistribution. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this BetaDistribution. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * BetaDistribution. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this BetaDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this BetaDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new BetaDistribution_t using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * BetaDistribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * BetaDistribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this BetaDistribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -BetaDistribution_t * -BetaDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this BetaDistribution_t object. - * - * @param bd the BetaDistribution_t structure. - * - * @return a (deep) copy of this BetaDistribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -BetaDistribution_t* -BetaDistribution_clone(const BetaDistribution_t* bd); - - -/** - * Frees this BetaDistribution_t object. - * - * @param bd the BetaDistribution_t structure. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -void -BetaDistribution_free(BetaDistribution_t* bd); - - -/** - * Returns the value of the "alpha" element of this BetaDistribution_t. - * - * @param bd the BetaDistribution_t structure whose alpha is sought. - * - * @return the value of the "alpha" element of this BetaDistribution_t as a - * UncertValue*. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -const UncertValue_t* -BetaDistribution_getAlpha(const BetaDistribution_t * bd); - - -/** - * Returns the value of the "beta" element of this BetaDistribution_t. - * - * @param bd the BetaDistribution_t structure whose beta is sought. - * - * @return the value of the "beta" element of this BetaDistribution_t as a - * UncertValue*. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -const UncertValue_t* -BetaDistribution_getBeta(const BetaDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if this BetaDistribution_t's "alpha" element - * is set. - * - * @param bd the BetaDistribution_t structure. - * - * @return @c 1 (true) if this BetaDistribution_t's "alpha" element has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_isSetAlpha(const BetaDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if this BetaDistribution_t's "beta" element - * is set. - * - * @param bd the BetaDistribution_t structure. - * - * @return @c 1 (true) if this BetaDistribution_t's "beta" element has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_isSetBeta(const BetaDistribution_t * bd); - - -/** - * Sets the value of the "alpha" element of this BetaDistribution_t. - * - * @param bd the BetaDistribution_t structure. - * - * @param alpha UncertValue_t* value of the "alpha" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_setAlpha(BetaDistribution_t * bd, - const UncertValue_t* alpha); - - -/** - * Sets the value of the "beta" element of this BetaDistribution_t. - * - * @param bd the BetaDistribution_t structure. - * - * @param beta UncertValue_t* value of the "beta" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_setBeta(BetaDistribution_t * bd, const UncertValue_t* beta); - - -/** - * Creates a new UncertValue_t object, adds it to this BetaDistribution_t - * object and returns the UncertValue_t object created. - * - * @param bd the BetaDistribution_t structure to which the UncertValue_t should - * be added. - * - * @return a new UncertValue_t object instance. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -UncertValue_t* -BetaDistribution_createAlpha(BetaDistribution_t* bd); - - -/** - * Creates a new UncertValue_t object, adds it to this BetaDistribution_t - * object and returns the UncertValue_t object created. - * - * @param bd the BetaDistribution_t structure to which the UncertValue_t should - * be added. - * - * @return a new UncertValue_t object instance. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -UncertValue_t* -BetaDistribution_createBeta(BetaDistribution_t* bd); - - -/** - * Unsets the value of the "alpha" element of this BetaDistribution_t. - * - * @param bd the BetaDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_unsetAlpha(BetaDistribution_t * bd); - - -/** - * Unsets the value of the "beta" element of this BetaDistribution_t. - * - * @param bd the BetaDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_unsetBeta(BetaDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * BetaDistribution_t object have been set. - * - * @param bd the BetaDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * BetaDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_hasRequiredAttributes(const BetaDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * BetaDistribution_t object have been set. - * - * @param bd the BetaDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * BetaDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the BetaDistribution_t object are: - * @li "alpha" - * @li "beta" - * - * @memberof BetaDistribution_t - */ -LIBSBML_EXTERN -int -BetaDistribution_hasRequiredElements(const BetaDistribution_t * bd); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !BetaDistribution_H__ */ - - +/** + * @file BetaDistribution.h + * @brief Definition of the BetaDistribution class. + * @author SBMLTeam + * + * + * + * @class BetaDistribution + * @sbmlbrief{distrib} TODO:Definition of the BetaDistribution class. + */ + + +#ifndef BetaDistribution_H__ +#define BetaDistribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN BetaDistribution : public ContinuousUnivariateDistribution +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + UncertValue* mAlpha; + UncertValue* mBeta; + + /** @endcond */ + +public: + + /** + * Creates a new BetaDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * BetaDistribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * BetaDistribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this BetaDistribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + BetaDistribution(unsigned int level = DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new BetaDistribution using the given DistribPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + BetaDistribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for BetaDistribution. + * + * @param orig the BetaDistribution instance to copy. + */ + BetaDistribution(const BetaDistribution& orig); + + + /** + * Assignment operator for BetaDistribution. + * + * @param rhs the BetaDistribution object whose values are to be used as the + * basis of the assignment. + */ + BetaDistribution& operator=(const BetaDistribution& rhs); + + + /** + * Creates and returns a deep copy of this BetaDistribution object. + * + * @return a (deep) copy of this BetaDistribution object. + */ + virtual BetaDistribution* clone() const; + + + /** + * Destructor for BetaDistribution. + */ + virtual ~BetaDistribution(); + + + /** + * Returns the value of the "alpha" element of this BetaDistribution. + * + * @return the value of the "alpha" element of this BetaDistribution as a + * UncertValue*. + */ + const UncertValue* getAlpha() const; + + + /** + * Returns the value of the "alpha" element of this BetaDistribution. + * + * @return the value of the "alpha" element of this BetaDistribution as a + * UncertValue*. + */ + UncertValue* getAlpha(); + + + /** + * Returns the value of the "beta" element of this BetaDistribution. + * + * @return the value of the "beta" element of this BetaDistribution as a + * UncertValue*. + */ + const UncertValue* getBeta() const; + + + /** + * Returns the value of the "beta" element of this BetaDistribution. + * + * @return the value of the "beta" element of this BetaDistribution as a + * UncertValue*. + */ + UncertValue* getBeta(); + + + /** + * Predicate returning @c true if this BetaDistribution's "alpha" element is + * set. + * + * @return @c true if this BetaDistribution's "alpha" element has been set, + * otherwise @c false is returned. + */ + bool isSetAlpha() const; + + + /** + * Predicate returning @c true if this BetaDistribution's "beta" element is + * set. + * + * @return @c true if this BetaDistribution's "beta" element has been set, + * otherwise @c false is returned. + */ + bool isSetBeta() const; + + + /** + * Sets the value of the "alpha" element of this BetaDistribution. + * + * @param alpha UncertValue* value of the "alpha" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAlpha(const UncertValue* alpha); + + + /** + * Sets the value of the "beta" element of this BetaDistribution. + * + * @param beta UncertValue* value of the "beta" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setBeta(const UncertValue* beta); + + + /** + * Creates a new UncertValue object, adds it to this BetaDistribution object + * and returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createAlpha(); + + + /** + * Creates a new UncertValue object, adds it to this BetaDistribution object + * and returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createBeta(); + + + /** + * Unsets the value of the "alpha" element of this BetaDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAlpha(); + + + /** + * Unsets the value of the "beta" element of this BetaDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetBeta(); + + + /** + * Returns the XML element name of this BetaDistribution object. + * + * For BetaDistribution, the XML element name is always + * @c "betaDistribution". + * + * @return the name of this element, i.e. @c "betaDistribution". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this BetaDistribution object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_BETADISTRIBUTION, SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * BetaDistribution object have been set. + * + * @return @c true to indicate that all the required attributes of this + * BetaDistribution have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * BetaDistribution object have been set. + * + * @return @c true to indicate that all the required elements of this + * BetaDistribution have been set, otherwise @c false is returned. + * + * + * @note The required elements for the BetaDistribution object are: + * @li "alpha" + * @li "beta" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this BetaDistribution's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this BetaDistribution's attribute "attributeName" has + * been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this BetaDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * BetaDistribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this BetaDistribution. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this BetaDistribution. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * BetaDistribution. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this BetaDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this BetaDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new BetaDistribution_t using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * BetaDistribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * BetaDistribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this BetaDistribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +BetaDistribution_t * +BetaDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this BetaDistribution_t object. + * + * @param bd the BetaDistribution_t structure. + * + * @return a (deep) copy of this BetaDistribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +BetaDistribution_t* +BetaDistribution_clone(const BetaDistribution_t* bd); + + +/** + * Frees this BetaDistribution_t object. + * + * @param bd the BetaDistribution_t structure. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +void +BetaDistribution_free(BetaDistribution_t* bd); + + +/** + * Returns the value of the "alpha" element of this BetaDistribution_t. + * + * @param bd the BetaDistribution_t structure whose alpha is sought. + * + * @return the value of the "alpha" element of this BetaDistribution_t as a + * UncertValue*. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +const UncertValue_t* +BetaDistribution_getAlpha(const BetaDistribution_t * bd); + + +/** + * Returns the value of the "beta" element of this BetaDistribution_t. + * + * @param bd the BetaDistribution_t structure whose beta is sought. + * + * @return the value of the "beta" element of this BetaDistribution_t as a + * UncertValue*. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +const UncertValue_t* +BetaDistribution_getBeta(const BetaDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if this BetaDistribution_t's "alpha" element + * is set. + * + * @param bd the BetaDistribution_t structure. + * + * @return @c 1 (true) if this BetaDistribution_t's "alpha" element has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_isSetAlpha(const BetaDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if this BetaDistribution_t's "beta" element + * is set. + * + * @param bd the BetaDistribution_t structure. + * + * @return @c 1 (true) if this BetaDistribution_t's "beta" element has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_isSetBeta(const BetaDistribution_t * bd); + + +/** + * Sets the value of the "alpha" element of this BetaDistribution_t. + * + * @param bd the BetaDistribution_t structure. + * + * @param alpha UncertValue_t* value of the "alpha" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_setAlpha(BetaDistribution_t * bd, + const UncertValue_t* alpha); + + +/** + * Sets the value of the "beta" element of this BetaDistribution_t. + * + * @param bd the BetaDistribution_t structure. + * + * @param beta UncertValue_t* value of the "beta" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_setBeta(BetaDistribution_t * bd, const UncertValue_t* beta); + + +/** + * Creates a new UncertValue_t object, adds it to this BetaDistribution_t + * object and returns the UncertValue_t object created. + * + * @param bd the BetaDistribution_t structure to which the UncertValue_t should + * be added. + * + * @return a new UncertValue_t object instance. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +UncertValue_t* +BetaDistribution_createAlpha(BetaDistribution_t* bd); + + +/** + * Creates a new UncertValue_t object, adds it to this BetaDistribution_t + * object and returns the UncertValue_t object created. + * + * @param bd the BetaDistribution_t structure to which the UncertValue_t should + * be added. + * + * @return a new UncertValue_t object instance. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +UncertValue_t* +BetaDistribution_createBeta(BetaDistribution_t* bd); + + +/** + * Unsets the value of the "alpha" element of this BetaDistribution_t. + * + * @param bd the BetaDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_unsetAlpha(BetaDistribution_t * bd); + + +/** + * Unsets the value of the "beta" element of this BetaDistribution_t. + * + * @param bd the BetaDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_unsetBeta(BetaDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * BetaDistribution_t object have been set. + * + * @param bd the BetaDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * BetaDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_hasRequiredAttributes(const BetaDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * BetaDistribution_t object have been set. + * + * @param bd the BetaDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * BetaDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the BetaDistribution_t object are: + * @li "alpha" + * @li "beta" + * + * @memberof BetaDistribution_t + */ +LIBSBML_EXTERN +int +BetaDistribution_hasRequiredElements(const BetaDistribution_t * bd); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !BetaDistribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/BinomialDistribution.cpp b/generator/tests/test_cpp_code/test-code/BinomialDistribution.cpp index 0fba30c1..0979a979 100644 --- a/generator/tests/test_cpp_code/test-code/BinomialDistribution.cpp +++ b/generator/tests/test_cpp_code/test-code/BinomialDistribution.cpp @@ -1,1442 +1,1442 @@ -/** - * @file BinomialDistribution.cpp - * @brief Implementation of the BinomialDistribution class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new BinomialDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -BinomialDistribution::BinomialDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : DiscreteUnivariateDistribution(level, version, pkgVersion) - , mNumberOfTrials (NULL) - , mProbabilityOfSuccess (NULL) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new BinomialDistribution using the given DistribPkgNamespaces - * object. - */ -BinomialDistribution::BinomialDistribution(DistribPkgNamespaces *distribns) - : DiscreteUnivariateDistribution(distribns) - , mNumberOfTrials (NULL) - , mProbabilityOfSuccess (NULL) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for BinomialDistribution. - */ -BinomialDistribution::BinomialDistribution(const BinomialDistribution& orig) - : DiscreteUnivariateDistribution( orig ) - , mNumberOfTrials ( NULL ) - , mProbabilityOfSuccess ( NULL ) -{ - if (orig.mNumberOfTrials != NULL) - { - mNumberOfTrials = orig.mNumberOfTrials->clone(); - } - - if (orig.mProbabilityOfSuccess != NULL) - { - mProbabilityOfSuccess = orig.mProbabilityOfSuccess->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for BinomialDistribution. - */ -BinomialDistribution& -BinomialDistribution::operator=(const BinomialDistribution& rhs) -{ - if (&rhs != this) - { - DiscreteUnivariateDistribution::operator=(rhs); - delete mNumberOfTrials; - if (rhs.mNumberOfTrials != NULL) - { - mNumberOfTrials = rhs.mNumberOfTrials->clone(); - } - else - { - mNumberOfTrials = NULL; - } - - delete mProbabilityOfSuccess; - if (rhs.mProbabilityOfSuccess != NULL) - { - mProbabilityOfSuccess = rhs.mProbabilityOfSuccess->clone(); - } - else - { - mProbabilityOfSuccess = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this BinomialDistribution object. - */ -BinomialDistribution* -BinomialDistribution::clone() const -{ - return new BinomialDistribution(*this); -} - - -/* - * Destructor for BinomialDistribution. - */ -BinomialDistribution::~BinomialDistribution() -{ - delete mNumberOfTrials; - mNumberOfTrials = NULL; - delete mProbabilityOfSuccess; - mProbabilityOfSuccess = NULL; -} - - -/* - * Returns the value of the "numberOfTrials" element of this - * BinomialDistribution. - */ -const UncertValue* -BinomialDistribution::getNumberOfTrials() const -{ - return mNumberOfTrials; -} - - -/* - * Returns the value of the "numberOfTrials" element of this - * BinomialDistribution. - */ -UncertValue* -BinomialDistribution::getNumberOfTrials() -{ - return mNumberOfTrials; -} - - -/* - * Returns the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - */ -const UncertValue* -BinomialDistribution::getProbabilityOfSuccess() const -{ - return mProbabilityOfSuccess; -} - - -/* - * Returns the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - */ -UncertValue* -BinomialDistribution::getProbabilityOfSuccess() -{ - return mProbabilityOfSuccess; -} - - -/* - * Predicate returning @c true if this BinomialDistribution's "numberOfTrials" - * element is set. - */ -bool -BinomialDistribution::isSetNumberOfTrials() const -{ - return (mNumberOfTrials != NULL); -} - - -/* - * Predicate returning @c true if this BinomialDistribution's - * "probabilityOfSuccess" element is set. - */ -bool -BinomialDistribution::isSetProbabilityOfSuccess() const -{ - return (mProbabilityOfSuccess != NULL); -} - - -/* - * Sets the value of the "numberOfTrials" element of this BinomialDistribution. - */ -int -BinomialDistribution::setNumberOfTrials(const UncertValue* numberOfTrials) -{ - if (mNumberOfTrials == numberOfTrials) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (numberOfTrials == NULL) - { - delete mNumberOfTrials; - mNumberOfTrials = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mNumberOfTrials; - mNumberOfTrials = (numberOfTrials != NULL) ? numberOfTrials->clone() : - NULL; - if (mNumberOfTrials != NULL) - { - mNumberOfTrials->setElementName("numberOfTrials"); - mNumberOfTrials->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - */ -int -BinomialDistribution::setProbabilityOfSuccess(const UncertValue* - probabilityOfSuccess) -{ - if (mProbabilityOfSuccess == probabilityOfSuccess) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (probabilityOfSuccess == NULL) - { - delete mProbabilityOfSuccess; - mProbabilityOfSuccess = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mProbabilityOfSuccess; - mProbabilityOfSuccess = (probabilityOfSuccess != NULL) ? - probabilityOfSuccess->clone() : NULL; - if (mProbabilityOfSuccess != NULL) - { - mProbabilityOfSuccess->setElementName("probabilityOfSuccess"); - mProbabilityOfSuccess->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new UncertValue object, adds it to this BinomialDistribution - * object and returns the UncertValue object created. - */ -UncertValue* -BinomialDistribution::createNumberOfTrials() -{ - if (mNumberOfTrials != NULL) - { - delete mNumberOfTrials; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mNumberOfTrials = new UncertValue(distribns); - - mNumberOfTrials->setElementName("numberOfTrials"); - - delete distribns; - - connectToChild(); - - return mNumberOfTrials; -} - - -/* - * Creates a new UncertValue object, adds it to this BinomialDistribution - * object and returns the UncertValue object created. - */ -UncertValue* -BinomialDistribution::createProbabilityOfSuccess() -{ - if (mProbabilityOfSuccess != NULL) - { - delete mProbabilityOfSuccess; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mProbabilityOfSuccess = new UncertValue(distribns); - - mProbabilityOfSuccess->setElementName("probabilityOfSuccess"); - - delete distribns; - - connectToChild(); - - return mProbabilityOfSuccess; -} - - -/* - * Unsets the value of the "numberOfTrials" element of this - * BinomialDistribution. - */ -int -BinomialDistribution::unsetNumberOfTrials() -{ - delete mNumberOfTrials; - mNumberOfTrials = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - */ -int -BinomialDistribution::unsetProbabilityOfSuccess() -{ - delete mProbabilityOfSuccess; - mProbabilityOfSuccess = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this BinomialDistribution object. - */ -const std::string& -BinomialDistribution::getElementName() const -{ - static const string name = "binomialDistribution"; - return name; -} - - -/* - * Returns the libSBML type code for this BinomialDistribution object. - */ -int -BinomialDistribution::getTypeCode() const -{ - return SBML_DISTRIB_BINOMIALDISTRIBUTION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * BinomialDistribution object have been set. - */ -bool -BinomialDistribution::hasRequiredAttributes() const -{ - bool allPresent = DiscreteUnivariateDistribution::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * BinomialDistribution object have been set. - */ -bool -BinomialDistribution::hasRequiredElements() const -{ - bool allPresent = DiscreteUnivariateDistribution::hasRequiredElements(); - - if (isSetNumberOfTrials() == false) - { - allPresent = false; - } - - if (isSetProbabilityOfSuccess() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -BinomialDistribution::writeElements(XMLOutputStream& stream) const -{ - DiscreteUnivariateDistribution::writeElements(stream); - - if (isSetNumberOfTrials() == true) - { - mNumberOfTrials->write(stream); - } - - if (isSetProbabilityOfSuccess() == true) - { - mProbabilityOfSuccess->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -BinomialDistribution::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mNumberOfTrials != NULL) - { - mNumberOfTrials->accept(v); - } - - if (mProbabilityOfSuccess != NULL) - { - mProbabilityOfSuccess->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -BinomialDistribution::setSBMLDocument(SBMLDocument* d) -{ - DiscreteUnivariateDistribution::setSBMLDocument(d); - - if (mNumberOfTrials != NULL) - { - mNumberOfTrials->setSBMLDocument(d); - } - - if (mProbabilityOfSuccess != NULL) - { - mProbabilityOfSuccess->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -BinomialDistribution::connectToChild() -{ - DiscreteUnivariateDistribution::connectToChild(); - - if (mNumberOfTrials != NULL) - { - mNumberOfTrials->connectToParent(this); - } - - if (mProbabilityOfSuccess != NULL) - { - mProbabilityOfSuccess->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -BinomialDistribution::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - DiscreteUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, - flag); - - if (isSetNumberOfTrials()) - { - mNumberOfTrials->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - if (isSetProbabilityOfSuccess()) - { - mProbabilityOfSuccess->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -BinomialDistribution::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - DiscreteUnivariateDistribution::updateSBMLNamespace(package, level, version); - - if (mNumberOfTrials != NULL) - { - mNumberOfTrials->updateSBMLNamespace(package, level, version); - } - - if (mProbabilityOfSuccess != NULL) - { - mProbabilityOfSuccess->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = - DiscreteUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = - DiscreteUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = - DiscreteUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = - DiscreteUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = - DiscreteUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this BinomialDistribution's attribute - * "attributeName" is set. - */ -bool -BinomialDistribution::isSetAttribute(const std::string& attributeName) const -{ - bool value = DiscreteUnivariateDistribution::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = - DiscreteUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::setAttribute(const std::string& attributeName, - int value) -{ - int return_value = - DiscreteUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = - DiscreteUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = - DiscreteUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = - DiscreteUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * BinomialDistribution. - */ -int -BinomialDistribution::unsetAttribute(const std::string& attributeName) -{ - int value = DiscreteUnivariateDistribution::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this - * BinomialDistribution. - */ -SBase* -BinomialDistribution::createChildObject(const std::string& elementName) -{ - DiscreteUnivariateDistribution* obj = NULL; - - if (elementName == "numberOfTrials") - { - return createNumberOfTrials(); - } - else if (elementName == "probabilityOfSuccess") - { - return createProbabilityOfSuccess(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this BinomialDistribution. - */ -int -BinomialDistribution::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "numberOfTrials" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setNumberOfTrials((const UncertValue*)(element)); - } - else if (elementName == "probabilityOfSuccess" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setProbabilityOfSuccess((const UncertValue*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * BinomialDistribution. - */ -SBase* -BinomialDistribution::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "numberOfTrials") - { - UncertValue * obj = mNumberOfTrials; - mNumberOfTrials = NULL; return obj; - } - else if (elementName == "probabilityOfSuccess") - { - UncertValue * obj = mProbabilityOfSuccess; - mProbabilityOfSuccess = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this BinomialDistribution. - */ -unsigned int -BinomialDistribution::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "numberOfTrials") - { - if (isSetNumberOfTrials()) - { - return 1; - } - } - else if (elementName == "probabilityOfSuccess") - { - if (isSetProbabilityOfSuccess()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this BinomialDistribution. - */ -SBase* -BinomialDistribution::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "numberOfTrials") - { - return getNumberOfTrials(); - } - else if (elementName == "probabilityOfSuccess") - { - return getProbabilityOfSuccess(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -BinomialDistribution::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mNumberOfTrials != NULL) - { - if (mNumberOfTrials->getId() == id) - { - return mNumberOfTrials; - } - - obj = mNumberOfTrials->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mProbabilityOfSuccess != NULL) - { - if (mProbabilityOfSuccess->getId() == id) - { - return mProbabilityOfSuccess; - } - - obj = mProbabilityOfSuccess->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -BinomialDistribution::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mNumberOfTrials != NULL) - { - if (mNumberOfTrials->getMetaId() == metaid) - { - return mNumberOfTrials; - } - - obj = mNumberOfTrials->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mProbabilityOfSuccess != NULL) - { - if (mProbabilityOfSuccess->getMetaId() == metaid) - { - return mProbabilityOfSuccess; - } - - obj = mProbabilityOfSuccess->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -BinomialDistribution::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mNumberOfTrials, filter); - ADD_FILTERED_POINTER(ret, sublist, mProbabilityOfSuccess, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -BinomialDistribution::createObject(XMLInputStream& stream) -{ - SBase* obj = DiscreteUnivariateDistribution::createObject(stream); - - const std::string& name = stream.peek().getName(); - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - - if (name == "numberOfTrials") - { - if (getErrorLog() && isSetNumberOfTrials()) - { - getErrorLog()->logPackageError("distrib", - DistribBinomialDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mNumberOfTrials; - mNumberOfTrials = new UncertValue(distribns); - mNumberOfTrials->setElementName(name); - obj = mNumberOfTrials; - } - else if (name == "probabilityOfSuccess") - { - if (getErrorLog() && isSetProbabilityOfSuccess()) - { - getErrorLog()->logPackageError("distrib", - DistribBinomialDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mProbabilityOfSuccess; - mProbabilityOfSuccess = new UncertValue(distribns); - mProbabilityOfSuccess->setElementName(name); - obj = mProbabilityOfSuccess; - } - - delete distribns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -BinomialDistribution::addExpectedAttributes(ExpectedAttributes& attributes) -{ - DiscreteUnivariateDistribution::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -BinomialDistribution::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - DiscreteUnivariateDistribution::readAttributes(attributes, - expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribBinomialDistributionAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribBinomialDistributionAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -BinomialDistribution::writeAttributes(XMLOutputStream& stream) const -{ - DiscreteUnivariateDistribution::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new BinomialDistribution_t using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -BinomialDistribution_t * -BinomialDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new BinomialDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this BinomialDistribution_t object. - */ -LIBSBML_EXTERN -BinomialDistribution_t* -BinomialDistribution_clone(const BinomialDistribution_t* bd) -{ - if (bd != NULL) - { - return static_cast(bd->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this BinomialDistribution_t object. - */ -LIBSBML_EXTERN -void -BinomialDistribution_free(BinomialDistribution_t* bd) -{ - if (bd != NULL) - { - delete bd; - } -} - - -/* - * Returns the value of the "numberOfTrials" element of this - * BinomialDistribution_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -BinomialDistribution_getNumberOfTrials(const BinomialDistribution_t * bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->getNumberOfTrials()); -} - - -/* - * Returns the value of the "probabilityOfSuccess" element of this - * BinomialDistribution_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -BinomialDistribution_getProbabilityOfSuccess(const BinomialDistribution_t * bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->getProbabilityOfSuccess()); -} - - -/* - * Predicate returning @c 1 (true) if this BinomialDistribution_t's - * "numberOfTrials" element is set. - */ -LIBSBML_EXTERN -int -BinomialDistribution_isSetNumberOfTrials(const BinomialDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->isSetNumberOfTrials()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this BinomialDistribution_t's - * "probabilityOfSuccess" element is set. - */ -LIBSBML_EXTERN -int -BinomialDistribution_isSetProbabilityOfSuccess(const BinomialDistribution_t * - bd) -{ - return (bd != NULL) ? static_cast(bd->isSetProbabilityOfSuccess()) : 0; -} - - -/* - * Sets the value of the "numberOfTrials" element of this - * BinomialDistribution_t. - */ -LIBSBML_EXTERN -int -BinomialDistribution_setNumberOfTrials(BinomialDistribution_t * bd, - const UncertValue_t* numberOfTrials) -{ - return (bd != NULL) ? bd->setNumberOfTrials(numberOfTrials) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution_t. - */ -LIBSBML_EXTERN -int -BinomialDistribution_setProbabilityOfSuccess(BinomialDistribution_t * bd, - const UncertValue_t* - probabilityOfSuccess) -{ - return (bd != NULL) ? bd->setProbabilityOfSuccess(probabilityOfSuccess) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t - * object and returns the UncertValue_t object created. - */ -LIBSBML_EXTERN -UncertValue_t* -BinomialDistribution_createNumberOfTrials(BinomialDistribution_t* bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->createNumberOfTrials()); -} - - -/* - * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t - * object and returns the UncertValue_t object created. - */ -LIBSBML_EXTERN -UncertValue_t* -BinomialDistribution_createProbabilityOfSuccess(BinomialDistribution_t* bd) -{ - if (bd == NULL) - { - return NULL; - } - - return (UncertValue_t*)(bd->createProbabilityOfSuccess()); -} - - -/* - * Unsets the value of the "numberOfTrials" element of this - * BinomialDistribution_t. - */ -LIBSBML_EXTERN -int -BinomialDistribution_unsetNumberOfTrials(BinomialDistribution_t * bd) -{ - return (bd != NULL) ? bd->unsetNumberOfTrials() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution_t. - */ -LIBSBML_EXTERN -int -BinomialDistribution_unsetProbabilityOfSuccess(BinomialDistribution_t * bd) -{ - return (bd != NULL) ? bd->unsetProbabilityOfSuccess() : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * BinomialDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -BinomialDistribution_hasRequiredAttributes(const BinomialDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * BinomialDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -BinomialDistribution_hasRequiredElements(const BinomialDistribution_t * bd) -{ - return (bd != NULL) ? static_cast(bd->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file BinomialDistribution.cpp + * @brief Implementation of the BinomialDistribution class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new BinomialDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +BinomialDistribution::BinomialDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : DiscreteUnivariateDistribution(level, version, pkgVersion) + , mNumberOfTrials (NULL) + , mProbabilityOfSuccess (NULL) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new BinomialDistribution using the given DistribPkgNamespaces + * object. + */ +BinomialDistribution::BinomialDistribution(DistribPkgNamespaces *distribns) + : DiscreteUnivariateDistribution(distribns) + , mNumberOfTrials (NULL) + , mProbabilityOfSuccess (NULL) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for BinomialDistribution. + */ +BinomialDistribution::BinomialDistribution(const BinomialDistribution& orig) + : DiscreteUnivariateDistribution( orig ) + , mNumberOfTrials ( NULL ) + , mProbabilityOfSuccess ( NULL ) +{ + if (orig.mNumberOfTrials != NULL) + { + mNumberOfTrials = orig.mNumberOfTrials->clone(); + } + + if (orig.mProbabilityOfSuccess != NULL) + { + mProbabilityOfSuccess = orig.mProbabilityOfSuccess->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for BinomialDistribution. + */ +BinomialDistribution& +BinomialDistribution::operator=(const BinomialDistribution& rhs) +{ + if (&rhs != this) + { + DiscreteUnivariateDistribution::operator=(rhs); + delete mNumberOfTrials; + if (rhs.mNumberOfTrials != NULL) + { + mNumberOfTrials = rhs.mNumberOfTrials->clone(); + } + else + { + mNumberOfTrials = NULL; + } + + delete mProbabilityOfSuccess; + if (rhs.mProbabilityOfSuccess != NULL) + { + mProbabilityOfSuccess = rhs.mProbabilityOfSuccess->clone(); + } + else + { + mProbabilityOfSuccess = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this BinomialDistribution object. + */ +BinomialDistribution* +BinomialDistribution::clone() const +{ + return new BinomialDistribution(*this); +} + + +/* + * Destructor for BinomialDistribution. + */ +BinomialDistribution::~BinomialDistribution() +{ + delete mNumberOfTrials; + mNumberOfTrials = NULL; + delete mProbabilityOfSuccess; + mProbabilityOfSuccess = NULL; +} + + +/* + * Returns the value of the "numberOfTrials" element of this + * BinomialDistribution. + */ +const UncertValue* +BinomialDistribution::getNumberOfTrials() const +{ + return mNumberOfTrials; +} + + +/* + * Returns the value of the "numberOfTrials" element of this + * BinomialDistribution. + */ +UncertValue* +BinomialDistribution::getNumberOfTrials() +{ + return mNumberOfTrials; +} + + +/* + * Returns the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + */ +const UncertValue* +BinomialDistribution::getProbabilityOfSuccess() const +{ + return mProbabilityOfSuccess; +} + + +/* + * Returns the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + */ +UncertValue* +BinomialDistribution::getProbabilityOfSuccess() +{ + return mProbabilityOfSuccess; +} + + +/* + * Predicate returning @c true if this BinomialDistribution's "numberOfTrials" + * element is set. + */ +bool +BinomialDistribution::isSetNumberOfTrials() const +{ + return (mNumberOfTrials != NULL); +} + + +/* + * Predicate returning @c true if this BinomialDistribution's + * "probabilityOfSuccess" element is set. + */ +bool +BinomialDistribution::isSetProbabilityOfSuccess() const +{ + return (mProbabilityOfSuccess != NULL); +} + + +/* + * Sets the value of the "numberOfTrials" element of this BinomialDistribution. + */ +int +BinomialDistribution::setNumberOfTrials(const UncertValue* numberOfTrials) +{ + if (mNumberOfTrials == numberOfTrials) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (numberOfTrials == NULL) + { + delete mNumberOfTrials; + mNumberOfTrials = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mNumberOfTrials; + mNumberOfTrials = (numberOfTrials != NULL) ? numberOfTrials->clone() : + NULL; + if (mNumberOfTrials != NULL) + { + mNumberOfTrials->setElementName("numberOfTrials"); + mNumberOfTrials->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + */ +int +BinomialDistribution::setProbabilityOfSuccess(const UncertValue* + probabilityOfSuccess) +{ + if (mProbabilityOfSuccess == probabilityOfSuccess) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (probabilityOfSuccess == NULL) + { + delete mProbabilityOfSuccess; + mProbabilityOfSuccess = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mProbabilityOfSuccess; + mProbabilityOfSuccess = (probabilityOfSuccess != NULL) ? + probabilityOfSuccess->clone() : NULL; + if (mProbabilityOfSuccess != NULL) + { + mProbabilityOfSuccess->setElementName("probabilityOfSuccess"); + mProbabilityOfSuccess->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new UncertValue object, adds it to this BinomialDistribution + * object and returns the UncertValue object created. + */ +UncertValue* +BinomialDistribution::createNumberOfTrials() +{ + if (mNumberOfTrials != NULL) + { + delete mNumberOfTrials; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mNumberOfTrials = new UncertValue(distribns); + + mNumberOfTrials->setElementName("numberOfTrials"); + + delete distribns; + + connectToChild(); + + return mNumberOfTrials; +} + + +/* + * Creates a new UncertValue object, adds it to this BinomialDistribution + * object and returns the UncertValue object created. + */ +UncertValue* +BinomialDistribution::createProbabilityOfSuccess() +{ + if (mProbabilityOfSuccess != NULL) + { + delete mProbabilityOfSuccess; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mProbabilityOfSuccess = new UncertValue(distribns); + + mProbabilityOfSuccess->setElementName("probabilityOfSuccess"); + + delete distribns; + + connectToChild(); + + return mProbabilityOfSuccess; +} + + +/* + * Unsets the value of the "numberOfTrials" element of this + * BinomialDistribution. + */ +int +BinomialDistribution::unsetNumberOfTrials() +{ + delete mNumberOfTrials; + mNumberOfTrials = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + */ +int +BinomialDistribution::unsetProbabilityOfSuccess() +{ + delete mProbabilityOfSuccess; + mProbabilityOfSuccess = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this BinomialDistribution object. + */ +const std::string& +BinomialDistribution::getElementName() const +{ + static const string name = "binomialDistribution"; + return name; +} + + +/* + * Returns the libSBML type code for this BinomialDistribution object. + */ +int +BinomialDistribution::getTypeCode() const +{ + return SBML_DISTRIB_BINOMIALDISTRIBUTION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * BinomialDistribution object have been set. + */ +bool +BinomialDistribution::hasRequiredAttributes() const +{ + bool allPresent = DiscreteUnivariateDistribution::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * BinomialDistribution object have been set. + */ +bool +BinomialDistribution::hasRequiredElements() const +{ + bool allPresent = DiscreteUnivariateDistribution::hasRequiredElements(); + + if (isSetNumberOfTrials() == false) + { + allPresent = false; + } + + if (isSetProbabilityOfSuccess() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +BinomialDistribution::writeElements(XMLOutputStream& stream) const +{ + DiscreteUnivariateDistribution::writeElements(stream); + + if (isSetNumberOfTrials() == true) + { + mNumberOfTrials->write(stream); + } + + if (isSetProbabilityOfSuccess() == true) + { + mProbabilityOfSuccess->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +BinomialDistribution::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mNumberOfTrials != NULL) + { + mNumberOfTrials->accept(v); + } + + if (mProbabilityOfSuccess != NULL) + { + mProbabilityOfSuccess->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +BinomialDistribution::setSBMLDocument(SBMLDocument* d) +{ + DiscreteUnivariateDistribution::setSBMLDocument(d); + + if (mNumberOfTrials != NULL) + { + mNumberOfTrials->setSBMLDocument(d); + } + + if (mProbabilityOfSuccess != NULL) + { + mProbabilityOfSuccess->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +BinomialDistribution::connectToChild() +{ + DiscreteUnivariateDistribution::connectToChild(); + + if (mNumberOfTrials != NULL) + { + mNumberOfTrials->connectToParent(this); + } + + if (mProbabilityOfSuccess != NULL) + { + mProbabilityOfSuccess->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +BinomialDistribution::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + DiscreteUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, + flag); + + if (isSetNumberOfTrials()) + { + mNumberOfTrials->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + if (isSetProbabilityOfSuccess()) + { + mProbabilityOfSuccess->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +BinomialDistribution::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + DiscreteUnivariateDistribution::updateSBMLNamespace(package, level, version); + + if (mNumberOfTrials != NULL) + { + mNumberOfTrials->updateSBMLNamespace(package, level, version); + } + + if (mProbabilityOfSuccess != NULL) + { + mProbabilityOfSuccess->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = + DiscreteUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = + DiscreteUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = + DiscreteUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = + DiscreteUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = + DiscreteUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this BinomialDistribution's attribute + * "attributeName" is set. + */ +bool +BinomialDistribution::isSetAttribute(const std::string& attributeName) const +{ + bool value = DiscreteUnivariateDistribution::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = + DiscreteUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::setAttribute(const std::string& attributeName, + int value) +{ + int return_value = + DiscreteUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = + DiscreteUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = + DiscreteUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = + DiscreteUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * BinomialDistribution. + */ +int +BinomialDistribution::unsetAttribute(const std::string& attributeName) +{ + int value = DiscreteUnivariateDistribution::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this + * BinomialDistribution. + */ +SBase* +BinomialDistribution::createChildObject(const std::string& elementName) +{ + DiscreteUnivariateDistribution* obj = NULL; + + if (elementName == "numberOfTrials") + { + return createNumberOfTrials(); + } + else if (elementName == "probabilityOfSuccess") + { + return createProbabilityOfSuccess(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this BinomialDistribution. + */ +int +BinomialDistribution::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "numberOfTrials" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setNumberOfTrials((const UncertValue*)(element)); + } + else if (elementName == "probabilityOfSuccess" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setProbabilityOfSuccess((const UncertValue*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * BinomialDistribution. + */ +SBase* +BinomialDistribution::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "numberOfTrials") + { + UncertValue * obj = mNumberOfTrials; + mNumberOfTrials = NULL; return obj; + } + else if (elementName == "probabilityOfSuccess") + { + UncertValue * obj = mProbabilityOfSuccess; + mProbabilityOfSuccess = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this BinomialDistribution. + */ +unsigned int +BinomialDistribution::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "numberOfTrials") + { + if (isSetNumberOfTrials()) + { + return 1; + } + } + else if (elementName == "probabilityOfSuccess") + { + if (isSetProbabilityOfSuccess()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this BinomialDistribution. + */ +SBase* +BinomialDistribution::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "numberOfTrials") + { + return getNumberOfTrials(); + } + else if (elementName == "probabilityOfSuccess") + { + return getProbabilityOfSuccess(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +BinomialDistribution::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mNumberOfTrials != NULL) + { + if (mNumberOfTrials->getId() == id) + { + return mNumberOfTrials; + } + + obj = mNumberOfTrials->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mProbabilityOfSuccess != NULL) + { + if (mProbabilityOfSuccess->getId() == id) + { + return mProbabilityOfSuccess; + } + + obj = mProbabilityOfSuccess->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +BinomialDistribution::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mNumberOfTrials != NULL) + { + if (mNumberOfTrials->getMetaId() == metaid) + { + return mNumberOfTrials; + } + + obj = mNumberOfTrials->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mProbabilityOfSuccess != NULL) + { + if (mProbabilityOfSuccess->getMetaId() == metaid) + { + return mProbabilityOfSuccess; + } + + obj = mProbabilityOfSuccess->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +BinomialDistribution::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mNumberOfTrials, filter); + ADD_FILTERED_POINTER(ret, sublist, mProbabilityOfSuccess, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +BinomialDistribution::createObject(XMLInputStream& stream) +{ + SBase* obj = DiscreteUnivariateDistribution::createObject(stream); + + const std::string& name = stream.peek().getName(); + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + + if (name == "numberOfTrials") + { + if (getErrorLog() && isSetNumberOfTrials()) + { + getErrorLog()->logPackageError("distrib", + DistribBinomialDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mNumberOfTrials; + mNumberOfTrials = new UncertValue(distribns); + mNumberOfTrials->setElementName(name); + obj = mNumberOfTrials; + } + else if (name == "probabilityOfSuccess") + { + if (getErrorLog() && isSetProbabilityOfSuccess()) + { + getErrorLog()->logPackageError("distrib", + DistribBinomialDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mProbabilityOfSuccess; + mProbabilityOfSuccess = new UncertValue(distribns); + mProbabilityOfSuccess->setElementName(name); + obj = mProbabilityOfSuccess; + } + + delete distribns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +BinomialDistribution::addExpectedAttributes(ExpectedAttributes& attributes) +{ + DiscreteUnivariateDistribution::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +BinomialDistribution::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + DiscreteUnivariateDistribution::readAttributes(attributes, + expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribBinomialDistributionAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribBinomialDistributionAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +BinomialDistribution::writeAttributes(XMLOutputStream& stream) const +{ + DiscreteUnivariateDistribution::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new BinomialDistribution_t using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +BinomialDistribution_t * +BinomialDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new BinomialDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this BinomialDistribution_t object. + */ +LIBSBML_EXTERN +BinomialDistribution_t* +BinomialDistribution_clone(const BinomialDistribution_t* bd) +{ + if (bd != NULL) + { + return static_cast(bd->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this BinomialDistribution_t object. + */ +LIBSBML_EXTERN +void +BinomialDistribution_free(BinomialDistribution_t* bd) +{ + if (bd != NULL) + { + delete bd; + } +} + + +/* + * Returns the value of the "numberOfTrials" element of this + * BinomialDistribution_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +BinomialDistribution_getNumberOfTrials(const BinomialDistribution_t * bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->getNumberOfTrials()); +} + + +/* + * Returns the value of the "probabilityOfSuccess" element of this + * BinomialDistribution_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +BinomialDistribution_getProbabilityOfSuccess(const BinomialDistribution_t * bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->getProbabilityOfSuccess()); +} + + +/* + * Predicate returning @c 1 (true) if this BinomialDistribution_t's + * "numberOfTrials" element is set. + */ +LIBSBML_EXTERN +int +BinomialDistribution_isSetNumberOfTrials(const BinomialDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->isSetNumberOfTrials()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this BinomialDistribution_t's + * "probabilityOfSuccess" element is set. + */ +LIBSBML_EXTERN +int +BinomialDistribution_isSetProbabilityOfSuccess(const BinomialDistribution_t * + bd) +{ + return (bd != NULL) ? static_cast(bd->isSetProbabilityOfSuccess()) : 0; +} + + +/* + * Sets the value of the "numberOfTrials" element of this + * BinomialDistribution_t. + */ +LIBSBML_EXTERN +int +BinomialDistribution_setNumberOfTrials(BinomialDistribution_t * bd, + const UncertValue_t* numberOfTrials) +{ + return (bd != NULL) ? bd->setNumberOfTrials(numberOfTrials) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution_t. + */ +LIBSBML_EXTERN +int +BinomialDistribution_setProbabilityOfSuccess(BinomialDistribution_t * bd, + const UncertValue_t* + probabilityOfSuccess) +{ + return (bd != NULL) ? bd->setProbabilityOfSuccess(probabilityOfSuccess) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t + * object and returns the UncertValue_t object created. + */ +LIBSBML_EXTERN +UncertValue_t* +BinomialDistribution_createNumberOfTrials(BinomialDistribution_t* bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->createNumberOfTrials()); +} + + +/* + * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t + * object and returns the UncertValue_t object created. + */ +LIBSBML_EXTERN +UncertValue_t* +BinomialDistribution_createProbabilityOfSuccess(BinomialDistribution_t* bd) +{ + if (bd == NULL) + { + return NULL; + } + + return (UncertValue_t*)(bd->createProbabilityOfSuccess()); +} + + +/* + * Unsets the value of the "numberOfTrials" element of this + * BinomialDistribution_t. + */ +LIBSBML_EXTERN +int +BinomialDistribution_unsetNumberOfTrials(BinomialDistribution_t * bd) +{ + return (bd != NULL) ? bd->unsetNumberOfTrials() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution_t. + */ +LIBSBML_EXTERN +int +BinomialDistribution_unsetProbabilityOfSuccess(BinomialDistribution_t * bd) +{ + return (bd != NULL) ? bd->unsetProbabilityOfSuccess() : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * BinomialDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +BinomialDistribution_hasRequiredAttributes(const BinomialDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * BinomialDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +BinomialDistribution_hasRequiredElements(const BinomialDistribution_t * bd) +{ + return (bd != NULL) ? static_cast(bd->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/BinomialDistribution.h b/generator/tests/test_cpp_code/test-code/BinomialDistribution.h index 1e30882b..e7749589 100644 --- a/generator/tests/test_cpp_code/test-code/BinomialDistribution.h +++ b/generator/tests/test_cpp_code/test-code/BinomialDistribution.h @@ -1,1140 +1,1140 @@ -/** - * @file BinomialDistribution.h - * @brief Definition of the BinomialDistribution class. - * @author SBMLTeam - * - * - * - * @class BinomialDistribution - * @sbmlbrief{distrib} TODO:Definition of the BinomialDistribution class. - */ - - -#ifndef BinomialDistribution_H__ -#define BinomialDistribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN BinomialDistribution : public - DiscreteUnivariateDistribution -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - UncertValue* mNumberOfTrials; - UncertValue* mProbabilityOfSuccess; - - /** @endcond */ - -public: - - /** - * Creates a new BinomialDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * BinomialDistribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * BinomialDistribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this BinomialDistribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - BinomialDistribution(unsigned int level = - DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new BinomialDistribution using the given DistribPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - BinomialDistribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for BinomialDistribution. - * - * @param orig the BinomialDistribution instance to copy. - */ - BinomialDistribution(const BinomialDistribution& orig); - - - /** - * Assignment operator for BinomialDistribution. - * - * @param rhs the BinomialDistribution object whose values are to be used as - * the basis of the assignment. - */ - BinomialDistribution& operator=(const BinomialDistribution& rhs); - - - /** - * Creates and returns a deep copy of this BinomialDistribution object. - * - * @return a (deep) copy of this BinomialDistribution object. - */ - virtual BinomialDistribution* clone() const; - - - /** - * Destructor for BinomialDistribution. - */ - virtual ~BinomialDistribution(); - - - /** - * Returns the value of the "numberOfTrials" element of this - * BinomialDistribution. - * - * @return the value of the "numberOfTrials" element of this - * BinomialDistribution as a UncertValue*. - */ - const UncertValue* getNumberOfTrials() const; - - - /** - * Returns the value of the "numberOfTrials" element of this - * BinomialDistribution. - * - * @return the value of the "numberOfTrials" element of this - * BinomialDistribution as a UncertValue*. - */ - UncertValue* getNumberOfTrials(); - - - /** - * Returns the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - * - * @return the value of the "probabilityOfSuccess" element of this - * BinomialDistribution as a UncertValue*. - */ - const UncertValue* getProbabilityOfSuccess() const; - - - /** - * Returns the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - * - * @return the value of the "probabilityOfSuccess" element of this - * BinomialDistribution as a UncertValue*. - */ - UncertValue* getProbabilityOfSuccess(); - - - /** - * Predicate returning @c true if this BinomialDistribution's - * "numberOfTrials" element is set. - * - * @return @c true if this BinomialDistribution's "numberOfTrials" element - * has been set, otherwise @c false is returned. - */ - bool isSetNumberOfTrials() const; - - - /** - * Predicate returning @c true if this BinomialDistribution's - * "probabilityOfSuccess" element is set. - * - * @return @c true if this BinomialDistribution's "probabilityOfSuccess" - * element has been set, otherwise @c false is returned. - */ - bool isSetProbabilityOfSuccess() const; - - - /** - * Sets the value of the "numberOfTrials" element of this - * BinomialDistribution. - * - * @param numberOfTrials UncertValue* value of the "numberOfTrials" element - * to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setNumberOfTrials(const UncertValue* numberOfTrials); - - - /** - * Sets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - * - * @param probabilityOfSuccess UncertValue* value of the - * "probabilityOfSuccess" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setProbabilityOfSuccess(const UncertValue* probabilityOfSuccess); - - - /** - * Creates a new UncertValue object, adds it to this BinomialDistribution - * object and returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createNumberOfTrials(); - - - /** - * Creates a new UncertValue object, adds it to this BinomialDistribution - * object and returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createProbabilityOfSuccess(); - - - /** - * Unsets the value of the "numberOfTrials" element of this - * BinomialDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetNumberOfTrials(); - - - /** - * Unsets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetProbabilityOfSuccess(); - - - /** - * Returns the XML element name of this BinomialDistribution object. - * - * For BinomialDistribution, the XML element name is always - * @c "binomialDistribution". - * - * @return the name of this element, i.e. @c "binomialDistribution". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this BinomialDistribution object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_BINOMIALDISTRIBUTION, SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * BinomialDistribution object have been set. - * - * @return @c true to indicate that all the required attributes of this - * BinomialDistribution have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * BinomialDistribution object have been set. - * - * @return @c true to indicate that all the required elements of this - * BinomialDistribution have been set, otherwise @c false is returned. - * - * - * @note The required elements for the BinomialDistribution object are: - * @li "numberOfTrials" - * @li "probabilityOfSuccess" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this BinomialDistribution's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this BinomialDistribution's attribute "attributeName" - * has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * BinomialDistribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this - * BinomialDistribution. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this BinomialDistribution. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * BinomialDistribution. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this BinomialDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this BinomialDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new BinomialDistribution_t using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * BinomialDistribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * BinomialDistribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this BinomialDistribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -BinomialDistribution_t * -BinomialDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this BinomialDistribution_t object. - * - * @param bd the BinomialDistribution_t structure. - * - * @return a (deep) copy of this BinomialDistribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -BinomialDistribution_t* -BinomialDistribution_clone(const BinomialDistribution_t* bd); - - -/** - * Frees this BinomialDistribution_t object. - * - * @param bd the BinomialDistribution_t structure. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -void -BinomialDistribution_free(BinomialDistribution_t* bd); - - -/** - * Returns the value of the "numberOfTrials" element of this - * BinomialDistribution_t. - * - * @param bd the BinomialDistribution_t structure whose numberOfTrials is - * sought. - * - * @return the value of the "numberOfTrials" element of this - * BinomialDistribution_t as a UncertValue*. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -const UncertValue_t* -BinomialDistribution_getNumberOfTrials(const BinomialDistribution_t * bd); - - -/** - * Returns the value of the "probabilityOfSuccess" element of this - * BinomialDistribution_t. - * - * @param bd the BinomialDistribution_t structure whose probabilityOfSuccess is - * sought. - * - * @return the value of the "probabilityOfSuccess" element of this - * BinomialDistribution_t as a UncertValue*. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -const UncertValue_t* -BinomialDistribution_getProbabilityOfSuccess(const BinomialDistribution_t * - bd); - - -/** - * Predicate returning @c 1 (true) if this BinomialDistribution_t's - * "numberOfTrials" element is set. - * - * @param bd the BinomialDistribution_t structure. - * - * @return @c 1 (true) if this BinomialDistribution_t's "numberOfTrials" - * element has been set, otherwise @c 0 (false) is returned. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_isSetNumberOfTrials(const BinomialDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if this BinomialDistribution_t's - * "probabilityOfSuccess" element is set. - * - * @param bd the BinomialDistribution_t structure. - * - * @return @c 1 (true) if this BinomialDistribution_t's "probabilityOfSuccess" - * element has been set, otherwise @c 0 (false) is returned. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_isSetProbabilityOfSuccess(const BinomialDistribution_t * - bd); - - -/** - * Sets the value of the "numberOfTrials" element of this - * BinomialDistribution_t. - * - * @param bd the BinomialDistribution_t structure. - * - * @param numberOfTrials UncertValue_t* value of the "numberOfTrials" element - * to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_setNumberOfTrials(BinomialDistribution_t * bd, - const UncertValue_t* numberOfTrials); - - -/** - * Sets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution_t. - * - * @param bd the BinomialDistribution_t structure. - * - * @param probabilityOfSuccess UncertValue_t* value of the - * "probabilityOfSuccess" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_setProbabilityOfSuccess(BinomialDistribution_t * bd, - const UncertValue_t* - probabilityOfSuccess); - - -/** - * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t - * object and returns the UncertValue_t object created. - * - * @param bd the BinomialDistribution_t structure to which the UncertValue_t - * should be added. - * - * @return a new UncertValue_t object instance. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -UncertValue_t* -BinomialDistribution_createNumberOfTrials(BinomialDistribution_t* bd); - - -/** - * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t - * object and returns the UncertValue_t object created. - * - * @param bd the BinomialDistribution_t structure to which the UncertValue_t - * should be added. - * - * @return a new UncertValue_t object instance. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -UncertValue_t* -BinomialDistribution_createProbabilityOfSuccess(BinomialDistribution_t* bd); - - -/** - * Unsets the value of the "numberOfTrials" element of this - * BinomialDistribution_t. - * - * @param bd the BinomialDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_unsetNumberOfTrials(BinomialDistribution_t * bd); - - -/** - * Unsets the value of the "probabilityOfSuccess" element of this - * BinomialDistribution_t. - * - * @param bd the BinomialDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_unsetProbabilityOfSuccess(BinomialDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * BinomialDistribution_t object have been set. - * - * @param bd the BinomialDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * BinomialDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_hasRequiredAttributes(const BinomialDistribution_t * bd); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * BinomialDistribution_t object have been set. - * - * @param bd the BinomialDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * BinomialDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the BinomialDistribution_t object are: - * @li "numberOfTrials" - * @li "probabilityOfSuccess" - * - * @memberof BinomialDistribution_t - */ -LIBSBML_EXTERN -int -BinomialDistribution_hasRequiredElements(const BinomialDistribution_t * bd); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !BinomialDistribution_H__ */ - - +/** + * @file BinomialDistribution.h + * @brief Definition of the BinomialDistribution class. + * @author SBMLTeam + * + * + * + * @class BinomialDistribution + * @sbmlbrief{distrib} TODO:Definition of the BinomialDistribution class. + */ + + +#ifndef BinomialDistribution_H__ +#define BinomialDistribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN BinomialDistribution : public + DiscreteUnivariateDistribution +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + UncertValue* mNumberOfTrials; + UncertValue* mProbabilityOfSuccess; + + /** @endcond */ + +public: + + /** + * Creates a new BinomialDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * BinomialDistribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * BinomialDistribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this BinomialDistribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + BinomialDistribution(unsigned int level = + DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new BinomialDistribution using the given DistribPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + BinomialDistribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for BinomialDistribution. + * + * @param orig the BinomialDistribution instance to copy. + */ + BinomialDistribution(const BinomialDistribution& orig); + + + /** + * Assignment operator for BinomialDistribution. + * + * @param rhs the BinomialDistribution object whose values are to be used as + * the basis of the assignment. + */ + BinomialDistribution& operator=(const BinomialDistribution& rhs); + + + /** + * Creates and returns a deep copy of this BinomialDistribution object. + * + * @return a (deep) copy of this BinomialDistribution object. + */ + virtual BinomialDistribution* clone() const; + + + /** + * Destructor for BinomialDistribution. + */ + virtual ~BinomialDistribution(); + + + /** + * Returns the value of the "numberOfTrials" element of this + * BinomialDistribution. + * + * @return the value of the "numberOfTrials" element of this + * BinomialDistribution as a UncertValue*. + */ + const UncertValue* getNumberOfTrials() const; + + + /** + * Returns the value of the "numberOfTrials" element of this + * BinomialDistribution. + * + * @return the value of the "numberOfTrials" element of this + * BinomialDistribution as a UncertValue*. + */ + UncertValue* getNumberOfTrials(); + + + /** + * Returns the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + * + * @return the value of the "probabilityOfSuccess" element of this + * BinomialDistribution as a UncertValue*. + */ + const UncertValue* getProbabilityOfSuccess() const; + + + /** + * Returns the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + * + * @return the value of the "probabilityOfSuccess" element of this + * BinomialDistribution as a UncertValue*. + */ + UncertValue* getProbabilityOfSuccess(); + + + /** + * Predicate returning @c true if this BinomialDistribution's + * "numberOfTrials" element is set. + * + * @return @c true if this BinomialDistribution's "numberOfTrials" element + * has been set, otherwise @c false is returned. + */ + bool isSetNumberOfTrials() const; + + + /** + * Predicate returning @c true if this BinomialDistribution's + * "probabilityOfSuccess" element is set. + * + * @return @c true if this BinomialDistribution's "probabilityOfSuccess" + * element has been set, otherwise @c false is returned. + */ + bool isSetProbabilityOfSuccess() const; + + + /** + * Sets the value of the "numberOfTrials" element of this + * BinomialDistribution. + * + * @param numberOfTrials UncertValue* value of the "numberOfTrials" element + * to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setNumberOfTrials(const UncertValue* numberOfTrials); + + + /** + * Sets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + * + * @param probabilityOfSuccess UncertValue* value of the + * "probabilityOfSuccess" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setProbabilityOfSuccess(const UncertValue* probabilityOfSuccess); + + + /** + * Creates a new UncertValue object, adds it to this BinomialDistribution + * object and returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createNumberOfTrials(); + + + /** + * Creates a new UncertValue object, adds it to this BinomialDistribution + * object and returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createProbabilityOfSuccess(); + + + /** + * Unsets the value of the "numberOfTrials" element of this + * BinomialDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetNumberOfTrials(); + + + /** + * Unsets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetProbabilityOfSuccess(); + + + /** + * Returns the XML element name of this BinomialDistribution object. + * + * For BinomialDistribution, the XML element name is always + * @c "binomialDistribution". + * + * @return the name of this element, i.e. @c "binomialDistribution". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this BinomialDistribution object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_BINOMIALDISTRIBUTION, SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * BinomialDistribution object have been set. + * + * @return @c true to indicate that all the required attributes of this + * BinomialDistribution have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * BinomialDistribution object have been set. + * + * @return @c true to indicate that all the required elements of this + * BinomialDistribution have been set, otherwise @c false is returned. + * + * + * @note The required elements for the BinomialDistribution object are: + * @li "numberOfTrials" + * @li "probabilityOfSuccess" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this BinomialDistribution's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this BinomialDistribution's attribute "attributeName" + * has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * BinomialDistribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this + * BinomialDistribution. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this BinomialDistribution. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * BinomialDistribution. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this BinomialDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this BinomialDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new BinomialDistribution_t using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * BinomialDistribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * BinomialDistribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this BinomialDistribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +BinomialDistribution_t * +BinomialDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this BinomialDistribution_t object. + * + * @param bd the BinomialDistribution_t structure. + * + * @return a (deep) copy of this BinomialDistribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +BinomialDistribution_t* +BinomialDistribution_clone(const BinomialDistribution_t* bd); + + +/** + * Frees this BinomialDistribution_t object. + * + * @param bd the BinomialDistribution_t structure. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +void +BinomialDistribution_free(BinomialDistribution_t* bd); + + +/** + * Returns the value of the "numberOfTrials" element of this + * BinomialDistribution_t. + * + * @param bd the BinomialDistribution_t structure whose numberOfTrials is + * sought. + * + * @return the value of the "numberOfTrials" element of this + * BinomialDistribution_t as a UncertValue*. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +const UncertValue_t* +BinomialDistribution_getNumberOfTrials(const BinomialDistribution_t * bd); + + +/** + * Returns the value of the "probabilityOfSuccess" element of this + * BinomialDistribution_t. + * + * @param bd the BinomialDistribution_t structure whose probabilityOfSuccess is + * sought. + * + * @return the value of the "probabilityOfSuccess" element of this + * BinomialDistribution_t as a UncertValue*. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +const UncertValue_t* +BinomialDistribution_getProbabilityOfSuccess(const BinomialDistribution_t * + bd); + + +/** + * Predicate returning @c 1 (true) if this BinomialDistribution_t's + * "numberOfTrials" element is set. + * + * @param bd the BinomialDistribution_t structure. + * + * @return @c 1 (true) if this BinomialDistribution_t's "numberOfTrials" + * element has been set, otherwise @c 0 (false) is returned. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_isSetNumberOfTrials(const BinomialDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if this BinomialDistribution_t's + * "probabilityOfSuccess" element is set. + * + * @param bd the BinomialDistribution_t structure. + * + * @return @c 1 (true) if this BinomialDistribution_t's "probabilityOfSuccess" + * element has been set, otherwise @c 0 (false) is returned. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_isSetProbabilityOfSuccess(const BinomialDistribution_t * + bd); + + +/** + * Sets the value of the "numberOfTrials" element of this + * BinomialDistribution_t. + * + * @param bd the BinomialDistribution_t structure. + * + * @param numberOfTrials UncertValue_t* value of the "numberOfTrials" element + * to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_setNumberOfTrials(BinomialDistribution_t * bd, + const UncertValue_t* numberOfTrials); + + +/** + * Sets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution_t. + * + * @param bd the BinomialDistribution_t structure. + * + * @param probabilityOfSuccess UncertValue_t* value of the + * "probabilityOfSuccess" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_setProbabilityOfSuccess(BinomialDistribution_t * bd, + const UncertValue_t* + probabilityOfSuccess); + + +/** + * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t + * object and returns the UncertValue_t object created. + * + * @param bd the BinomialDistribution_t structure to which the UncertValue_t + * should be added. + * + * @return a new UncertValue_t object instance. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +UncertValue_t* +BinomialDistribution_createNumberOfTrials(BinomialDistribution_t* bd); + + +/** + * Creates a new UncertValue_t object, adds it to this BinomialDistribution_t + * object and returns the UncertValue_t object created. + * + * @param bd the BinomialDistribution_t structure to which the UncertValue_t + * should be added. + * + * @return a new UncertValue_t object instance. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +UncertValue_t* +BinomialDistribution_createProbabilityOfSuccess(BinomialDistribution_t* bd); + + +/** + * Unsets the value of the "numberOfTrials" element of this + * BinomialDistribution_t. + * + * @param bd the BinomialDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_unsetNumberOfTrials(BinomialDistribution_t * bd); + + +/** + * Unsets the value of the "probabilityOfSuccess" element of this + * BinomialDistribution_t. + * + * @param bd the BinomialDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_unsetProbabilityOfSuccess(BinomialDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * BinomialDistribution_t object have been set. + * + * @param bd the BinomialDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * BinomialDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_hasRequiredAttributes(const BinomialDistribution_t * bd); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * BinomialDistribution_t object have been set. + * + * @param bd the BinomialDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * BinomialDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the BinomialDistribution_t object are: + * @li "numberOfTrials" + * @li "probabilityOfSuccess" + * + * @memberof BinomialDistribution_t + */ +LIBSBML_EXTERN +int +BinomialDistribution_hasRequiredElements(const BinomialDistribution_t * bd); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !BinomialDistribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Boundary.cpp b/generator/tests/test_cpp_code/test-code/Boundary.cpp index 651bc3f7..fe0c2f66 100644 --- a/generator/tests/test_cpp_code/test-code/Boundary.cpp +++ b/generator/tests/test_cpp_code/test-code/Boundary.cpp @@ -1,923 +1,923 @@ -/** - * @file Boundary.cpp - * @brief Implementation of the Boundary class. - * @author SBMLTeam - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Boundary using the given SBML Level, Version and - * “spatial” package version. - */ -Boundary::Boundary(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mValue (util_NaN()) - , mIsSetValue (false) - , mElementName("boundary") -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); -} - - -/* - * Creates a new Boundary using the given SpatialPkgNamespaces object. - */ -Boundary::Boundary(SpatialPkgNamespaces *spatialns) - : SBase(spatialns) - , mValue (util_NaN()) - , mIsSetValue (false) - , mElementName("boundary") -{ - setElementNamespace(spatialns->getURI()); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for Boundary. - */ -Boundary::Boundary(const Boundary& orig) - : SBase( orig ) - , mValue ( orig.mValue ) - , mIsSetValue ( orig.mIsSetValue ) - , mElementName ( orig.mElementName ) -{ -} - - -/* - * Assignment operator for Boundary. - */ -Boundary& -Boundary::operator=(const Boundary& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mValue = rhs.mValue; - mIsSetValue = rhs.mIsSetValue; - mElementName = rhs.mElementName; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Boundary object. - */ -Boundary* -Boundary::clone() const -{ - return new Boundary(*this); -} - - -/* - * Destructor for Boundary. - */ -Boundary::~Boundary() -{ -} - - -/* - * Returns the value of the "id" attribute of this Boundary. - */ -const std::string& -Boundary::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "value" attribute of this Boundary. - */ -double -Boundary::getValue() const -{ - return mValue; -} - - -/* - * Predicate returning @c true if this Boundary's "id" attribute is set. - */ -bool -Boundary::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this Boundary's "value" attribute is set. - */ -bool -Boundary::isSetValue() const -{ - return mIsSetValue; -} - - -/* - * Sets the value of the "id" attribute of this Boundary. - */ -int -Boundary::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "value" attribute of this Boundary. - */ -int -Boundary::setValue(double value) -{ - mValue = value; - mIsSetValue = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this Boundary. - */ -int -Boundary::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "value" attribute of this Boundary. - */ -int -Boundary::unsetValue() -{ - mValue = util_NaN(); - mIsSetValue = false; - - if (isSetValue() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the XML element name of this Boundary object. - */ -const std::string& -Boundary::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this Boundary object. - */ -void -Boundary::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this Boundary object. - */ -int -Boundary::getTypeCode() const -{ - return SBML_SPATIAL_BOUNDARY; -} - - -/* - * Predicate returning @c true if all the required attributes for this Boundary - * object have been set. - */ -bool -Boundary::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - if (isSetValue() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Boundary::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Boundary::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Boundary::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Boundary::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "value") - { - value = getValue(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Boundary's attribute "attributeName" is - * set. - */ -bool -Boundary::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "value") - { - value = isSetValue(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "value") - { - return_value = setValue(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Boundary. - */ -int -Boundary::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "value") - { - value = unsetValue(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Boundary::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("value"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Boundary::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", SpatialBoundaryAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", SpatialBoundaryAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'id' is missing from the " - " element."; - log->logPackageError("spatial", SpatialBoundaryAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } - - // - // value double (use = "required" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetValue = attributes.readInto("value", mValue); - - if ( mIsSetValue == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Spatial attribute 'value' from the " - "element must be an integer."; - log->logPackageError("spatial", SpatialBoundaryValueMustBeDouble, - pkgVersion, level, version, message, getLine(), getColumn()); - } - else - { - std::string message = "Spatial attribute 'value' is missing from the " - " element."; - log->logPackageError("spatial", SpatialBoundaryAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Boundary::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetValue() == true) - { - stream.writeAttribute("value", getPrefix(), mValue); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Boundary_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -Boundary_t * -Boundary_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new Boundary(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Boundary_t object. - */ -LIBSBML_EXTERN -Boundary_t* -Boundary_clone(const Boundary_t* b) -{ - if (b != NULL) - { - return static_cast(b->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Boundary_t object. - */ -LIBSBML_EXTERN -void -Boundary_free(Boundary_t* b) -{ - if (b != NULL) - { - delete b; - } -} - - -/* - * Returns the value of the "id" attribute of this Boundary_t. - */ -LIBSBML_EXTERN -char * -Boundary_getId(const Boundary_t * b) -{ - if (b == NULL) - { - return NULL; - } - - return b->getId().empty() ? NULL : safe_strdup(b->getId().c_str()); -} - - -/* - * Returns the value of the "value" attribute of this Boundary_t. - */ -LIBSBML_EXTERN -double -Boundary_getValue(const Boundary_t * b) -{ - return (b != NULL) ? b->getValue() : util_NaN(); -} - - -/* - * Predicate returning @c 1 (true) if this Boundary_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -Boundary_isSetId(const Boundary_t * b) -{ - return (b != NULL) ? static_cast(b->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Boundary_t's "value" attribute is - * set. - */ -LIBSBML_EXTERN -int -Boundary_isSetValue(const Boundary_t * b) -{ - return (b != NULL) ? static_cast(b->isSetValue()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this Boundary_t. - */ -LIBSBML_EXTERN -int -Boundary_setId(Boundary_t * b, const char * id) -{ - return (b != NULL) ? b->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "value" attribute of this Boundary_t. - */ -LIBSBML_EXTERN -int -Boundary_setValue(Boundary_t * b, double value) -{ - return (b != NULL) ? b->setValue(value) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this Boundary_t. - */ -LIBSBML_EXTERN -int -Boundary_unsetId(Boundary_t * b) -{ - return (b != NULL) ? b->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "value" attribute of this Boundary_t. - */ -LIBSBML_EXTERN -int -Boundary_unsetValue(Boundary_t * b) -{ - return (b != NULL) ? b->unsetValue() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Boundary_t object have been set. - */ -LIBSBML_EXTERN -int -Boundary_hasRequiredAttributes(const Boundary_t * b) -{ - return (b != NULL) ? static_cast(b->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Boundary.cpp + * @brief Implementation of the Boundary class. + * @author SBMLTeam + * + * + */ +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Boundary using the given SBML Level, Version and + * “spatial” package version. + */ +Boundary::Boundary(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mValue (util_NaN()) + , mIsSetValue (false) + , mElementName("boundary") +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); +} + + +/* + * Creates a new Boundary using the given SpatialPkgNamespaces object. + */ +Boundary::Boundary(SpatialPkgNamespaces *spatialns) + : SBase(spatialns) + , mValue (util_NaN()) + , mIsSetValue (false) + , mElementName("boundary") +{ + setElementNamespace(spatialns->getURI()); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for Boundary. + */ +Boundary::Boundary(const Boundary& orig) + : SBase( orig ) + , mValue ( orig.mValue ) + , mIsSetValue ( orig.mIsSetValue ) + , mElementName ( orig.mElementName ) +{ +} + + +/* + * Assignment operator for Boundary. + */ +Boundary& +Boundary::operator=(const Boundary& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mValue = rhs.mValue; + mIsSetValue = rhs.mIsSetValue; + mElementName = rhs.mElementName; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Boundary object. + */ +Boundary* +Boundary::clone() const +{ + return new Boundary(*this); +} + + +/* + * Destructor for Boundary. + */ +Boundary::~Boundary() +{ +} + + +/* + * Returns the value of the "id" attribute of this Boundary. + */ +const std::string& +Boundary::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "value" attribute of this Boundary. + */ +double +Boundary::getValue() const +{ + return mValue; +} + + +/* + * Predicate returning @c true if this Boundary's "id" attribute is set. + */ +bool +Boundary::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this Boundary's "value" attribute is set. + */ +bool +Boundary::isSetValue() const +{ + return mIsSetValue; +} + + +/* + * Sets the value of the "id" attribute of this Boundary. + */ +int +Boundary::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "value" attribute of this Boundary. + */ +int +Boundary::setValue(double value) +{ + mValue = value; + mIsSetValue = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "id" attribute of this Boundary. + */ +int +Boundary::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "value" attribute of this Boundary. + */ +int +Boundary::unsetValue() +{ + mValue = util_NaN(); + mIsSetValue = false; + + if (isSetValue() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the XML element name of this Boundary object. + */ +const std::string& +Boundary::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this Boundary object. + */ +void +Boundary::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this Boundary object. + */ +int +Boundary::getTypeCode() const +{ + return SBML_SPATIAL_BOUNDARY; +} + + +/* + * Predicate returning @c true if all the required attributes for this Boundary + * object have been set. + */ +bool +Boundary::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + if (isSetValue() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Boundary::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Boundary::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Boundary::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Boundary::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "value") + { + value = getValue(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Boundary's attribute "attributeName" is + * set. + */ +bool +Boundary::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "value") + { + value = isSetValue(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "value") + { + return_value = setValue(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Boundary. + */ +int +Boundary::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "value") + { + value = unsetValue(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Boundary::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("value"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Boundary::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", SpatialBoundaryAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", SpatialBoundaryAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'id' is missing from the " + " element."; + log->logPackageError("spatial", SpatialBoundaryAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } + + // + // value double (use = "required" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetValue = attributes.readInto("value", mValue); + + if ( mIsSetValue == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Spatial attribute 'value' from the " + "element must be an integer."; + log->logPackageError("spatial", SpatialBoundaryValueMustBeDouble, + pkgVersion, level, version, message, getLine(), getColumn()); + } + else + { + std::string message = "Spatial attribute 'value' is missing from the " + " element."; + log->logPackageError("spatial", SpatialBoundaryAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Boundary::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetValue() == true) + { + stream.writeAttribute("value", getPrefix(), mValue); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Boundary_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +Boundary_t * +Boundary_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new Boundary(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Boundary_t object. + */ +LIBSBML_EXTERN +Boundary_t* +Boundary_clone(const Boundary_t* b) +{ + if (b != NULL) + { + return static_cast(b->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Boundary_t object. + */ +LIBSBML_EXTERN +void +Boundary_free(Boundary_t* b) +{ + if (b != NULL) + { + delete b; + } +} + + +/* + * Returns the value of the "id" attribute of this Boundary_t. + */ +LIBSBML_EXTERN +char * +Boundary_getId(const Boundary_t * b) +{ + if (b == NULL) + { + return NULL; + } + + return b->getId().empty() ? NULL : safe_strdup(b->getId().c_str()); +} + + +/* + * Returns the value of the "value" attribute of this Boundary_t. + */ +LIBSBML_EXTERN +double +Boundary_getValue(const Boundary_t * b) +{ + return (b != NULL) ? b->getValue() : util_NaN(); +} + + +/* + * Predicate returning @c 1 (true) if this Boundary_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +Boundary_isSetId(const Boundary_t * b) +{ + return (b != NULL) ? static_cast(b->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Boundary_t's "value" attribute is + * set. + */ +LIBSBML_EXTERN +int +Boundary_isSetValue(const Boundary_t * b) +{ + return (b != NULL) ? static_cast(b->isSetValue()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this Boundary_t. + */ +LIBSBML_EXTERN +int +Boundary_setId(Boundary_t * b, const char * id) +{ + return (b != NULL) ? b->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "value" attribute of this Boundary_t. + */ +LIBSBML_EXTERN +int +Boundary_setValue(Boundary_t * b, double value) +{ + return (b != NULL) ? b->setValue(value) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this Boundary_t. + */ +LIBSBML_EXTERN +int +Boundary_unsetId(Boundary_t * b) +{ + return (b != NULL) ? b->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "value" attribute of this Boundary_t. + */ +LIBSBML_EXTERN +int +Boundary_unsetValue(Boundary_t * b) +{ + return (b != NULL) ? b->unsetValue() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Boundary_t object have been set. + */ +LIBSBML_EXTERN +int +Boundary_hasRequiredAttributes(const Boundary_t * b) +{ + return (b != NULL) ? static_cast(b->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Boundary.h b/generator/tests/test_cpp_code/test-code/Boundary.h index 1c5e7083..269e53fa 100644 --- a/generator/tests/test_cpp_code/test-code/Boundary.h +++ b/generator/tests/test_cpp_code/test-code/Boundary.h @@ -1,855 +1,855 @@ -/** - * @file Boundary.h - * @brief Definition of the Boundary class. - * @author SBMLTeam - * - * - * - * @class Boundary - * @sbmlbrief{spatial} TODO:Definition of the Boundary class. - */ - - -#ifndef Boundary_H__ -#define Boundary_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Boundary : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - double mValue; - bool mIsSetValue; - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new Boundary using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Boundary. - * - * @param version an unsigned int, the SBML Version to assign to this - * Boundary. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this Boundary. - * - * @copydetails doc_note_setting_lv_pkg - */ - Boundary(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Boundary using the given SpatialPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Boundary(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for Boundary. - * - * @param orig the Boundary instance to copy. - */ - Boundary(const Boundary& orig); - - - /** - * Assignment operator for Boundary. - * - * @param rhs the Boundary object whose values are to be used as the basis of - * the assignment. - */ - Boundary& operator=(const Boundary& rhs); - - - /** - * Creates and returns a deep copy of this Boundary object. - * - * @return a (deep) copy of this Boundary object. - */ - virtual Boundary* clone() const; - - - /** - * Destructor for Boundary. - */ - virtual ~Boundary(); - - - /** - * Returns the value of the "id" attribute of this Boundary. - * - * @return the value of the "id" attribute of this Boundary as a string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "value" attribute of this Boundary. - * - * @return the value of the "value" attribute of this Boundary as a double. - */ - double getValue() const; - - - /** - * Predicate returning @c true if this Boundary's "id" attribute is set. - * - * @return @c true if this Boundary's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this Boundary's "value" attribute is set. - * - * @return @c true if this Boundary's "value" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetValue() const; - - - /** - * Sets the value of the "id" attribute of this Boundary. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "value" attribute of this Boundary. - * - * @param value double value of the "value" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setValue(double value); - - - /** - * Unsets the value of the "id" attribute of this Boundary. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "value" attribute of this Boundary. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetValue(); - - - /** - * Returns the XML element name of this Boundary object. - * - * For Boundary, the XML element name is always @c "boundary". - * - * @return the name of this element, i.e. @c "boundary". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this Boundary object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this Boundary object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_BOUNDARY, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * Boundary object have been set. - * - * @return @c true to indicate that all the required attributes of this - * Boundary have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the Boundary object are: - * @li "id" - * @li "value" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Boundary's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Boundary's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Boundary. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Boundary_t using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Boundary_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Boundary_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this Boundary_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -Boundary_t * -Boundary_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Boundary_t object. - * - * @param b the Boundary_t structure. - * - * @return a (deep) copy of this Boundary_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -Boundary_t* -Boundary_clone(const Boundary_t* b); - - -/** - * Frees this Boundary_t object. - * - * @param b the Boundary_t structure. - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -void -Boundary_free(Boundary_t* b); - - -/** - * Returns the value of the "id" attribute of this Boundary_t. - * - * @param b the Boundary_t structure whose id is sought. - * - * @return the value of the "id" attribute of this Boundary_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -char * -Boundary_getId(const Boundary_t * b); - - -/** - * Returns the value of the "value" attribute of this Boundary_t. - * - * @param b the Boundary_t structure whose value is sought. - * - * @return the value of the "value" attribute of this Boundary_t as a double. - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -double -Boundary_getValue(const Boundary_t * b); - - -/** - * Predicate returning @c 1 (true) if this Boundary_t's "id" attribute is set. - * - * @param b the Boundary_t structure. - * - * @return @c 1 (true) if this Boundary_t's "id" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -int -Boundary_isSetId(const Boundary_t * b); - - -/** - * Predicate returning @c 1 (true) if this Boundary_t's "value" attribute is - * set. - * - * @param b the Boundary_t structure. - * - * @return @c 1 (true) if this Boundary_t's "value" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -int -Boundary_isSetValue(const Boundary_t * b); - - -/** - * Sets the value of the "id" attribute of this Boundary_t. - * - * @param b the Boundary_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling Boundary_unsetId(). - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -int -Boundary_setId(Boundary_t * b, const char * id); - - -/** - * Sets the value of the "value" attribute of this Boundary_t. - * - * @param b the Boundary_t structure. - * - * @param value double value of the "value" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -int -Boundary_setValue(Boundary_t * b, double value); - - -/** - * Unsets the value of the "id" attribute of this Boundary_t. - * - * @param b the Boundary_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -int -Boundary_unsetId(Boundary_t * b); - - -/** - * Unsets the value of the "value" attribute of this Boundary_t. - * - * @param b the Boundary_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -int -Boundary_unsetValue(Boundary_t * b); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Boundary_t object have been set. - * - * @param b the Boundary_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Boundary_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the Boundary_t object are: - * @li "id" - * @li "value" - * - * @memberof Boundary_t - */ -LIBSBML_EXTERN -int -Boundary_hasRequiredAttributes(const Boundary_t * b); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Boundary_H__ */ - - +/** + * @file Boundary.h + * @brief Definition of the Boundary class. + * @author SBMLTeam + * + * + * + * @class Boundary + * @sbmlbrief{spatial} TODO:Definition of the Boundary class. + */ + + +#ifndef Boundary_H__ +#define Boundary_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Boundary : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + double mValue; + bool mIsSetValue; + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new Boundary using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Boundary. + * + * @param version an unsigned int, the SBML Version to assign to this + * Boundary. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this Boundary. + * + * @copydetails doc_note_setting_lv_pkg + */ + Boundary(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Boundary using the given SpatialPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Boundary(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for Boundary. + * + * @param orig the Boundary instance to copy. + */ + Boundary(const Boundary& orig); + + + /** + * Assignment operator for Boundary. + * + * @param rhs the Boundary object whose values are to be used as the basis of + * the assignment. + */ + Boundary& operator=(const Boundary& rhs); + + + /** + * Creates and returns a deep copy of this Boundary object. + * + * @return a (deep) copy of this Boundary object. + */ + virtual Boundary* clone() const; + + + /** + * Destructor for Boundary. + */ + virtual ~Boundary(); + + + /** + * Returns the value of the "id" attribute of this Boundary. + * + * @return the value of the "id" attribute of this Boundary as a string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "value" attribute of this Boundary. + * + * @return the value of the "value" attribute of this Boundary as a double. + */ + double getValue() const; + + + /** + * Predicate returning @c true if this Boundary's "id" attribute is set. + * + * @return @c true if this Boundary's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this Boundary's "value" attribute is set. + * + * @return @c true if this Boundary's "value" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetValue() const; + + + /** + * Sets the value of the "id" attribute of this Boundary. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "value" attribute of this Boundary. + * + * @param value double value of the "value" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setValue(double value); + + + /** + * Unsets the value of the "id" attribute of this Boundary. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "value" attribute of this Boundary. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetValue(); + + + /** + * Returns the XML element name of this Boundary object. + * + * For Boundary, the XML element name is always @c "boundary". + * + * @return the name of this element, i.e. @c "boundary". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this Boundary object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this Boundary object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_BOUNDARY, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * Boundary object have been set. + * + * @return @c true to indicate that all the required attributes of this + * Boundary have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the Boundary object are: + * @li "id" + * @li "value" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Boundary's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Boundary's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Boundary. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Boundary_t using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Boundary_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Boundary_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this Boundary_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +Boundary_t * +Boundary_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Boundary_t object. + * + * @param b the Boundary_t structure. + * + * @return a (deep) copy of this Boundary_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +Boundary_t* +Boundary_clone(const Boundary_t* b); + + +/** + * Frees this Boundary_t object. + * + * @param b the Boundary_t structure. + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +void +Boundary_free(Boundary_t* b); + + +/** + * Returns the value of the "id" attribute of this Boundary_t. + * + * @param b the Boundary_t structure whose id is sought. + * + * @return the value of the "id" attribute of this Boundary_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +char * +Boundary_getId(const Boundary_t * b); + + +/** + * Returns the value of the "value" attribute of this Boundary_t. + * + * @param b the Boundary_t structure whose value is sought. + * + * @return the value of the "value" attribute of this Boundary_t as a double. + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +double +Boundary_getValue(const Boundary_t * b); + + +/** + * Predicate returning @c 1 (true) if this Boundary_t's "id" attribute is set. + * + * @param b the Boundary_t structure. + * + * @return @c 1 (true) if this Boundary_t's "id" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +int +Boundary_isSetId(const Boundary_t * b); + + +/** + * Predicate returning @c 1 (true) if this Boundary_t's "value" attribute is + * set. + * + * @param b the Boundary_t structure. + * + * @return @c 1 (true) if this Boundary_t's "value" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +int +Boundary_isSetValue(const Boundary_t * b); + + +/** + * Sets the value of the "id" attribute of this Boundary_t. + * + * @param b the Boundary_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling Boundary_unsetId(). + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +int +Boundary_setId(Boundary_t * b, const char * id); + + +/** + * Sets the value of the "value" attribute of this Boundary_t. + * + * @param b the Boundary_t structure. + * + * @param value double value of the "value" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +int +Boundary_setValue(Boundary_t * b, double value); + + +/** + * Unsets the value of the "id" attribute of this Boundary_t. + * + * @param b the Boundary_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +int +Boundary_unsetId(Boundary_t * b); + + +/** + * Unsets the value of the "value" attribute of this Boundary_t. + * + * @param b the Boundary_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +int +Boundary_unsetValue(Boundary_t * b); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Boundary_t object have been set. + * + * @param b the Boundary_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Boundary_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the Boundary_t object are: + * @li "id" + * @li "value" + * + * @memberof Boundary_t + */ +LIBSBML_EXTERN +int +Boundary_hasRequiredAttributes(const Boundary_t * b); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Boundary_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/CSGNode.cpp b/generator/tests/test_cpp_code/test-code/CSGNode.cpp index a7537300..6b3bf16d 100644 --- a/generator/tests/test_cpp_code/test-code/CSGNode.cpp +++ b/generator/tests/test_cpp_code/test-code/CSGNode.cpp @@ -1,976 +1,976 @@ -/** - * @file CSGNode.cpp - * @brief Implementation of the CSGNode class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new CSGNode using the given SBML Level, Version and - * “spatial” package version. - */ -CSGNode::CSGNode(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mElementName("csgNode") -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); -} - - -/* - * Creates a new CSGNode using the given SpatialPkgNamespaces object. - */ -CSGNode::CSGNode(SpatialPkgNamespaces *spatialns) - : SBase(spatialns) - , mElementName("csgNode") -{ - setElementNamespace(spatialns->getURI()); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for CSGNode. - */ -CSGNode::CSGNode(const CSGNode& orig) - : SBase( orig ) - , mElementName ( orig.mElementName ) -{ -} - - -/* - * Assignment operator for CSGNode. - */ -CSGNode& -CSGNode::operator=(const CSGNode& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mElementName = rhs.mElementName; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this CSGNode object. - */ -CSGNode* -CSGNode::clone() const -{ - return new CSGNode(*this); -} - - -/* - * Destructor for CSGNode. - */ -CSGNode::~CSGNode() -{ -} - - -/* - * Returns the value of the "id" attribute of this CSGNode. - */ -const std::string& -CSGNode::getId() const -{ - return mId; -} - - -/* - * Predicate returning @c true if this CSGNode's "id" attribute is set. - */ -bool -CSGNode::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this CSGNode. - */ -int -CSGNode::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Unsets the value of the "id" attribute of this CSGNode. - */ -int -CSGNode::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGPrimitive - */ -bool -CSGNode::isCSGPrimitive() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGTranslation - */ -bool -CSGNode::isCSGTranslation() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGRotation - */ -bool -CSGNode::isCSGRotation() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGNode" is of type CSGScale - */ -bool -CSGNode::isCSGScale() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGHomogeneousTransformation - */ -bool -CSGNode::isCSGHomogeneousTransformation() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGSetOperator - */ -bool -CSGNode::isCSGSetOperator() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Returns the XML element name of this CSGNode object. - */ -const std::string& -CSGNode::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this CSGNode object. - */ -void -CSGNode::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this CSGNode object. - */ -int -CSGNode::getTypeCode() const -{ - return SBML_SPATIAL_CSGNODE; -} - - -/* - * Predicate returning @c true if all the required attributes for this CSGNode - * object have been set. - */ -bool -CSGNode::hasRequiredAttributes() const -{ - bool allPresent = true; - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -CSGNode::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -CSGNode::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -CSGNode::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -CSGNode::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this CSGNode's attribute "attributeName" is - * set. - */ -bool -CSGNode::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this CSGNode. - */ -int -CSGNode::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -CSGNode::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -CSGNode::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialCSGObjectLOCSGNodesAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialCSGObjectLOCSGNodesAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", SpatialCSGNodeAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", SpatialCSGNodeAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "optional" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -CSGNode::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new CSGPrimitive using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGPrimitive_t * -CSGNode_createCSGPrimitive(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGPrimitive(level, version, pkgVersion); -} - - -/* - * Creates a new CSGTranslation using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGTranslation_t * -CSGNode_createCSGTranslation(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGTranslation(level, version, pkgVersion); -} - - -/* - * Creates a new CSGRotation using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGRotation_t * -CSGNode_createCSGRotation(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGRotation(level, version, pkgVersion); -} - - -/* - * Creates a new CSGScale using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGScale_t * -CSGNode_createCSGScale(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGScale(level, version, pkgVersion); -} - - -/* - * Creates a new CSGHomogeneousTransformation using the given SBML Level, - * Version and “spatial” package version. - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t * -CSGNode_createCSGHomogeneousTransformation(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGHomogeneousTransformation(level, version, pkgVersion); -} - - -/* - * Creates a new CSGSetOperator using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGSetOperator_t * -CSGNode_createCSGSetOperator(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGSetOperator(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this CSGNode_t object. - */ -LIBSBML_EXTERN -CSGNode_t* -CSGNode_clone(const CSGNode_t* csgn) -{ - if (csgn != NULL) - { - return static_cast(csgn->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this CSGNode_t object. - */ -LIBSBML_EXTERN -void -CSGNode_free(CSGNode_t* csgn) -{ - if (csgn != NULL) - { - delete csgn; - } -} - - -/* - * Returns the value of the "id" attribute of this CSGNode_t. - */ -LIBSBML_EXTERN -char * -CSGNode_getId(const CSGNode_t * csgn) -{ - if (csgn == NULL) - { - return NULL; - } - - return csgn->getId().empty() ? NULL : safe_strdup(csgn->getId().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this CSGNode_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -CSGNode_isSetId(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? static_cast(csgn->isSetId()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this CSGNode_t. - */ -LIBSBML_EXTERN -int -CSGNode_setId(CSGNode_t * csgn, const char * id) -{ - return (csgn != NULL) ? csgn->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this CSGNode_t. - */ -LIBSBML_EXTERN -int -CSGNode_unsetId(CSGNode_t * csgn) -{ - return (csgn != NULL) ? csgn->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 if this CSGNode_t is of type CSGPrimitive_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGPrimitive(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? static_cast(csgn->isCSGPrimitive()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGNode_t is of type CSGTranslation_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGTranslation(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? static_cast(csgn->isCSGTranslation()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGNode_t is of type CSGRotation_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGRotation(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? static_cast(csgn->isCSGRotation()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGNode_t is of type CSGScale_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGScale(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? static_cast(csgn->isCSGScale()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGNode_t is of type - * CSGHomogeneousTransformation_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGHomogeneousTransformation(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? - static_cast(csgn->isCSGHomogeneousTransformation()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGNode_t is of type CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGSetOperator(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? static_cast(csgn->isCSGSetOperator()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGNode_t object have been set. - */ -LIBSBML_EXTERN -int -CSGNode_hasRequiredAttributes(const CSGNode_t * csgn) -{ - return (csgn != NULL) ? static_cast(csgn->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file CSGNode.cpp + * @brief Implementation of the CSGNode class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CSGNode using the given SBML Level, Version and + * “spatial” package version. + */ +CSGNode::CSGNode(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mElementName("csgNode") +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); +} + + +/* + * Creates a new CSGNode using the given SpatialPkgNamespaces object. + */ +CSGNode::CSGNode(SpatialPkgNamespaces *spatialns) + : SBase(spatialns) + , mElementName("csgNode") +{ + setElementNamespace(spatialns->getURI()); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for CSGNode. + */ +CSGNode::CSGNode(const CSGNode& orig) + : SBase( orig ) + , mElementName ( orig.mElementName ) +{ +} + + +/* + * Assignment operator for CSGNode. + */ +CSGNode& +CSGNode::operator=(const CSGNode& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mElementName = rhs.mElementName; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CSGNode object. + */ +CSGNode* +CSGNode::clone() const +{ + return new CSGNode(*this); +} + + +/* + * Destructor for CSGNode. + */ +CSGNode::~CSGNode() +{ +} + + +/* + * Returns the value of the "id" attribute of this CSGNode. + */ +const std::string& +CSGNode::getId() const +{ + return mId; +} + + +/* + * Predicate returning @c true if this CSGNode's "id" attribute is set. + */ +bool +CSGNode::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Sets the value of the "id" attribute of this CSGNode. + */ +int +CSGNode::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Unsets the value of the "id" attribute of this CSGNode. + */ +int +CSGNode::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGPrimitive + */ +bool +CSGNode::isCSGPrimitive() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGTranslation + */ +bool +CSGNode::isCSGTranslation() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGRotation + */ +bool +CSGNode::isCSGRotation() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGNode" is of type CSGScale + */ +bool +CSGNode::isCSGScale() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGHomogeneousTransformation + */ +bool +CSGNode::isCSGHomogeneousTransformation() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGSetOperator + */ +bool +CSGNode::isCSGSetOperator() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Returns the XML element name of this CSGNode object. + */ +const std::string& +CSGNode::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this CSGNode object. + */ +void +CSGNode::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this CSGNode object. + */ +int +CSGNode::getTypeCode() const +{ + return SBML_SPATIAL_CSGNODE; +} + + +/* + * Predicate returning @c true if all the required attributes for this CSGNode + * object have been set. + */ +bool +CSGNode::hasRequiredAttributes() const +{ + bool allPresent = true; + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +CSGNode::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +CSGNode::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +CSGNode::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +CSGNode::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this CSGNode's attribute "attributeName" is + * set. + */ +bool +CSGNode::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CSGNode. + */ +int +CSGNode::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CSGNode::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CSGNode::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialCSGObjectLOCSGNodesAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialCSGObjectLOCSGNodesAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", SpatialCSGNodeAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", SpatialCSGNodeAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "optional" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +CSGNode::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CSGPrimitive using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGPrimitive_t * +CSGNode_createCSGPrimitive(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGPrimitive(level, version, pkgVersion); +} + + +/* + * Creates a new CSGTranslation using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGTranslation_t * +CSGNode_createCSGTranslation(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGTranslation(level, version, pkgVersion); +} + + +/* + * Creates a new CSGRotation using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGRotation_t * +CSGNode_createCSGRotation(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGRotation(level, version, pkgVersion); +} + + +/* + * Creates a new CSGScale using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGScale_t * +CSGNode_createCSGScale(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGScale(level, version, pkgVersion); +} + + +/* + * Creates a new CSGHomogeneousTransformation using the given SBML Level, + * Version and “spatial” package version. + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t * +CSGNode_createCSGHomogeneousTransformation(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGHomogeneousTransformation(level, version, pkgVersion); +} + + +/* + * Creates a new CSGSetOperator using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGSetOperator_t * +CSGNode_createCSGSetOperator(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGSetOperator(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this CSGNode_t object. + */ +LIBSBML_EXTERN +CSGNode_t* +CSGNode_clone(const CSGNode_t* csgn) +{ + if (csgn != NULL) + { + return static_cast(csgn->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CSGNode_t object. + */ +LIBSBML_EXTERN +void +CSGNode_free(CSGNode_t* csgn) +{ + if (csgn != NULL) + { + delete csgn; + } +} + + +/* + * Returns the value of the "id" attribute of this CSGNode_t. + */ +LIBSBML_EXTERN +char * +CSGNode_getId(const CSGNode_t * csgn) +{ + if (csgn == NULL) + { + return NULL; + } + + return csgn->getId().empty() ? NULL : safe_strdup(csgn->getId().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this CSGNode_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +CSGNode_isSetId(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? static_cast(csgn->isSetId()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this CSGNode_t. + */ +LIBSBML_EXTERN +int +CSGNode_setId(CSGNode_t * csgn, const char * id) +{ + return (csgn != NULL) ? csgn->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this CSGNode_t. + */ +LIBSBML_EXTERN +int +CSGNode_unsetId(CSGNode_t * csgn) +{ + return (csgn != NULL) ? csgn->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 if this CSGNode_t is of type CSGPrimitive_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGPrimitive(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? static_cast(csgn->isCSGPrimitive()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGNode_t is of type CSGTranslation_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGTranslation(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? static_cast(csgn->isCSGTranslation()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGNode_t is of type CSGRotation_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGRotation(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? static_cast(csgn->isCSGRotation()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGNode_t is of type CSGScale_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGScale(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? static_cast(csgn->isCSGScale()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGNode_t is of type + * CSGHomogeneousTransformation_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGHomogeneousTransformation(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? + static_cast(csgn->isCSGHomogeneousTransformation()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGNode_t is of type CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGSetOperator(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? static_cast(csgn->isCSGSetOperator()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGNode_t object have been set. + */ +LIBSBML_EXTERN +int +CSGNode_hasRequiredAttributes(const CSGNode_t * csgn) +{ + return (csgn != NULL) ? static_cast(csgn->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/CSGNode.h b/generator/tests/test_cpp_code/test-code/CSGNode.h index bc71aed0..954add71 100644 --- a/generator/tests/test_cpp_code/test-code/CSGNode.h +++ b/generator/tests/test_cpp_code/test-code/CSGNode.h @@ -1,1014 +1,1014 @@ -/** - * @file CSGNode.h - * @brief Definition of the CSGNode class. - * @author SBMLTeam - * - * - * - * @class CSGNode - * @sbmlbrief{spatial} TODO:Definition of the CSGNode class. - */ - - -#ifndef CSGNode_H__ -#define CSGNode_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class CSGPrimitive; -class CSGTranslation; -class CSGRotation; -class CSGScale; -class CSGHomogeneousTransformation; -class CSGSetOperator; - -class LIBSBML_EXTERN CSGNode : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new CSGNode using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGNode. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGNode. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGNode. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGNode(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new CSGNode using the given SpatialPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGNode(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for CSGNode. - * - * @param orig the CSGNode instance to copy. - */ - CSGNode(const CSGNode& orig); - - - /** - * Assignment operator for CSGNode. - * - * @param rhs the CSGNode object whose values are to be used as the basis of - * the assignment. - */ - CSGNode& operator=(const CSGNode& rhs); - - - /** - * Creates and returns a deep copy of this CSGNode object. - * - * @return a (deep) copy of this CSGNode object. - */ - virtual CSGNode* clone() const; - - - /** - * Destructor for CSGNode. - */ - virtual ~CSGNode(); - - - /** - * Returns the value of the "id" attribute of this CSGNode. - * - * @return the value of the "id" attribute of this CSGNode as a string. - */ - virtual const std::string& getId() const; - - - /** - * Predicate returning @c true if this CSGNode's "id" attribute is set. - * - * @return @c true if this CSGNode's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Sets the value of the "id" attribute of this CSGNode. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Unsets the value of the "id" attribute of this CSGNode. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGPrimitive - * - * @return @c true if this abstract "CSGNode" is of type CSGPrimitive, - * @c false otherwise - */ - virtual bool isCSGPrimitive() const; - - - /** - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGTranslation - * - * @return @c true if this abstract "CSGNode" is of type CSGTranslation, - * @c false otherwise - */ - virtual bool isCSGTranslation() const; - - - /** - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGRotation - * - * @return @c true if this abstract "CSGNode" is of type CSGRotation, - * @c false otherwise - */ - virtual bool isCSGRotation() const; - - - /** - * Predicate returning @c true if this abstract "CSGNode" is of type CSGScale - * - * @return @c true if this abstract "CSGNode" is of type CSGScale, @c false - * otherwise - */ - virtual bool isCSGScale() const; - - - /** - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGHomogeneousTransformation - * - * @return @c true if this abstract "CSGNode" is of type - * CSGHomogeneousTransformation, @c false otherwise - */ - virtual bool isCSGHomogeneousTransformation() const; - - - /** - * Predicate returning @c true if this abstract "CSGNode" is of type - * CSGSetOperator - * - * @return @c true if this abstract "CSGNode" is of type CSGSetOperator, - * @c false otherwise - */ - virtual bool isCSGSetOperator() const; - - - /** - * Returns the XML element name of this CSGNode object. - * - * For CSGNode, the XML element name is always @c "csgNode". - * - * @return the name of this element, i.e. @c "csgNode". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this CSGNode object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this CSGNode object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_CSGNODE, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * CSGNode object have been set. - * - * @return @c true to indicate that all the required attributes of this - * CSGNode have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this CSGNode's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this CSGNode's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this CSGNode. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new CSGPrimitive using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGNode_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGNode_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -CSGPrimitive_t * -CSGNode_createCSGPrimitive(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CSGTranslation using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGNode_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGNode_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -CSGTranslation_t * -CSGNode_createCSGTranslation(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CSGRotation using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGNode_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGNode_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -CSGRotation_t * -CSGNode_createCSGRotation(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CSGScale using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGNode_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGNode_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -CSGScale_t * -CSGNode_createCSGScale(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CSGHomogeneousTransformation using the given SBML Level, - * Version and “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGNode_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGNode_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t * -CSGNode_createCSGHomogeneousTransformation(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CSGSetOperator using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGNode_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGNode_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -CSGSetOperator_t * -CSGNode_createCSGSetOperator(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this CSGNode_t object. - * - * @param csgn the CSGNode_t structure. - * - * @return a (deep) copy of this CSGNode_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -CSGNode_t* -CSGNode_clone(const CSGNode_t* csgn); - - -/** - * Frees this CSGNode_t object. - * - * @param csgn the CSGNode_t structure. - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -void -CSGNode_free(CSGNode_t* csgn); - - -/** - * Returns the value of the "id" attribute of this CSGNode_t. - * - * @param csgn the CSGNode_t structure whose id is sought. - * - * @return the value of the "id" attribute of this CSGNode_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -char * -CSGNode_getId(const CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 (true) if this CSGNode_t's "id" attribute is set. - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 (true) if this CSGNode_t's "id" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_isSetId(const CSGNode_t * csgn); - - -/** - * Sets the value of the "id" attribute of this CSGNode_t. - * - * @param csgn the CSGNode_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling CSGNode_unsetId(). - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_setId(CSGNode_t * csgn, const char * id); - - -/** - * Unsets the value of the "id" attribute of this CSGNode_t. - * - * @param csgn the CSGNode_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_unsetId(CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 if this CSGNode_t is of type CSGPrimitive_t - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 if this CSGNode_t is of type CSGPrimitive_t, @c 0 otherwise - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGPrimitive(const CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 if this CSGNode_t is of type CSGTranslation_t - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 if this CSGNode_t is of type CSGTranslation_t, @c 0 otherwise - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGTranslation(const CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 if this CSGNode_t is of type CSGRotation_t - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 if this CSGNode_t is of type CSGRotation_t, @c 0 otherwise - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGRotation(const CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 if this CSGNode_t is of type CSGScale_t - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 if this CSGNode_t is of type CSGScale_t, @c 0 otherwise - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGScale(const CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 if this CSGNode_t is of type - * CSGHomogeneousTransformation_t - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 if this CSGNode_t is of type CSGHomogeneousTransformation_t, - * @c 0 otherwise - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGHomogeneousTransformation(const CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 if this CSGNode_t is of type CSGSetOperator_t - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 if this CSGNode_t is of type CSGSetOperator_t, @c 0 otherwise - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_isCSGSetOperator(const CSGNode_t * csgn); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGNode_t object have been set. - * - * @param csgn the CSGNode_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * CSGNode_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof CSGNode_t - */ -LIBSBML_EXTERN -int -CSGNode_hasRequiredAttributes(const CSGNode_t * csgn); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !CSGNode_H__ */ - - +/** + * @file CSGNode.h + * @brief Definition of the CSGNode class. + * @author SBMLTeam + * + * + * + * @class CSGNode + * @sbmlbrief{spatial} TODO:Definition of the CSGNode class. + */ + + +#ifndef CSGNode_H__ +#define CSGNode_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class CSGPrimitive; +class CSGTranslation; +class CSGRotation; +class CSGScale; +class CSGHomogeneousTransformation; +class CSGSetOperator; + +class LIBSBML_EXTERN CSGNode : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new CSGNode using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGNode. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGNode. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGNode. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGNode(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new CSGNode using the given SpatialPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGNode(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for CSGNode. + * + * @param orig the CSGNode instance to copy. + */ + CSGNode(const CSGNode& orig); + + + /** + * Assignment operator for CSGNode. + * + * @param rhs the CSGNode object whose values are to be used as the basis of + * the assignment. + */ + CSGNode& operator=(const CSGNode& rhs); + + + /** + * Creates and returns a deep copy of this CSGNode object. + * + * @return a (deep) copy of this CSGNode object. + */ + virtual CSGNode* clone() const; + + + /** + * Destructor for CSGNode. + */ + virtual ~CSGNode(); + + + /** + * Returns the value of the "id" attribute of this CSGNode. + * + * @return the value of the "id" attribute of this CSGNode as a string. + */ + virtual const std::string& getId() const; + + + /** + * Predicate returning @c true if this CSGNode's "id" attribute is set. + * + * @return @c true if this CSGNode's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Sets the value of the "id" attribute of this CSGNode. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Unsets the value of the "id" attribute of this CSGNode. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGPrimitive + * + * @return @c true if this abstract "CSGNode" is of type CSGPrimitive, + * @c false otherwise + */ + virtual bool isCSGPrimitive() const; + + + /** + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGTranslation + * + * @return @c true if this abstract "CSGNode" is of type CSGTranslation, + * @c false otherwise + */ + virtual bool isCSGTranslation() const; + + + /** + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGRotation + * + * @return @c true if this abstract "CSGNode" is of type CSGRotation, + * @c false otherwise + */ + virtual bool isCSGRotation() const; + + + /** + * Predicate returning @c true if this abstract "CSGNode" is of type CSGScale + * + * @return @c true if this abstract "CSGNode" is of type CSGScale, @c false + * otherwise + */ + virtual bool isCSGScale() const; + + + /** + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGHomogeneousTransformation + * + * @return @c true if this abstract "CSGNode" is of type + * CSGHomogeneousTransformation, @c false otherwise + */ + virtual bool isCSGHomogeneousTransformation() const; + + + /** + * Predicate returning @c true if this abstract "CSGNode" is of type + * CSGSetOperator + * + * @return @c true if this abstract "CSGNode" is of type CSGSetOperator, + * @c false otherwise + */ + virtual bool isCSGSetOperator() const; + + + /** + * Returns the XML element name of this CSGNode object. + * + * For CSGNode, the XML element name is always @c "csgNode". + * + * @return the name of this element, i.e. @c "csgNode". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this CSGNode object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this CSGNode object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_CSGNODE, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CSGNode object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CSGNode have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this CSGNode's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CSGNode's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CSGNode. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CSGPrimitive using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGNode_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGNode_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +CSGPrimitive_t * +CSGNode_createCSGPrimitive(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CSGTranslation using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGNode_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGNode_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +CSGTranslation_t * +CSGNode_createCSGTranslation(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CSGRotation using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGNode_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGNode_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +CSGRotation_t * +CSGNode_createCSGRotation(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CSGScale using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGNode_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGNode_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +CSGScale_t * +CSGNode_createCSGScale(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CSGHomogeneousTransformation using the given SBML Level, + * Version and “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGNode_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGNode_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t * +CSGNode_createCSGHomogeneousTransformation(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CSGSetOperator using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGNode_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGNode_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGNode_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +CSGSetOperator_t * +CSGNode_createCSGSetOperator(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this CSGNode_t object. + * + * @param csgn the CSGNode_t structure. + * + * @return a (deep) copy of this CSGNode_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +CSGNode_t* +CSGNode_clone(const CSGNode_t* csgn); + + +/** + * Frees this CSGNode_t object. + * + * @param csgn the CSGNode_t structure. + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +void +CSGNode_free(CSGNode_t* csgn); + + +/** + * Returns the value of the "id" attribute of this CSGNode_t. + * + * @param csgn the CSGNode_t structure whose id is sought. + * + * @return the value of the "id" attribute of this CSGNode_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +char * +CSGNode_getId(const CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 (true) if this CSGNode_t's "id" attribute is set. + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 (true) if this CSGNode_t's "id" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_isSetId(const CSGNode_t * csgn); + + +/** + * Sets the value of the "id" attribute of this CSGNode_t. + * + * @param csgn the CSGNode_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling CSGNode_unsetId(). + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_setId(CSGNode_t * csgn, const char * id); + + +/** + * Unsets the value of the "id" attribute of this CSGNode_t. + * + * @param csgn the CSGNode_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_unsetId(CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 if this CSGNode_t is of type CSGPrimitive_t + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 if this CSGNode_t is of type CSGPrimitive_t, @c 0 otherwise + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGPrimitive(const CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 if this CSGNode_t is of type CSGTranslation_t + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 if this CSGNode_t is of type CSGTranslation_t, @c 0 otherwise + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGTranslation(const CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 if this CSGNode_t is of type CSGRotation_t + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 if this CSGNode_t is of type CSGRotation_t, @c 0 otherwise + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGRotation(const CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 if this CSGNode_t is of type CSGScale_t + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 if this CSGNode_t is of type CSGScale_t, @c 0 otherwise + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGScale(const CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 if this CSGNode_t is of type + * CSGHomogeneousTransformation_t + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 if this CSGNode_t is of type CSGHomogeneousTransformation_t, + * @c 0 otherwise + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGHomogeneousTransformation(const CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 if this CSGNode_t is of type CSGSetOperator_t + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 if this CSGNode_t is of type CSGSetOperator_t, @c 0 otherwise + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_isCSGSetOperator(const CSGNode_t * csgn); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGNode_t object have been set. + * + * @param csgn the CSGNode_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CSGNode_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof CSGNode_t + */ +LIBSBML_EXTERN +int +CSGNode_hasRequiredAttributes(const CSGNode_t * csgn); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CSGNode_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/CSGObject.cpp b/generator/tests/test_cpp_code/test-code/CSGObject.cpp index 34d9d3f4..23641b3f 100644 --- a/generator/tests/test_cpp_code/test-code/CSGObject.cpp +++ b/generator/tests/test_cpp_code/test-code/CSGObject.cpp @@ -1,1951 +1,1951 @@ -/** - * @file CSGObject.cpp - * @brief Implementation of the CSGObject class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new CSGObject using the given SBML Level, Version and - * “spatial” package version. - */ -CSGObject::CSGObject(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mDomainType ("") - , mOrdinal (SBML_INT_MAX) - , mIsSetOrdinal (false) - , mCSGNode (NULL) -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new CSGObject using the given SpatialPkgNamespaces object. - */ -CSGObject::CSGObject(SpatialPkgNamespaces *spatialns) - : SBase(spatialns) - , mDomainType ("") - , mOrdinal (SBML_INT_MAX) - , mIsSetOrdinal (false) - , mCSGNode (NULL) -{ - setElementNamespace(spatialns->getURI()); - connectToChild(); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for CSGObject. - */ -CSGObject::CSGObject(const CSGObject& orig) - : SBase( orig ) - , mDomainType ( orig.mDomainType ) - , mOrdinal ( orig.mOrdinal ) - , mIsSetOrdinal ( orig.mIsSetOrdinal ) - , mCSGNode ( NULL ) -{ - if (orig.mCSGNode != NULL) - { - mCSGNode = orig.mCSGNode->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for CSGObject. - */ -CSGObject& -CSGObject::operator=(const CSGObject& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mDomainType = rhs.mDomainType; - mOrdinal = rhs.mOrdinal; - mIsSetOrdinal = rhs.mIsSetOrdinal; - delete mCSGNode; - if (rhs.mCSGNode != NULL) - { - mCSGNode = rhs.mCSGNode->clone(); - } - else - { - mCSGNode = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this CSGObject object. - */ -CSGObject* -CSGObject::clone() const -{ - return new CSGObject(*this); -} - - -/* - * Destructor for CSGObject. - */ -CSGObject::~CSGObject() -{ - delete mCSGNode; - mCSGNode = NULL; -} - - -/* - * Returns the value of the "id" attribute of this CSGObject. - */ -const std::string& -CSGObject::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "domainType" attribute of this CSGObject. - */ -const std::string& -CSGObject::getDomainType() const -{ - return mDomainType; -} - - -/* - * Returns the value of the "ordinal" attribute of this CSGObject. - */ -int -CSGObject::getOrdinal() const -{ - return mOrdinal; -} - - -/* - * Predicate returning @c true if this CSGObject's "id" attribute is set. - */ -bool -CSGObject::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this CSGObject's "domainType" attribute is - * set. - */ -bool -CSGObject::isSetDomainType() const -{ - return (mDomainType.empty() == false); -} - - -/* - * Predicate returning @c true if this CSGObject's "ordinal" attribute is set. - */ -bool -CSGObject::isSetOrdinal() const -{ - return mIsSetOrdinal; -} - - -/* - * Sets the value of the "id" attribute of this CSGObject. - */ -int -CSGObject::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "domainType" attribute of this CSGObject. - */ -int -CSGObject::setDomainType(const std::string& domainType) -{ - if (!(SyntaxChecker::isValidInternalSId(domainType))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mDomainType = domainType; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "ordinal" attribute of this CSGObject. - */ -int -CSGObject::setOrdinal(int ordinal) -{ - mOrdinal = ordinal; - mIsSetOrdinal = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this CSGObject. - */ -int -CSGObject::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "domainType" attribute of this CSGObject. - */ -int -CSGObject::unsetDomainType() -{ - mDomainType.erase(); - - if (mDomainType.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "ordinal" attribute of this CSGObject. - */ -int -CSGObject::unsetOrdinal() -{ - mOrdinal = SBML_INT_MAX; - mIsSetOrdinal = false; - - if (isSetOrdinal() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "csgNode" element of this CSGObject. - */ -const CSGNode* -CSGObject::getCSGNode() const -{ - return mCSGNode; -} - - -/* - * Returns the value of the "csgNode" element of this CSGObject. - */ -CSGNode* -CSGObject::getCSGNode() -{ - return mCSGNode; -} - - -/* - * Predicate returning @c true if this CSGObject's "csgNode" element is set. - */ -bool -CSGObject::isSetCSGNode() const -{ - return (mCSGNode != NULL); -} - - -/* - * Sets the value of the "csgNode" element of this CSGObject. - */ -int -CSGObject::setCSGNode(const CSGNode* csgNode) -{ - if (mCSGNode == csgNode) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (csgNode == NULL) - { - delete mCSGNode; - mCSGNode = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mCSGNode; - mCSGNode = (csgNode != NULL) ? csgNode->clone() : NULL; - if (mCSGNode != NULL) - { - mCSGNode->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new CSGPrimitive object, adds it to this CSGObject object and - * returns the CSGPrimitive object created. - */ -CSGPrimitive* -CSGObject::createCSGPrimitive() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGPrimitive(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGTranslation object, adds it to this CSGObject object and - * returns the CSGTranslation object created. - */ -CSGTranslation* -CSGObject::createCSGTranslation() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGTranslation(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGRotation object, adds it to this CSGObject object and - * returns the CSGRotation object created. - */ -CSGRotation* -CSGObject::createCSGRotation() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGRotation(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGScale object, adds it to this CSGObject object and returns - * the CSGScale object created. - */ -CSGScale* -CSGObject::createCSGScale() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGScale(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGHomogeneousTransformation object, adds it to this CSGObject - * object and returns the CSGHomogeneousTransformation object created. - */ -CSGHomogeneousTransformation* -CSGObject::createCSGHomogeneousTransformation() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGHomogeneousTransformation(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGSetOperator object, adds it to this CSGObject object and - * returns the CSGSetOperator object created. - */ -CSGSetOperator* -CSGObject::createCSGSetOperator() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGSetOperator(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Unsets the value of the "csgNode" element of this CSGObject. - */ -int -CSGObject::unsetCSGNode() -{ - delete mCSGNode; - mCSGNode = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -CSGObject::renameSIdRefs(const std::string& oldid, const std::string& newid) -{ - if (isSetDomainType() && mDomainType == oldid) - { - setDomainType(newid); - } -} - - -/* - * Returns the XML element name of this CSGObject object. - */ -const std::string& -CSGObject::getElementName() const -{ - static const string name = "csgObject"; - return name; -} - - -/* - * Returns the libSBML type code for this CSGObject object. - */ -int -CSGObject::getTypeCode() const -{ - return SBML_SPATIAL_CSGOBJECT; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * CSGObject object have been set. - */ -bool -CSGObject::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - if (isSetDomainType() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this CSGObject - * object have been set. - */ -bool -CSGObject::hasRequiredElements() const -{ - bool allPresent = true; - - if (isSetCSGNode() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -CSGObject::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetCSGNode() == true) - { - mCSGNode->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -CSGObject::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mCSGNode != NULL) - { - mCSGNode->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -CSGObject::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mCSGNode != NULL) - { - mCSGNode->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -CSGObject::connectToChild() -{ - SBase::connectToChild(); - - if (mCSGNode != NULL) - { - mCSGNode->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -CSGObject::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetCSGNode()) - { - mCSGNode->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -CSGObject::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mCSGNode != NULL) - { - mCSGNode->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "ordinal") - { - value = getOrdinal(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "domainType") - { - value = getDomainType(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this CSGObject's attribute "attributeName" is - * set. - */ -bool -CSGObject::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "domainType") - { - value = isSetDomainType(); - } - else if (attributeName == "ordinal") - { - value = isSetOrdinal(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "ordinal") - { - return_value = setOrdinal(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "domainType") - { - return_value = setDomainType(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this CSGObject. - */ -int -CSGObject::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "domainType") - { - value = unsetDomainType(); - } - else if (attributeName == "ordinal") - { - value = unsetOrdinal(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this CSGObject. - */ -SBase* -CSGObject::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "csgPrimitive") - { - return createCSGPrimitive(); - } - else if (elementName == "csgTranslation") - { - return createCSGTranslation(); - } - else if (elementName == "csgRotation") - { - return createCSGRotation(); - } - else if (elementName == "csgScale") - { - return createCSGScale(); - } - else if (elementName == "csgHomogeneousTransformation") - { - return createCSGHomogeneousTransformation(); - } - else if (elementName == "csgSetOperator") - { - return createCSGSetOperator(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this CSGObject. - */ -int -CSGObject::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "csgPrimitive" && element->getTypeCode() == - SBML_SPATIAL_CSGPRIMITIVE) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgTranslation" && element->getTypeCode() == - SBML_SPATIAL_CSGTRANSLATION) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgRotation" && element->getTypeCode() == - SBML_SPATIAL_CSGROTATION) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgScale" && element->getTypeCode() == - SBML_SPATIAL_CSGSCALE) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgHomogeneousTransformation" && - element->getTypeCode() == SBML_SPATIAL_CSGHOMOGENEOUSTRANSFORMATION) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgSetOperator" && element->getTypeCode() == - SBML_SPATIAL_CSGSETOPERATOR) - { - return setCSGNode((const CSGNode*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * CSGObject. - */ -SBase* -CSGObject::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "csgPrimitive") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgTranslation") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgRotation") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgScale") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgHomogeneousTransformation") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgSetOperator") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this CSGObject. - */ -unsigned int -CSGObject::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "csgNode") - { - if (isSetCSGNode()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this CSGObject. - */ -SBase* -CSGObject::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "csgNode") - { - return getCSGNode(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -CSGObject::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCSGNode != NULL) - { - if (mCSGNode->getId() == id) - { - return mCSGNode; - } - - obj = mCSGNode->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -CSGObject::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCSGNode != NULL) - { - if (mCSGNode->getMetaId() == metaid) - { - return mCSGNode; - } - - obj = mCSGNode->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -CSGObject::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mCSGNode, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -CSGObject::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - - if (name == "csgPrimitive") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGPrimitive(spatialns); - obj = mCSGNode; - } - else if (name == "csgTranslation") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGTranslation(spatialns); - obj = mCSGNode; - } - else if (name == "csgRotation") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGRotation(spatialns); - obj = mCSGNode; - } - else if (name == "csgScale") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGScale(spatialns); - obj = mCSGNode; - } - else if (name == "csgHomogeneousTransformation") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGHomogeneousTransformation(spatialns); - obj = mCSGNode; - } - else if (name == "csgSetOperator") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGSetOperator(spatialns); - obj = mCSGNode; - } - - delete spatialns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -CSGObject::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("domainType"); - - attributes.add("ordinal"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -CSGObject::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialCSGeometryLOCSGObjectsAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialCSGeometryLOCSGObjectsAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", SpatialCSGObjectAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", SpatialCSGObjectAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'id' is missing from the " - " element."; - log->logPackageError("spatial", SpatialCSGObjectAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } - - // - // domainType SIdRef (use = "required" ) - // - - assigned = attributes.readInto("domainType", mDomainType); - - if (assigned == true) - { - if (mDomainType.empty() == true) - { - logEmptyString(mDomainType, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mDomainType) == false) - { - std::string msg = "The domainType attribute on the <" + getElementName() - + ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mDomainType + "', which does not conform to the " - "syntax."; - log->logPackageError("spatial", - SpatialCSGObjectDomainTypeMustBeDomainType, pkgVersion, level, version, - msg, getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'domainType' is missing from the " - " element."; - log->logPackageError("spatial", SpatialCSGObjectAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } - - // - // ordinal int (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetOrdinal = attributes.readInto("ordinal", mOrdinal); - - if ( mIsSetOrdinal == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Spatial attribute 'ordinal' from the " - "element must be an integer."; - log->logPackageError("spatial", SpatialCSGObjectOrdinalMustBeInteger, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -CSGObject::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetDomainType() == true) - { - stream.writeAttribute("domainType", getPrefix(), mDomainType); - } - - if (isSetOrdinal() == true) - { - stream.writeAttribute("ordinal", getPrefix(), mOrdinal); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new CSGObject_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGObject_t * -CSGObject_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGObject(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this CSGObject_t object. - */ -LIBSBML_EXTERN -CSGObject_t* -CSGObject_clone(const CSGObject_t* csgo) -{ - if (csgo != NULL) - { - return static_cast(csgo->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this CSGObject_t object. - */ -LIBSBML_EXTERN -void -CSGObject_free(CSGObject_t* csgo) -{ - if (csgo != NULL) - { - delete csgo; - } -} - - -/* - * Returns the value of the "id" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -char * -CSGObject_getId(const CSGObject_t * csgo) -{ - if (csgo == NULL) - { - return NULL; - } - - return csgo->getId().empty() ? NULL : safe_strdup(csgo->getId().c_str()); -} - - -/* - * Returns the value of the "domainType" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -char * -CSGObject_getDomainType(const CSGObject_t * csgo) -{ - if (csgo == NULL) - { - return NULL; - } - - return csgo->getDomainType().empty() ? NULL : - safe_strdup(csgo->getDomainType().c_str()); -} - - -/* - * Returns the value of the "ordinal" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_getOrdinal(const CSGObject_t * csgo) -{ - return (csgo != NULL) ? csgo->getOrdinal() : SBML_INT_MAX; -} - - -/* - * Predicate returning @c 1 (true) if this CSGObject_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -CSGObject_isSetId(const CSGObject_t * csgo) -{ - return (csgo != NULL) ? static_cast(csgo->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this CSGObject_t's "domainType" attribute - * is set. - */ -LIBSBML_EXTERN -int -CSGObject_isSetDomainType(const CSGObject_t * csgo) -{ - return (csgo != NULL) ? static_cast(csgo->isSetDomainType()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this CSGObject_t's "ordinal" attribute is - * set. - */ -LIBSBML_EXTERN -int -CSGObject_isSetOrdinal(const CSGObject_t * csgo) -{ - return (csgo != NULL) ? static_cast(csgo->isSetOrdinal()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_setId(CSGObject_t * csgo, const char * id) -{ - return (csgo != NULL) ? csgo->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "domainType" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_setDomainType(CSGObject_t * csgo, const char * domainType) -{ - return (csgo != NULL) ? csgo->setDomainType(domainType) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "ordinal" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_setOrdinal(CSGObject_t * csgo, int ordinal) -{ - return (csgo != NULL) ? csgo->setOrdinal(ordinal) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_unsetId(CSGObject_t * csgo) -{ - return (csgo != NULL) ? csgo->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "domainType" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_unsetDomainType(CSGObject_t * csgo) -{ - return (csgo != NULL) ? csgo->unsetDomainType() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "ordinal" attribute of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_unsetOrdinal(CSGObject_t * csgo) -{ - return (csgo != NULL) ? csgo->unsetOrdinal() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "csgNode" element of this CSGObject_t. - */ -LIBSBML_EXTERN -const CSGNode_t* -CSGObject_getCSGNode(const CSGObject_t * csgo) -{ - if (csgo == NULL) - { - return NULL; - } - - return (CSGNode_t*)(csgo->getCSGNode()); -} - - -/* - * Predicate returning @c 1 (true) if this CSGObject_t's "csgNode" element is - * set. - */ -LIBSBML_EXTERN -int -CSGObject_isSetCSGNode(const CSGObject_t * csgo) -{ - return (csgo != NULL) ? static_cast(csgo->isSetCSGNode()) : 0; -} - - -/* - * Sets the value of the "csgNode" element of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_setCSGNode(CSGObject_t * csgo, const CSGNode_t* csgNode) -{ - return (csgo != NULL) ? csgo->setCSGNode(csgNode) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new CSGPrimitive_t object, adds it to this CSGObject_t object and - * returns the CSGPrimitive_t object created. - */ -LIBSBML_EXTERN -CSGPrimitive_t* -CSGObject_createCSGPrimitive(CSGObject_t* csgo) -{ - return (csgo != NULL) ? csgo->createCSGPrimitive() : NULL; -} - - -/* - * Creates a new CSGTranslation_t object, adds it to this CSGObject_t object - * and returns the CSGTranslation_t object created. - */ -LIBSBML_EXTERN -CSGTranslation_t* -CSGObject_createCSGTranslation(CSGObject_t* csgo) -{ - return (csgo != NULL) ? csgo->createCSGTranslation() : NULL; -} - - -/* - * Creates a new CSGRotation_t object, adds it to this CSGObject_t object and - * returns the CSGRotation_t object created. - */ -LIBSBML_EXTERN -CSGRotation_t* -CSGObject_createCSGRotation(CSGObject_t* csgo) -{ - return (csgo != NULL) ? csgo->createCSGRotation() : NULL; -} - - -/* - * Creates a new CSGScale_t object, adds it to this CSGObject_t object and - * returns the CSGScale_t object created. - */ -LIBSBML_EXTERN -CSGScale_t* -CSGObject_createCSGScale(CSGObject_t* csgo) -{ - return (csgo != NULL) ? csgo->createCSGScale() : NULL; -} - - -/* - * Creates a new CSGHomogeneousTransformation_t object, adds it to this - * CSGObject_t object and returns the CSGHomogeneousTransformation_t object - * created. - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t* -CSGObject_createCSGHomogeneousTransformation(CSGObject_t* csgo) -{ - return (csgo != NULL) ? csgo->createCSGHomogeneousTransformation() : NULL; -} - - -/* - * Creates a new CSGSetOperator_t object, adds it to this CSGObject_t object - * and returns the CSGSetOperator_t object created. - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGObject_createCSGSetOperator(CSGObject_t* csgo) -{ - return (csgo != NULL) ? csgo->createCSGSetOperator() : NULL; -} - - -/* - * Unsets the value of the "csgNode" element of this CSGObject_t. - */ -LIBSBML_EXTERN -int -CSGObject_unsetCSGNode(CSGObject_t * csgo) -{ - return (csgo != NULL) ? csgo->unsetCSGNode() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGObject_t object have been set. - */ -LIBSBML_EXTERN -int -CSGObject_hasRequiredAttributes(const CSGObject_t * csgo) -{ - return (csgo != NULL) ? static_cast(csgo->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * CSGObject_t object have been set. - */ -LIBSBML_EXTERN -int -CSGObject_hasRequiredElements(const CSGObject_t * csgo) -{ - return (csgo != NULL) ? static_cast(csgo->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file CSGObject.cpp + * @brief Implementation of the CSGObject class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CSGObject using the given SBML Level, Version and + * “spatial” package version. + */ +CSGObject::CSGObject(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mDomainType ("") + , mOrdinal (SBML_INT_MAX) + , mIsSetOrdinal (false) + , mCSGNode (NULL) +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new CSGObject using the given SpatialPkgNamespaces object. + */ +CSGObject::CSGObject(SpatialPkgNamespaces *spatialns) + : SBase(spatialns) + , mDomainType ("") + , mOrdinal (SBML_INT_MAX) + , mIsSetOrdinal (false) + , mCSGNode (NULL) +{ + setElementNamespace(spatialns->getURI()); + connectToChild(); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for CSGObject. + */ +CSGObject::CSGObject(const CSGObject& orig) + : SBase( orig ) + , mDomainType ( orig.mDomainType ) + , mOrdinal ( orig.mOrdinal ) + , mIsSetOrdinal ( orig.mIsSetOrdinal ) + , mCSGNode ( NULL ) +{ + if (orig.mCSGNode != NULL) + { + mCSGNode = orig.mCSGNode->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for CSGObject. + */ +CSGObject& +CSGObject::operator=(const CSGObject& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mDomainType = rhs.mDomainType; + mOrdinal = rhs.mOrdinal; + mIsSetOrdinal = rhs.mIsSetOrdinal; + delete mCSGNode; + if (rhs.mCSGNode != NULL) + { + mCSGNode = rhs.mCSGNode->clone(); + } + else + { + mCSGNode = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CSGObject object. + */ +CSGObject* +CSGObject::clone() const +{ + return new CSGObject(*this); +} + + +/* + * Destructor for CSGObject. + */ +CSGObject::~CSGObject() +{ + delete mCSGNode; + mCSGNode = NULL; +} + + +/* + * Returns the value of the "id" attribute of this CSGObject. + */ +const std::string& +CSGObject::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "domainType" attribute of this CSGObject. + */ +const std::string& +CSGObject::getDomainType() const +{ + return mDomainType; +} + + +/* + * Returns the value of the "ordinal" attribute of this CSGObject. + */ +int +CSGObject::getOrdinal() const +{ + return mOrdinal; +} + + +/* + * Predicate returning @c true if this CSGObject's "id" attribute is set. + */ +bool +CSGObject::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this CSGObject's "domainType" attribute is + * set. + */ +bool +CSGObject::isSetDomainType() const +{ + return (mDomainType.empty() == false); +} + + +/* + * Predicate returning @c true if this CSGObject's "ordinal" attribute is set. + */ +bool +CSGObject::isSetOrdinal() const +{ + return mIsSetOrdinal; +} + + +/* + * Sets the value of the "id" attribute of this CSGObject. + */ +int +CSGObject::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "domainType" attribute of this CSGObject. + */ +int +CSGObject::setDomainType(const std::string& domainType) +{ + if (!(SyntaxChecker::isValidInternalSId(domainType))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mDomainType = domainType; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "ordinal" attribute of this CSGObject. + */ +int +CSGObject::setOrdinal(int ordinal) +{ + mOrdinal = ordinal; + mIsSetOrdinal = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "id" attribute of this CSGObject. + */ +int +CSGObject::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "domainType" attribute of this CSGObject. + */ +int +CSGObject::unsetDomainType() +{ + mDomainType.erase(); + + if (mDomainType.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "ordinal" attribute of this CSGObject. + */ +int +CSGObject::unsetOrdinal() +{ + mOrdinal = SBML_INT_MAX; + mIsSetOrdinal = false; + + if (isSetOrdinal() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "csgNode" element of this CSGObject. + */ +const CSGNode* +CSGObject::getCSGNode() const +{ + return mCSGNode; +} + + +/* + * Returns the value of the "csgNode" element of this CSGObject. + */ +CSGNode* +CSGObject::getCSGNode() +{ + return mCSGNode; +} + + +/* + * Predicate returning @c true if this CSGObject's "csgNode" element is set. + */ +bool +CSGObject::isSetCSGNode() const +{ + return (mCSGNode != NULL); +} + + +/* + * Sets the value of the "csgNode" element of this CSGObject. + */ +int +CSGObject::setCSGNode(const CSGNode* csgNode) +{ + if (mCSGNode == csgNode) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (csgNode == NULL) + { + delete mCSGNode; + mCSGNode = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mCSGNode; + mCSGNode = (csgNode != NULL) ? csgNode->clone() : NULL; + if (mCSGNode != NULL) + { + mCSGNode->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new CSGPrimitive object, adds it to this CSGObject object and + * returns the CSGPrimitive object created. + */ +CSGPrimitive* +CSGObject::createCSGPrimitive() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGPrimitive(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGTranslation object, adds it to this CSGObject object and + * returns the CSGTranslation object created. + */ +CSGTranslation* +CSGObject::createCSGTranslation() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGTranslation(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGRotation object, adds it to this CSGObject object and + * returns the CSGRotation object created. + */ +CSGRotation* +CSGObject::createCSGRotation() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGRotation(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGScale object, adds it to this CSGObject object and returns + * the CSGScale object created. + */ +CSGScale* +CSGObject::createCSGScale() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGScale(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGHomogeneousTransformation object, adds it to this CSGObject + * object and returns the CSGHomogeneousTransformation object created. + */ +CSGHomogeneousTransformation* +CSGObject::createCSGHomogeneousTransformation() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGHomogeneousTransformation(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGSetOperator object, adds it to this CSGObject object and + * returns the CSGSetOperator object created. + */ +CSGSetOperator* +CSGObject::createCSGSetOperator() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGSetOperator(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Unsets the value of the "csgNode" element of this CSGObject. + */ +int +CSGObject::unsetCSGNode() +{ + delete mCSGNode; + mCSGNode = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +CSGObject::renameSIdRefs(const std::string& oldid, const std::string& newid) +{ + if (isSetDomainType() && mDomainType == oldid) + { + setDomainType(newid); + } +} + + +/* + * Returns the XML element name of this CSGObject object. + */ +const std::string& +CSGObject::getElementName() const +{ + static const string name = "csgObject"; + return name; +} + + +/* + * Returns the libSBML type code for this CSGObject object. + */ +int +CSGObject::getTypeCode() const +{ + return SBML_SPATIAL_CSGOBJECT; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CSGObject object have been set. + */ +bool +CSGObject::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + if (isSetDomainType() == false) + { + allPresent = false; + } + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this CSGObject + * object have been set. + */ +bool +CSGObject::hasRequiredElements() const +{ + bool allPresent = true; + + if (isSetCSGNode() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +CSGObject::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetCSGNode() == true) + { + mCSGNode->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +CSGObject::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mCSGNode != NULL) + { + mCSGNode->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +CSGObject::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mCSGNode != NULL) + { + mCSGNode->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +CSGObject::connectToChild() +{ + SBase::connectToChild(); + + if (mCSGNode != NULL) + { + mCSGNode->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +CSGObject::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetCSGNode()) + { + mCSGNode->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +CSGObject::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mCSGNode != NULL) + { + mCSGNode->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "ordinal") + { + value = getOrdinal(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "domainType") + { + value = getDomainType(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this CSGObject's attribute "attributeName" is + * set. + */ +bool +CSGObject::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "domainType") + { + value = isSetDomainType(); + } + else if (attributeName == "ordinal") + { + value = isSetOrdinal(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "ordinal") + { + return_value = setOrdinal(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "domainType") + { + return_value = setDomainType(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CSGObject. + */ +int +CSGObject::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "domainType") + { + value = unsetDomainType(); + } + else if (attributeName == "ordinal") + { + value = unsetOrdinal(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this CSGObject. + */ +SBase* +CSGObject::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "csgPrimitive") + { + return createCSGPrimitive(); + } + else if (elementName == "csgTranslation") + { + return createCSGTranslation(); + } + else if (elementName == "csgRotation") + { + return createCSGRotation(); + } + else if (elementName == "csgScale") + { + return createCSGScale(); + } + else if (elementName == "csgHomogeneousTransformation") + { + return createCSGHomogeneousTransformation(); + } + else if (elementName == "csgSetOperator") + { + return createCSGSetOperator(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this CSGObject. + */ +int +CSGObject::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "csgPrimitive" && element->getTypeCode() == + SBML_SPATIAL_CSGPRIMITIVE) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgTranslation" && element->getTypeCode() == + SBML_SPATIAL_CSGTRANSLATION) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgRotation" && element->getTypeCode() == + SBML_SPATIAL_CSGROTATION) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgScale" && element->getTypeCode() == + SBML_SPATIAL_CSGSCALE) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgHomogeneousTransformation" && + element->getTypeCode() == SBML_SPATIAL_CSGHOMOGENEOUSTRANSFORMATION) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgSetOperator" && element->getTypeCode() == + SBML_SPATIAL_CSGSETOPERATOR) + { + return setCSGNode((const CSGNode*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CSGObject. + */ +SBase* +CSGObject::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "csgPrimitive") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgTranslation") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgRotation") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgScale") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgHomogeneousTransformation") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgSetOperator") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this CSGObject. + */ +unsigned int +CSGObject::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "csgNode") + { + if (isSetCSGNode()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this CSGObject. + */ +SBase* +CSGObject::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "csgNode") + { + return getCSGNode(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +CSGObject::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCSGNode != NULL) + { + if (mCSGNode->getId() == id) + { + return mCSGNode; + } + + obj = mCSGNode->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +CSGObject::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCSGNode != NULL) + { + if (mCSGNode->getMetaId() == metaid) + { + return mCSGNode; + } + + obj = mCSGNode->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +CSGObject::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mCSGNode, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +CSGObject::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + + if (name == "csgPrimitive") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGPrimitive(spatialns); + obj = mCSGNode; + } + else if (name == "csgTranslation") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGTranslation(spatialns); + obj = mCSGNode; + } + else if (name == "csgRotation") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGRotation(spatialns); + obj = mCSGNode; + } + else if (name == "csgScale") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGScale(spatialns); + obj = mCSGNode; + } + else if (name == "csgHomogeneousTransformation") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGHomogeneousTransformation(spatialns); + obj = mCSGNode; + } + else if (name == "csgSetOperator") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGObjectAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGSetOperator(spatialns); + obj = mCSGNode; + } + + delete spatialns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CSGObject::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("domainType"); + + attributes.add("ordinal"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CSGObject::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialCSGeometryLOCSGObjectsAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialCSGeometryLOCSGObjectsAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", SpatialCSGObjectAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", SpatialCSGObjectAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'id' is missing from the " + " element."; + log->logPackageError("spatial", SpatialCSGObjectAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } + + // + // domainType SIdRef (use = "required" ) + // + + assigned = attributes.readInto("domainType", mDomainType); + + if (assigned == true) + { + if (mDomainType.empty() == true) + { + logEmptyString(mDomainType, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mDomainType) == false) + { + std::string msg = "The domainType attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mDomainType + "', which does not conform to the " + "syntax."; + log->logPackageError("spatial", + SpatialCSGObjectDomainTypeMustBeDomainType, pkgVersion, level, version, + msg, getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'domainType' is missing from the " + " element."; + log->logPackageError("spatial", SpatialCSGObjectAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } + + // + // ordinal int (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetOrdinal = attributes.readInto("ordinal", mOrdinal); + + if ( mIsSetOrdinal == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Spatial attribute 'ordinal' from the " + "element must be an integer."; + log->logPackageError("spatial", SpatialCSGObjectOrdinalMustBeInteger, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +CSGObject::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetDomainType() == true) + { + stream.writeAttribute("domainType", getPrefix(), mDomainType); + } + + if (isSetOrdinal() == true) + { + stream.writeAttribute("ordinal", getPrefix(), mOrdinal); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CSGObject_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGObject_t * +CSGObject_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGObject(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this CSGObject_t object. + */ +LIBSBML_EXTERN +CSGObject_t* +CSGObject_clone(const CSGObject_t* csgo) +{ + if (csgo != NULL) + { + return static_cast(csgo->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CSGObject_t object. + */ +LIBSBML_EXTERN +void +CSGObject_free(CSGObject_t* csgo) +{ + if (csgo != NULL) + { + delete csgo; + } +} + + +/* + * Returns the value of the "id" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +char * +CSGObject_getId(const CSGObject_t * csgo) +{ + if (csgo == NULL) + { + return NULL; + } + + return csgo->getId().empty() ? NULL : safe_strdup(csgo->getId().c_str()); +} + + +/* + * Returns the value of the "domainType" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +char * +CSGObject_getDomainType(const CSGObject_t * csgo) +{ + if (csgo == NULL) + { + return NULL; + } + + return csgo->getDomainType().empty() ? NULL : + safe_strdup(csgo->getDomainType().c_str()); +} + + +/* + * Returns the value of the "ordinal" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_getOrdinal(const CSGObject_t * csgo) +{ + return (csgo != NULL) ? csgo->getOrdinal() : SBML_INT_MAX; +} + + +/* + * Predicate returning @c 1 (true) if this CSGObject_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +CSGObject_isSetId(const CSGObject_t * csgo) +{ + return (csgo != NULL) ? static_cast(csgo->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this CSGObject_t's "domainType" attribute + * is set. + */ +LIBSBML_EXTERN +int +CSGObject_isSetDomainType(const CSGObject_t * csgo) +{ + return (csgo != NULL) ? static_cast(csgo->isSetDomainType()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this CSGObject_t's "ordinal" attribute is + * set. + */ +LIBSBML_EXTERN +int +CSGObject_isSetOrdinal(const CSGObject_t * csgo) +{ + return (csgo != NULL) ? static_cast(csgo->isSetOrdinal()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_setId(CSGObject_t * csgo, const char * id) +{ + return (csgo != NULL) ? csgo->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "domainType" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_setDomainType(CSGObject_t * csgo, const char * domainType) +{ + return (csgo != NULL) ? csgo->setDomainType(domainType) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "ordinal" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_setOrdinal(CSGObject_t * csgo, int ordinal) +{ + return (csgo != NULL) ? csgo->setOrdinal(ordinal) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_unsetId(CSGObject_t * csgo) +{ + return (csgo != NULL) ? csgo->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "domainType" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_unsetDomainType(CSGObject_t * csgo) +{ + return (csgo != NULL) ? csgo->unsetDomainType() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "ordinal" attribute of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_unsetOrdinal(CSGObject_t * csgo) +{ + return (csgo != NULL) ? csgo->unsetOrdinal() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "csgNode" element of this CSGObject_t. + */ +LIBSBML_EXTERN +const CSGNode_t* +CSGObject_getCSGNode(const CSGObject_t * csgo) +{ + if (csgo == NULL) + { + return NULL; + } + + return (CSGNode_t*)(csgo->getCSGNode()); +} + + +/* + * Predicate returning @c 1 (true) if this CSGObject_t's "csgNode" element is + * set. + */ +LIBSBML_EXTERN +int +CSGObject_isSetCSGNode(const CSGObject_t * csgo) +{ + return (csgo != NULL) ? static_cast(csgo->isSetCSGNode()) : 0; +} + + +/* + * Sets the value of the "csgNode" element of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_setCSGNode(CSGObject_t * csgo, const CSGNode_t* csgNode) +{ + return (csgo != NULL) ? csgo->setCSGNode(csgNode) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new CSGPrimitive_t object, adds it to this CSGObject_t object and + * returns the CSGPrimitive_t object created. + */ +LIBSBML_EXTERN +CSGPrimitive_t* +CSGObject_createCSGPrimitive(CSGObject_t* csgo) +{ + return (csgo != NULL) ? csgo->createCSGPrimitive() : NULL; +} + + +/* + * Creates a new CSGTranslation_t object, adds it to this CSGObject_t object + * and returns the CSGTranslation_t object created. + */ +LIBSBML_EXTERN +CSGTranslation_t* +CSGObject_createCSGTranslation(CSGObject_t* csgo) +{ + return (csgo != NULL) ? csgo->createCSGTranslation() : NULL; +} + + +/* + * Creates a new CSGRotation_t object, adds it to this CSGObject_t object and + * returns the CSGRotation_t object created. + */ +LIBSBML_EXTERN +CSGRotation_t* +CSGObject_createCSGRotation(CSGObject_t* csgo) +{ + return (csgo != NULL) ? csgo->createCSGRotation() : NULL; +} + + +/* + * Creates a new CSGScale_t object, adds it to this CSGObject_t object and + * returns the CSGScale_t object created. + */ +LIBSBML_EXTERN +CSGScale_t* +CSGObject_createCSGScale(CSGObject_t* csgo) +{ + return (csgo != NULL) ? csgo->createCSGScale() : NULL; +} + + +/* + * Creates a new CSGHomogeneousTransformation_t object, adds it to this + * CSGObject_t object and returns the CSGHomogeneousTransformation_t object + * created. + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t* +CSGObject_createCSGHomogeneousTransformation(CSGObject_t* csgo) +{ + return (csgo != NULL) ? csgo->createCSGHomogeneousTransformation() : NULL; +} + + +/* + * Creates a new CSGSetOperator_t object, adds it to this CSGObject_t object + * and returns the CSGSetOperator_t object created. + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGObject_createCSGSetOperator(CSGObject_t* csgo) +{ + return (csgo != NULL) ? csgo->createCSGSetOperator() : NULL; +} + + +/* + * Unsets the value of the "csgNode" element of this CSGObject_t. + */ +LIBSBML_EXTERN +int +CSGObject_unsetCSGNode(CSGObject_t * csgo) +{ + return (csgo != NULL) ? csgo->unsetCSGNode() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGObject_t object have been set. + */ +LIBSBML_EXTERN +int +CSGObject_hasRequiredAttributes(const CSGObject_t * csgo) +{ + return (csgo != NULL) ? static_cast(csgo->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * CSGObject_t object have been set. + */ +LIBSBML_EXTERN +int +CSGObject_hasRequiredElements(const CSGObject_t * csgo) +{ + return (csgo != NULL) ? static_cast(csgo->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/CSGObject.h b/generator/tests/test_cpp_code/test-code/CSGObject.h index e1c3a8ae..5595e667 100644 --- a/generator/tests/test_cpp_code/test-code/CSGObject.h +++ b/generator/tests/test_cpp_code/test-code/CSGObject.h @@ -1,1432 +1,1432 @@ -/** - * @file CSGObject.h - * @brief Definition of the CSGObject class. - * @author SBMLTeam - * - * - * - * @class CSGObject - * @sbmlbrief{spatial} TODO:Definition of the CSGObject class. - */ - - -#ifndef CSGObject_H__ -#define CSGObject_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN CSGObject : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - std::string mDomainType; - int mOrdinal; - bool mIsSetOrdinal; - CSGNode* mCSGNode; - - /** @endcond */ - -public: - - /** - * Creates a new CSGObject using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGObject. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGObject. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGObject. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGObject(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new CSGObject using the given SpatialPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGObject(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for CSGObject. - * - * @param orig the CSGObject instance to copy. - */ - CSGObject(const CSGObject& orig); - - - /** - * Assignment operator for CSGObject. - * - * @param rhs the CSGObject object whose values are to be used as the basis - * of the assignment. - */ - CSGObject& operator=(const CSGObject& rhs); - - - /** - * Creates and returns a deep copy of this CSGObject object. - * - * @return a (deep) copy of this CSGObject object. - */ - virtual CSGObject* clone() const; - - - /** - * Destructor for CSGObject. - */ - virtual ~CSGObject(); - - - /** - * Returns the value of the "id" attribute of this CSGObject. - * - * @return the value of the "id" attribute of this CSGObject as a string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "domainType" attribute of this CSGObject. - * - * @return the value of the "domainType" attribute of this CSGObject as a - * string. - */ - const std::string& getDomainType() const; - - - /** - * Returns the value of the "ordinal" attribute of this CSGObject. - * - * @return the value of the "ordinal" attribute of this CSGObject as a - * integer. - */ - int getOrdinal() const; - - - /** - * Predicate returning @c true if this CSGObject's "id" attribute is set. - * - * @return @c true if this CSGObject's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this CSGObject's "domainType" attribute is - * set. - * - * @return @c true if this CSGObject's "domainType" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetDomainType() const; - - - /** - * Predicate returning @c true if this CSGObject's "ordinal" attribute is - * set. - * - * @return @c true if this CSGObject's "ordinal" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetOrdinal() const; - - - /** - * Sets the value of the "id" attribute of this CSGObject. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "domainType" attribute of this CSGObject. - * - * @param domainType std::string& value of the "domainType" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setDomainType(const std::string& domainType); - - - /** - * Sets the value of the "ordinal" attribute of this CSGObject. - * - * @param ordinal int value of the "ordinal" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setOrdinal(int ordinal); - - - /** - * Unsets the value of the "id" attribute of this CSGObject. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "domainType" attribute of this CSGObject. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetDomainType(); - - - /** - * Unsets the value of the "ordinal" attribute of this CSGObject. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetOrdinal(); - - - /** - * Returns the value of the "csgNode" element of this CSGObject. - * - * @return the value of the "csgNode" element of this CSGObject as a - * CSGNode*. - */ - const CSGNode* getCSGNode() const; - - - /** - * Returns the value of the "csgNode" element of this CSGObject. - * - * @return the value of the "csgNode" element of this CSGObject as a - * CSGNode*. - */ - CSGNode* getCSGNode(); - - - /** - * Predicate returning @c true if this CSGObject's "csgNode" element is set. - * - * @return @c true if this CSGObject's "csgNode" element has been set, - * otherwise @c false is returned. - */ - bool isSetCSGNode() const; - - - /** - * Sets the value of the "csgNode" element of this CSGObject. - * - * @param csgNode CSGNode* value of the "csgNode" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setCSGNode(const CSGNode* csgNode); - - - /** - * Creates a new CSGPrimitive object, adds it to this CSGObject object and - * returns the CSGPrimitive object created. - * - * @return a new CSGPrimitive object instance. - */ - CSGPrimitive* createCSGPrimitive(); - - - /** - * Creates a new CSGTranslation object, adds it to this CSGObject object and - * returns the CSGTranslation object created. - * - * @return a new CSGTranslation object instance. - */ - CSGTranslation* createCSGTranslation(); - - - /** - * Creates a new CSGRotation object, adds it to this CSGObject object and - * returns the CSGRotation object created. - * - * @return a new CSGRotation object instance. - */ - CSGRotation* createCSGRotation(); - - - /** - * Creates a new CSGScale object, adds it to this CSGObject object and - * returns the CSGScale object created. - * - * @return a new CSGScale object instance. - */ - CSGScale* createCSGScale(); - - - /** - * Creates a new CSGHomogeneousTransformation object, adds it to this - * CSGObject object and returns the CSGHomogeneousTransformation object - * created. - * - * @return a new CSGHomogeneousTransformation object instance. - */ - CSGHomogeneousTransformation* createCSGHomogeneousTransformation(); - - - /** - * Creates a new CSGSetOperator object, adds it to this CSGObject object and - * returns the CSGSetOperator object created. - * - * @return a new CSGSetOperator object instance. - */ - CSGSetOperator* createCSGSetOperator(); - - - /** - * Unsets the value of the "csgNode" element of this CSGObject. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetCSGNode(); - - - /** - * @copydoc doc_renamesidref_common - */ - virtual void renameSIdRefs(const std::string& oldid, - const std::string& newid); - - - /** - * Returns the XML element name of this CSGObject object. - * - * For CSGObject, the XML element name is always @c "csgObject". - * - * @return the name of this element, i.e. @c "csgObject". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this CSGObject object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_CSGOBJECT, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * CSGObject object have been set. - * - * @return @c true to indicate that all the required attributes of this - * CSGObject have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the CSGObject object are: - * @li "id" - * @li "domainType" - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * CSGObject object have been set. - * - * @return @c true to indicate that all the required elements of this - * CSGObject have been set, otherwise @c false is returned. - * - * - * @note The required elements for the CSGObject object are: - * @li "csgNode" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this CSGObject's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this CSGObject's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this CSGObject. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this CSGObject. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this CSGObject. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * CSGObject. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this CSGObject. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this CSGObject. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new CSGObject_t using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGObject_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGObject_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGObject_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGObject_t * -CSGObject_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this CSGObject_t object. - * - * @param csgo the CSGObject_t structure. - * - * @return a (deep) copy of this CSGObject_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGObject_t* -CSGObject_clone(const CSGObject_t* csgo); - - -/** - * Frees this CSGObject_t object. - * - * @param csgo the CSGObject_t structure. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -void -CSGObject_free(CSGObject_t* csgo); - - -/** - * Returns the value of the "id" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure whose id is sought. - * - * @return the value of the "id" attribute of this CSGObject_t as a pointer to - * a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -char * -CSGObject_getId(const CSGObject_t * csgo); - - -/** - * Returns the value of the "domainType" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure whose domainType is sought. - * - * @return the value of the "domainType" attribute of this CSGObject_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -char * -CSGObject_getDomainType(const CSGObject_t * csgo); - - -/** - * Returns the value of the "ordinal" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure whose ordinal is sought. - * - * @return the value of the "ordinal" attribute of this CSGObject_t as a - * integer. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_getOrdinal(const CSGObject_t * csgo); - - -/** - * Predicate returning @c 1 (true) if this CSGObject_t's "id" attribute is set. - * - * @param csgo the CSGObject_t structure. - * - * @return @c 1 (true) if this CSGObject_t's "id" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_isSetId(const CSGObject_t * csgo); - - -/** - * Predicate returning @c 1 (true) if this CSGObject_t's "domainType" attribute - * is set. - * - * @param csgo the CSGObject_t structure. - * - * @return @c 1 (true) if this CSGObject_t's "domainType" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_isSetDomainType(const CSGObject_t * csgo); - - -/** - * Predicate returning @c 1 (true) if this CSGObject_t's "ordinal" attribute is - * set. - * - * @param csgo the CSGObject_t structure. - * - * @return @c 1 (true) if this CSGObject_t's "ordinal" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_isSetOrdinal(const CSGObject_t * csgo); - - -/** - * Sets the value of the "id" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling CSGObject_unsetId(). - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_setId(CSGObject_t * csgo, const char * id); - - -/** - * Sets the value of the "domainType" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @param domainType const char * value of the "domainType" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_setDomainType(CSGObject_t * csgo, const char * domainType); - - -/** - * Sets the value of the "ordinal" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @param ordinal int value of the "ordinal" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_setOrdinal(CSGObject_t * csgo, int ordinal); - - -/** - * Unsets the value of the "id" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_unsetId(CSGObject_t * csgo); - - -/** - * Unsets the value of the "domainType" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_unsetDomainType(CSGObject_t * csgo); - - -/** - * Unsets the value of the "ordinal" attribute of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_unsetOrdinal(CSGObject_t * csgo); - - -/** - * Returns the value of the "csgNode" element of this CSGObject_t. - * - * @param csgo the CSGObject_t structure whose csgNode is sought. - * - * @return the value of the "csgNode" element of this CSGObject_t as a - * CSGNode*. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -const CSGNode_t* -CSGObject_getCSGNode(const CSGObject_t * csgo); - - -/** - * Predicate returning @c 1 (true) if this CSGObject_t's "csgNode" element is - * set. - * - * @param csgo the CSGObject_t structure. - * - * @return @c 1 (true) if this CSGObject_t's "csgNode" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_isSetCSGNode(const CSGObject_t * csgo); - - -/** - * Sets the value of the "csgNode" element of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @param csgNode CSGNode_t* value of the "csgNode" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_setCSGNode(CSGObject_t * csgo, const CSGNode_t* csgNode); - - -/** - * Creates a new CSGPrimitive_t object, adds it to this CSGObject_t object and - * returns the CSGPrimitive_t object created. - * - * @param csgo the CSGObject_t structure to which the CSGPrimitive_t should be - * added. - * - * @return a new CSGPrimitive_t object instance. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGPrimitive_t* -CSGObject_createCSGPrimitive(CSGObject_t* csgo); - - -/** - * Creates a new CSGTranslation_t object, adds it to this CSGObject_t object - * and returns the CSGTranslation_t object created. - * - * @param csgo the CSGObject_t structure to which the CSGTranslation_t should - * be added. - * - * @return a new CSGTranslation_t object instance. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGTranslation_t* -CSGObject_createCSGTranslation(CSGObject_t* csgo); - - -/** - * Creates a new CSGRotation_t object, adds it to this CSGObject_t object and - * returns the CSGRotation_t object created. - * - * @param csgo the CSGObject_t structure to which the CSGRotation_t should be - * added. - * - * @return a new CSGRotation_t object instance. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGRotation_t* -CSGObject_createCSGRotation(CSGObject_t* csgo); - - -/** - * Creates a new CSGScale_t object, adds it to this CSGObject_t object and - * returns the CSGScale_t object created. - * - * @param csgo the CSGObject_t structure to which the CSGScale_t should be - * added. - * - * @return a new CSGScale_t object instance. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGScale_t* -CSGObject_createCSGScale(CSGObject_t* csgo); - - -/** - * Creates a new CSGHomogeneousTransformation_t object, adds it to this - * CSGObject_t object and returns the CSGHomogeneousTransformation_t object - * created. - * - * @param csgo the CSGObject_t structure to which the - * CSGHomogeneousTransformation_t should be added. - * - * @return a new CSGHomogeneousTransformation_t object instance. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t* -CSGObject_createCSGHomogeneousTransformation(CSGObject_t* csgo); - - -/** - * Creates a new CSGSetOperator_t object, adds it to this CSGObject_t object - * and returns the CSGSetOperator_t object created. - * - * @param csgo the CSGObject_t structure to which the CSGSetOperator_t should - * be added. - * - * @return a new CSGSetOperator_t object instance. - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGObject_createCSGSetOperator(CSGObject_t* csgo); - - -/** - * Unsets the value of the "csgNode" element of this CSGObject_t. - * - * @param csgo the CSGObject_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_unsetCSGNode(CSGObject_t * csgo); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGObject_t object have been set. - * - * @param csgo the CSGObject_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * CSGObject_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the CSGObject_t object are: - * @li "id" - * @li "domainType" - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_hasRequiredAttributes(const CSGObject_t * csgo); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * CSGObject_t object have been set. - * - * @param csgo the CSGObject_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * CSGObject_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the CSGObject_t object are: - * @li "csgNode" - * - * @memberof CSGObject_t - */ -LIBSBML_EXTERN -int -CSGObject_hasRequiredElements(const CSGObject_t * csgo); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !CSGObject_H__ */ - - +/** + * @file CSGObject.h + * @brief Definition of the CSGObject class. + * @author SBMLTeam + * + * + * + * @class CSGObject + * @sbmlbrief{spatial} TODO:Definition of the CSGObject class. + */ + + +#ifndef CSGObject_H__ +#define CSGObject_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN CSGObject : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + std::string mDomainType; + int mOrdinal; + bool mIsSetOrdinal; + CSGNode* mCSGNode; + + /** @endcond */ + +public: + + /** + * Creates a new CSGObject using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGObject. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGObject. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGObject. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGObject(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new CSGObject using the given SpatialPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGObject(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for CSGObject. + * + * @param orig the CSGObject instance to copy. + */ + CSGObject(const CSGObject& orig); + + + /** + * Assignment operator for CSGObject. + * + * @param rhs the CSGObject object whose values are to be used as the basis + * of the assignment. + */ + CSGObject& operator=(const CSGObject& rhs); + + + /** + * Creates and returns a deep copy of this CSGObject object. + * + * @return a (deep) copy of this CSGObject object. + */ + virtual CSGObject* clone() const; + + + /** + * Destructor for CSGObject. + */ + virtual ~CSGObject(); + + + /** + * Returns the value of the "id" attribute of this CSGObject. + * + * @return the value of the "id" attribute of this CSGObject as a string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "domainType" attribute of this CSGObject. + * + * @return the value of the "domainType" attribute of this CSGObject as a + * string. + */ + const std::string& getDomainType() const; + + + /** + * Returns the value of the "ordinal" attribute of this CSGObject. + * + * @return the value of the "ordinal" attribute of this CSGObject as a + * integer. + */ + int getOrdinal() const; + + + /** + * Predicate returning @c true if this CSGObject's "id" attribute is set. + * + * @return @c true if this CSGObject's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this CSGObject's "domainType" attribute is + * set. + * + * @return @c true if this CSGObject's "domainType" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetDomainType() const; + + + /** + * Predicate returning @c true if this CSGObject's "ordinal" attribute is + * set. + * + * @return @c true if this CSGObject's "ordinal" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetOrdinal() const; + + + /** + * Sets the value of the "id" attribute of this CSGObject. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "domainType" attribute of this CSGObject. + * + * @param domainType std::string& value of the "domainType" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setDomainType(const std::string& domainType); + + + /** + * Sets the value of the "ordinal" attribute of this CSGObject. + * + * @param ordinal int value of the "ordinal" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setOrdinal(int ordinal); + + + /** + * Unsets the value of the "id" attribute of this CSGObject. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "domainType" attribute of this CSGObject. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetDomainType(); + + + /** + * Unsets the value of the "ordinal" attribute of this CSGObject. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetOrdinal(); + + + /** + * Returns the value of the "csgNode" element of this CSGObject. + * + * @return the value of the "csgNode" element of this CSGObject as a + * CSGNode*. + */ + const CSGNode* getCSGNode() const; + + + /** + * Returns the value of the "csgNode" element of this CSGObject. + * + * @return the value of the "csgNode" element of this CSGObject as a + * CSGNode*. + */ + CSGNode* getCSGNode(); + + + /** + * Predicate returning @c true if this CSGObject's "csgNode" element is set. + * + * @return @c true if this CSGObject's "csgNode" element has been set, + * otherwise @c false is returned. + */ + bool isSetCSGNode() const; + + + /** + * Sets the value of the "csgNode" element of this CSGObject. + * + * @param csgNode CSGNode* value of the "csgNode" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setCSGNode(const CSGNode* csgNode); + + + /** + * Creates a new CSGPrimitive object, adds it to this CSGObject object and + * returns the CSGPrimitive object created. + * + * @return a new CSGPrimitive object instance. + */ + CSGPrimitive* createCSGPrimitive(); + + + /** + * Creates a new CSGTranslation object, adds it to this CSGObject object and + * returns the CSGTranslation object created. + * + * @return a new CSGTranslation object instance. + */ + CSGTranslation* createCSGTranslation(); + + + /** + * Creates a new CSGRotation object, adds it to this CSGObject object and + * returns the CSGRotation object created. + * + * @return a new CSGRotation object instance. + */ + CSGRotation* createCSGRotation(); + + + /** + * Creates a new CSGScale object, adds it to this CSGObject object and + * returns the CSGScale object created. + * + * @return a new CSGScale object instance. + */ + CSGScale* createCSGScale(); + + + /** + * Creates a new CSGHomogeneousTransformation object, adds it to this + * CSGObject object and returns the CSGHomogeneousTransformation object + * created. + * + * @return a new CSGHomogeneousTransformation object instance. + */ + CSGHomogeneousTransformation* createCSGHomogeneousTransformation(); + + + /** + * Creates a new CSGSetOperator object, adds it to this CSGObject object and + * returns the CSGSetOperator object created. + * + * @return a new CSGSetOperator object instance. + */ + CSGSetOperator* createCSGSetOperator(); + + + /** + * Unsets the value of the "csgNode" element of this CSGObject. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetCSGNode(); + + + /** + * @copydoc doc_renamesidref_common + */ + virtual void renameSIdRefs(const std::string& oldid, + const std::string& newid); + + + /** + * Returns the XML element name of this CSGObject object. + * + * For CSGObject, the XML element name is always @c "csgObject". + * + * @return the name of this element, i.e. @c "csgObject". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this CSGObject object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_CSGOBJECT, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CSGObject object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CSGObject have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the CSGObject object are: + * @li "id" + * @li "domainType" + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * CSGObject object have been set. + * + * @return @c true to indicate that all the required elements of this + * CSGObject have been set, otherwise @c false is returned. + * + * + * @note The required elements for the CSGObject object are: + * @li "csgNode" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this CSGObject's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CSGObject's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CSGObject. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this CSGObject. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this CSGObject. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CSGObject. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this CSGObject. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this CSGObject. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CSGObject_t using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGObject_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGObject_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGObject_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGObject_t * +CSGObject_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this CSGObject_t object. + * + * @param csgo the CSGObject_t structure. + * + * @return a (deep) copy of this CSGObject_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGObject_t* +CSGObject_clone(const CSGObject_t* csgo); + + +/** + * Frees this CSGObject_t object. + * + * @param csgo the CSGObject_t structure. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +void +CSGObject_free(CSGObject_t* csgo); + + +/** + * Returns the value of the "id" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure whose id is sought. + * + * @return the value of the "id" attribute of this CSGObject_t as a pointer to + * a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +char * +CSGObject_getId(const CSGObject_t * csgo); + + +/** + * Returns the value of the "domainType" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure whose domainType is sought. + * + * @return the value of the "domainType" attribute of this CSGObject_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +char * +CSGObject_getDomainType(const CSGObject_t * csgo); + + +/** + * Returns the value of the "ordinal" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure whose ordinal is sought. + * + * @return the value of the "ordinal" attribute of this CSGObject_t as a + * integer. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_getOrdinal(const CSGObject_t * csgo); + + +/** + * Predicate returning @c 1 (true) if this CSGObject_t's "id" attribute is set. + * + * @param csgo the CSGObject_t structure. + * + * @return @c 1 (true) if this CSGObject_t's "id" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_isSetId(const CSGObject_t * csgo); + + +/** + * Predicate returning @c 1 (true) if this CSGObject_t's "domainType" attribute + * is set. + * + * @param csgo the CSGObject_t structure. + * + * @return @c 1 (true) if this CSGObject_t's "domainType" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_isSetDomainType(const CSGObject_t * csgo); + + +/** + * Predicate returning @c 1 (true) if this CSGObject_t's "ordinal" attribute is + * set. + * + * @param csgo the CSGObject_t structure. + * + * @return @c 1 (true) if this CSGObject_t's "ordinal" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_isSetOrdinal(const CSGObject_t * csgo); + + +/** + * Sets the value of the "id" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling CSGObject_unsetId(). + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_setId(CSGObject_t * csgo, const char * id); + + +/** + * Sets the value of the "domainType" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @param domainType const char * value of the "domainType" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_setDomainType(CSGObject_t * csgo, const char * domainType); + + +/** + * Sets the value of the "ordinal" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @param ordinal int value of the "ordinal" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_setOrdinal(CSGObject_t * csgo, int ordinal); + + +/** + * Unsets the value of the "id" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_unsetId(CSGObject_t * csgo); + + +/** + * Unsets the value of the "domainType" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_unsetDomainType(CSGObject_t * csgo); + + +/** + * Unsets the value of the "ordinal" attribute of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_unsetOrdinal(CSGObject_t * csgo); + + +/** + * Returns the value of the "csgNode" element of this CSGObject_t. + * + * @param csgo the CSGObject_t structure whose csgNode is sought. + * + * @return the value of the "csgNode" element of this CSGObject_t as a + * CSGNode*. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +const CSGNode_t* +CSGObject_getCSGNode(const CSGObject_t * csgo); + + +/** + * Predicate returning @c 1 (true) if this CSGObject_t's "csgNode" element is + * set. + * + * @param csgo the CSGObject_t structure. + * + * @return @c 1 (true) if this CSGObject_t's "csgNode" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_isSetCSGNode(const CSGObject_t * csgo); + + +/** + * Sets the value of the "csgNode" element of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @param csgNode CSGNode_t* value of the "csgNode" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_setCSGNode(CSGObject_t * csgo, const CSGNode_t* csgNode); + + +/** + * Creates a new CSGPrimitive_t object, adds it to this CSGObject_t object and + * returns the CSGPrimitive_t object created. + * + * @param csgo the CSGObject_t structure to which the CSGPrimitive_t should be + * added. + * + * @return a new CSGPrimitive_t object instance. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGPrimitive_t* +CSGObject_createCSGPrimitive(CSGObject_t* csgo); + + +/** + * Creates a new CSGTranslation_t object, adds it to this CSGObject_t object + * and returns the CSGTranslation_t object created. + * + * @param csgo the CSGObject_t structure to which the CSGTranslation_t should + * be added. + * + * @return a new CSGTranslation_t object instance. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGTranslation_t* +CSGObject_createCSGTranslation(CSGObject_t* csgo); + + +/** + * Creates a new CSGRotation_t object, adds it to this CSGObject_t object and + * returns the CSGRotation_t object created. + * + * @param csgo the CSGObject_t structure to which the CSGRotation_t should be + * added. + * + * @return a new CSGRotation_t object instance. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGRotation_t* +CSGObject_createCSGRotation(CSGObject_t* csgo); + + +/** + * Creates a new CSGScale_t object, adds it to this CSGObject_t object and + * returns the CSGScale_t object created. + * + * @param csgo the CSGObject_t structure to which the CSGScale_t should be + * added. + * + * @return a new CSGScale_t object instance. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGScale_t* +CSGObject_createCSGScale(CSGObject_t* csgo); + + +/** + * Creates a new CSGHomogeneousTransformation_t object, adds it to this + * CSGObject_t object and returns the CSGHomogeneousTransformation_t object + * created. + * + * @param csgo the CSGObject_t structure to which the + * CSGHomogeneousTransformation_t should be added. + * + * @return a new CSGHomogeneousTransformation_t object instance. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t* +CSGObject_createCSGHomogeneousTransformation(CSGObject_t* csgo); + + +/** + * Creates a new CSGSetOperator_t object, adds it to this CSGObject_t object + * and returns the CSGSetOperator_t object created. + * + * @param csgo the CSGObject_t structure to which the CSGSetOperator_t should + * be added. + * + * @return a new CSGSetOperator_t object instance. + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGObject_createCSGSetOperator(CSGObject_t* csgo); + + +/** + * Unsets the value of the "csgNode" element of this CSGObject_t. + * + * @param csgo the CSGObject_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_unsetCSGNode(CSGObject_t * csgo); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGObject_t object have been set. + * + * @param csgo the CSGObject_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CSGObject_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the CSGObject_t object are: + * @li "id" + * @li "domainType" + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_hasRequiredAttributes(const CSGObject_t * csgo); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * CSGObject_t object have been set. + * + * @param csgo the CSGObject_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * CSGObject_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the CSGObject_t object are: + * @li "csgNode" + * + * @memberof CSGObject_t + */ +LIBSBML_EXTERN +int +CSGObject_hasRequiredElements(const CSGObject_t * csgo); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CSGObject_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/CSGSetOperator.cpp b/generator/tests/test_cpp_code/test-code/CSGSetOperator.cpp index 8b50776e..a83aea02 100644 --- a/generator/tests/test_cpp_code/test-code/CSGSetOperator.cpp +++ b/generator/tests/test_cpp_code/test-code/CSGSetOperator.cpp @@ -1,2000 +1,2000 @@ -/** - * @file CSGSetOperator.cpp - * @brief Implementation of the CSGSetOperator class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new CSGSetOperator using the given SBML Level, Version and - * “spatial” package version. - */ -CSGSetOperator::CSGSetOperator(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : CSGNode(level, version, pkgVersion) - , mOperationType (SPATIAL_SETOPERATION_INVALID) - , mComplementA ("") - , mComplementB ("") - , mCSGNodes (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new CSGSetOperator using the given SpatialPkgNamespaces object. - */ -CSGSetOperator::CSGSetOperator(SpatialPkgNamespaces *spatialns) - : CSGNode(spatialns) - , mOperationType (SPATIAL_SETOPERATION_INVALID) - , mComplementA ("") - , mComplementB ("") - , mCSGNodes (spatialns) -{ - setElementNamespace(spatialns->getURI()); - connectToChild(); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for CSGSetOperator. - */ -CSGSetOperator::CSGSetOperator(const CSGSetOperator& orig) - : CSGNode( orig ) - , mOperationType ( orig.mOperationType ) - , mComplementA ( orig.mComplementA ) - , mComplementB ( orig.mComplementB ) - , mCSGNodes ( orig.mCSGNodes ) -{ - connectToChild(); -} - - -/* - * Assignment operator for CSGSetOperator. - */ -CSGSetOperator& -CSGSetOperator::operator=(const CSGSetOperator& rhs) -{ - if (&rhs != this) - { - CSGNode::operator=(rhs); - mOperationType = rhs.mOperationType; - mComplementA = rhs.mComplementA; - mComplementB = rhs.mComplementB; - mCSGNodes = rhs.mCSGNodes; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this CSGSetOperator object. - */ -CSGSetOperator* -CSGSetOperator::clone() const -{ - return new CSGSetOperator(*this); -} - - -/* - * Destructor for CSGSetOperator. - */ -CSGSetOperator::~CSGSetOperator() -{ -} - - -/* - * Returns the value of the "operationType" attribute of this CSGSetOperator. - */ -SetOperation_t -CSGSetOperator::getOperationType() const -{ - return mOperationType; -} - - -/* - * Returns the value of the "operationType" attribute of this CSGSetOperator. - */ -std::string -CSGSetOperator::getOperationTypeAsString() const -{ - std::string code_str = SetOperation_toString(mOperationType); - return code_str; -} - - -/* - * Returns the value of the "complementA" attribute of this CSGSetOperator. - */ -const std::string& -CSGSetOperator::getComplementA() const -{ - return mComplementA; -} - - -/* - * Returns the value of the "complementB" attribute of this CSGSetOperator. - */ -const std::string& -CSGSetOperator::getComplementB() const -{ - return mComplementB; -} - - -/* - * Predicate returning @c true if this CSGSetOperator's "operationType" - * attribute is set. - */ -bool -CSGSetOperator::isSetOperationType() const -{ - return (mOperationType != SPATIAL_SETOPERATION_INVALID); -} - - -/* - * Predicate returning @c true if this CSGSetOperator's "complementA" attribute - * is set. - */ -bool -CSGSetOperator::isSetComplementA() const -{ - return (mComplementA.empty() == false); -} - - -/* - * Predicate returning @c true if this CSGSetOperator's "complementB" attribute - * is set. - */ -bool -CSGSetOperator::isSetComplementB() const -{ - return (mComplementB.empty() == false); -} - - -/* - * Sets the value of the "operationType" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setOperationType(const SetOperation_t operationType) -{ - if (SetOperation_isValid(operationType) == 0) - { - mOperationType = SPATIAL_SETOPERATION_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mOperationType = operationType; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "operationType" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setOperationType(const std::string& operationType) -{ - mOperationType = SetOperation_fromString(operationType.c_str()); - - if (mOperationType == SPATIAL_SETOPERATION_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "complementA" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setComplementA(const std::string& complementA) -{ - if (!(SyntaxChecker::isValidInternalSId(complementA))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mComplementA = complementA; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "complementB" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setComplementB(const std::string& complementB) -{ - if (!(SyntaxChecker::isValidInternalSId(complementB))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mComplementB = complementB; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "operationType" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::unsetOperationType() -{ - mOperationType = SPATIAL_SETOPERATION_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "complementA" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::unsetComplementA() -{ - mComplementA.erase(); - - if (mComplementA.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "complementB" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::unsetComplementB() -{ - mComplementB.erase(); - - if (mComplementB.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the ListOfCSGNodes from this CSGSetOperator. - */ -const ListOfCSGNodes* -CSGSetOperator::getListOfCSGNodes() const -{ - return &mCSGNodes; -} - - -/* - * Returns the ListOfCSGNodes from this CSGSetOperator. - */ -ListOfCSGNodes* -CSGSetOperator::getListOfCSGNodes() -{ - return &mCSGNodes; -} - - -/* - * Get a CSGNode from the CSGSetOperator. - */ -CSGNode* -CSGSetOperator::getCSGNode(unsigned int n) -{ - return mCSGNodes.get(n); -} - - -/* - * Get a CSGNode from the CSGSetOperator. - */ -const CSGNode* -CSGSetOperator::getCSGNode(unsigned int n) const -{ - return mCSGNodes.get(n); -} - - -/* - * Get a CSGNode from the CSGSetOperator based on its identifier. - */ -CSGNode* -CSGSetOperator::getCSGNode(const std::string& sid) -{ - return mCSGNodes.get(sid); -} - - -/* - * Get a CSGNode from the CSGSetOperator based on its identifier. - */ -const CSGNode* -CSGSetOperator::getCSGNode(const std::string& sid) const -{ - return mCSGNodes.get(sid); -} - - -/* - * Adds a copy of the given CSGNode to this CSGSetOperator. - */ -int -CSGSetOperator::addCSGNode(const CSGNode* csgn) -{ - if (csgn == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (csgn->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != csgn->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != csgn->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(csgn)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (csgn->isSetId() && (mCSGNodes.get(csgn->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mCSGNodes.append(csgn); - } -} - - -/* - * Get the number of CSGNode objects in this CSGSetOperator. - */ -unsigned int -CSGSetOperator::getNumCSGNodes() const -{ - return mCSGNodes.size(); -} - - -/* - * Creates a new CSGPrimitive object, adds it to this CSGSetOperator object and - * returns the CSGPrimitive object created. - */ -CSGPrimitive* -CSGSetOperator::createCSGPrimitive() -{ - CSGPrimitive* csgp = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csgp = new CSGPrimitive(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csgp != NULL) - { - mCSGNodes.appendAndOwn(csgp); - } - - return csgp; -} - - -/* - * Creates a new CSGTranslation object, adds it to this CSGSetOperator object - * and returns the CSGTranslation object created. - */ -CSGTranslation* -CSGSetOperator::createCSGTranslation() -{ - CSGTranslation* csgt = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csgt = new CSGTranslation(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csgt != NULL) - { - mCSGNodes.appendAndOwn(csgt); - } - - return csgt; -} - - -/* - * Creates a new CSGRotation object, adds it to this CSGSetOperator object and - * returns the CSGRotation object created. - */ -CSGRotation* -CSGSetOperator::createCSGRotation() -{ - CSGRotation* csgr = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csgr = new CSGRotation(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csgr != NULL) - { - mCSGNodes.appendAndOwn(csgr); - } - - return csgr; -} - - -/* - * Creates a new CSGScale object, adds it to this CSGSetOperator object and - * returns the CSGScale object created. - */ -CSGScale* -CSGSetOperator::createCSGScale() -{ - CSGScale* csgs = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csgs = new CSGScale(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csgs != NULL) - { - mCSGNodes.appendAndOwn(csgs); - } - - return csgs; -} - - -/* - * Creates a new CSGHomogeneousTransformation object, adds it to this - * CSGSetOperator object and returns the CSGHomogeneousTransformation object - * created. - */ -CSGHomogeneousTransformation* -CSGSetOperator::createCSGHomogeneousTransformation() -{ - CSGHomogeneousTransformation* csght = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csght = new CSGHomogeneousTransformation(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csght != NULL) - { - mCSGNodes.appendAndOwn(csght); - } - - return csght; -} - - -/* - * Creates a new CSGSetOperator object, adds it to this CSGSetOperator object - * and returns the CSGSetOperator object created. - */ -CSGSetOperator* -CSGSetOperator::createCSGSetOperator() -{ - CSGSetOperator* csgso = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csgso = new CSGSetOperator(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csgso != NULL) - { - mCSGNodes.appendAndOwn(csgso); - } - - return csgso; -} - - -/* - * Removes the nth CSGNode from this CSGSetOperator and returns a pointer to - * it. - */ -CSGNode* -CSGSetOperator::removeCSGNode(unsigned int n) -{ - return mCSGNodes.remove(n); -} - - -/* - * Removes the CSGNode from this CSGSetOperator based on its identifier and - * returns a pointer to it. - */ -CSGNode* -CSGSetOperator::removeCSGNode(const std::string& sid) -{ - return mCSGNodes.remove(sid); -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -CSGSetOperator::renameSIdRefs(const std::string& oldid, - const std::string& newid) -{ - if (isSetComplementA() && mComplementA == oldid) - { - setComplementA(newid); - } - - if (isSetComplementB() && mComplementB == oldid) - { - setComplementB(newid); - } -} - - -/* - * Returns the XML element name of this CSGSetOperator object. - */ -const std::string& -CSGSetOperator::getElementName() const -{ - static const string name = "csgSetOperator"; - return name; -} - - -/* - * Returns the libSBML type code for this CSGSetOperator object. - */ -int -CSGSetOperator::getTypeCode() const -{ - return SBML_SPATIAL_CSGSETOPERATOR; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * CSGSetOperator object have been set. - */ -bool -CSGSetOperator::hasRequiredAttributes() const -{ - bool allPresent = CSGNode::hasRequiredAttributes(); - - if (isSetOperationType() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * CSGSetOperator object have been set. - */ -bool -CSGSetOperator::hasRequiredElements() const -{ - bool allPresent = CSGNode::hasRequiredElements(); - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -CSGSetOperator::writeElements(XMLOutputStream& stream) const -{ - CSGNode::writeElements(stream); - - if (getNumCSGNodes() > 0) - { - mCSGNodes.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -CSGSetOperator::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mCSGNodes.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -CSGSetOperator::setSBMLDocument(SBMLDocument* d) -{ - CSGNode::setSBMLDocument(d); - - mCSGNodes.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -CSGSetOperator::connectToChild() -{ - CSGNode::connectToChild(); - - mCSGNodes.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -CSGSetOperator::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - CSGNode::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mCSGNodes.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -CSGSetOperator::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - CSGNode::updateSBMLNamespace(package, level, version); - - mCSGNodes.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "operationType") - { - value = getOperationTypeAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "complementA") - { - value = getComplementA(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "complementB") - { - value = getComplementB(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this CSGSetOperator's attribute - * "attributeName" is set. - */ -bool -CSGSetOperator::isSetAttribute(const std::string& attributeName) const -{ - bool value = CSGNode::isSetAttribute(attributeName); - - if (attributeName == "operationType") - { - value = isSetOperationType(); - } - else if (attributeName == "complementA") - { - value = isSetComplementA(); - } - else if (attributeName == "complementB") - { - value = isSetComplementB(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setAttribute(const std::string& attributeName, int value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setAttribute(const std::string& attributeName, double value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - if (attributeName == "operationType") - { - return_value = setOperationType(value); - } - else if (attributeName == "complementA") - { - return_value = setComplementA(value); - } - else if (attributeName == "complementB") - { - return_value = setComplementB(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this CSGSetOperator. - */ -int -CSGSetOperator::unsetAttribute(const std::string& attributeName) -{ - int value = CSGNode::unsetAttribute(attributeName); - - if (attributeName == "operationType") - { - value = unsetOperationType(); - } - else if (attributeName == "complementA") - { - value = unsetComplementA(); - } - else if (attributeName == "complementB") - { - value = unsetComplementB(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this CSGSetOperator. - */ -SBase* -CSGSetOperator::createChildObject(const std::string& elementName) -{ - CSGNode* obj = NULL; - - if (elementName == "csgPrimitive") - { - return createCSGPrimitive(); - } - else if (elementName == "csgTranslation") - { - return createCSGTranslation(); - } - else if (elementName == "csgRotation") - { - return createCSGRotation(); - } - else if (elementName == "csgScale") - { - return createCSGScale(); - } - else if (elementName == "csgHomogeneousTransformation") - { - return createCSGHomogeneousTransformation(); - } - else if (elementName == "csgSetOperator") - { - return createCSGSetOperator(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this CSGSetOperator. - */ -int -CSGSetOperator::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "csgPrimitive" && element->getTypeCode() == - SBML_SPATIAL_CSGPRIMITIVE) - { - return addCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgTranslation" && element->getTypeCode() == - SBML_SPATIAL_CSGTRANSLATION) - { - return addCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgRotation" && element->getTypeCode() == - SBML_SPATIAL_CSGROTATION) - { - return addCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgScale" && element->getTypeCode() == - SBML_SPATIAL_CSGSCALE) - { - return addCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgHomogeneousTransformation" && - element->getTypeCode() == SBML_SPATIAL_CSGHOMOGENEOUSTRANSFORMATION) - { - return addCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgSetOperator" && element->getTypeCode() == - SBML_SPATIAL_CSGSETOPERATOR) - { - return addCSGNode((const CSGNode*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * CSGSetOperator. - */ -SBase* -CSGSetOperator::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "csgPrimitive") - { - return removeCSGNode(id); - } - else if (elementName == "csgTranslation") - { - return removeCSGNode(id); - } - else if (elementName == "csgRotation") - { - return removeCSGNode(id); - } - else if (elementName == "csgScale") - { - return removeCSGNode(id); - } - else if (elementName == "csgHomogeneousTransformation") - { - return removeCSGNode(id); - } - else if (elementName == "csgSetOperator") - { - return removeCSGNode(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this CSGSetOperator. - */ -unsigned int -CSGSetOperator::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "csgNode") - { - return getNumCSGNodes(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this CSGSetOperator. - */ -SBase* -CSGSetOperator::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "csgNode") - { - return getCSGNode(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -CSGSetOperator::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - obj = mCSGNodes.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -CSGSetOperator::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCSGNodes.getMetaId() == metaid) - { - return &mCSGNodes; - } - - obj = mCSGNodes.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -CSGSetOperator::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mCSGNodes, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -CSGSetOperator::createObject(XMLInputStream& stream) -{ - SBase* obj = CSGNode::createObject(stream); - - const std::string& name = stream.peek().getName(); - - if (name == "listOfCSGNodes") - { - if (getErrorLog() && mCSGNodes.size() != 0) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGSetOperatorAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - obj = &mCSGNodes; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -CSGSetOperator::addExpectedAttributes(ExpectedAttributes& attributes) -{ - CSGNode::addExpectedAttributes(attributes); - - attributes.add("operationType"); - - attributes.add("complementA"); - - attributes.add("complementB"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -CSGSetOperator::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - CSGNode::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", SpatialCSGSetOperatorAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialCSGSetOperatorAllowedCoreAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - } - } - - // - // operationType enum (use = "required" ) - // - - std::string operationType; - assigned = attributes.readInto("operationType", operationType); - - if (assigned == true) - { - if (operationType.empty() == true) - { - logEmptyString(operationType, level, version, ""); - } - else - { - mOperationType = SetOperation_fromString(operationType.c_str()); - - if (log && SetOperation_isValid(mOperationType) == 0) - { - std::string msg = "The operationType on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + operationType + "', which is not a valid option."; - - log->logPackageError("spatial", - SpatialCSGSetOperatorOperationTypeMustBeSetOperationEnum, pkgVersion, - level, version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'operationType' is missing."; - log->logPackageError("spatial", SpatialCSGSetOperatorAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } - - // - // complementA SIdRef (use = "optional" ) - // - - assigned = attributes.readInto("complementA", mComplementA); - - if (assigned == true) - { - if (mComplementA.empty() == true) - { - logEmptyString(mComplementA, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mComplementA) == false) - { - std::string msg = "The complementA attribute on the <" + getElementName() - + ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mComplementA + "', which does not conform to the " - "syntax."; - log->logPackageError("spatial", - SpatialCSGSetOperatorComplementAMustBeCSGNode, pkgVersion, level, - version, msg, getLine(), getColumn()); - } - } - - // - // complementB SIdRef (use = "optional" ) - // - - assigned = attributes.readInto("complementB", mComplementB); - - if (assigned == true) - { - if (mComplementB.empty() == true) - { - logEmptyString(mComplementB, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mComplementB) == false) - { - std::string msg = "The complementB attribute on the <" + getElementName() - + ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mComplementB + "', which does not conform to the " - "syntax."; - log->logPackageError("spatial", - SpatialCSGSetOperatorComplementBMustBeCSGNode, pkgVersion, level, - version, msg, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -CSGSetOperator::writeAttributes(XMLOutputStream& stream) const -{ - CSGNode::writeAttributes(stream); - - if (isSetOperationType() == true) - { - stream.writeAttribute("operationType", getPrefix(), - SetOperation_toString(mOperationType)); - } - - if (isSetComplementA() == true) - { - stream.writeAttribute("complementA", getPrefix(), mComplementA); - } - - if (isSetComplementB() == true) - { - stream.writeAttribute("complementB", getPrefix(), mComplementB); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new CSGSetOperator_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGSetOperator_t * -CSGSetOperator_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGSetOperator(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this CSGSetOperator_t object. - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGSetOperator_clone(const CSGSetOperator_t* csgso) -{ - if (csgso != NULL) - { - return static_cast(csgso->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this CSGSetOperator_t object. - */ -LIBSBML_EXTERN -void -CSGSetOperator_free(CSGSetOperator_t* csgso) -{ - if (csgso != NULL) - { - delete csgso; - } -} - - -/* - * Returns the value of the "operationType" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -SetOperation_t -CSGSetOperator_getOperationType(const CSGSetOperator_t * csgso) -{ - if (csgso == NULL) - { - return SPATIAL_SETOPERATION_INVALID; - } - - return csgso->getOperationType(); -} - - -/* - * Returns the value of the "operationType" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -char * -CSGSetOperator_getOperationTypeAsString(const CSGSetOperator_t * csgso) -{ - return (char*)(SetOperation_toString(csgso->getOperationType())); -} - - -/* - * Returns the value of the "complementA" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -char * -CSGSetOperator_getComplementA(const CSGSetOperator_t * csgso) -{ - if (csgso == NULL) - { - return NULL; - } - - return csgso->getComplementA().empty() ? NULL : - safe_strdup(csgso->getComplementA().c_str()); -} - - -/* - * Returns the value of the "complementB" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -char * -CSGSetOperator_getComplementB(const CSGSetOperator_t * csgso) -{ - if (csgso == NULL) - { - return NULL; - } - - return csgso->getComplementB().empty() ? NULL : - safe_strdup(csgso->getComplementB().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this CSGSetOperator_t's "operationType" - * attribute is set. - */ -LIBSBML_EXTERN -int -CSGSetOperator_isSetOperationType(const CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? static_cast(csgso->isSetOperationType()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementA" - * attribute is set. - */ -LIBSBML_EXTERN -int -CSGSetOperator_isSetComplementA(const CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? static_cast(csgso->isSetComplementA()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementB" - * attribute is set. - */ -LIBSBML_EXTERN -int -CSGSetOperator_isSetComplementB(const CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? static_cast(csgso->isSetComplementB()) : 0; -} - - -/* - * Sets the value of the "operationType" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_setOperationType(CSGSetOperator_t * csgso, - SetOperation_t operationType) -{ - return (csgso != NULL) ? csgso->setOperationType(operationType) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "operationType" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_setOperationTypeAsString(CSGSetOperator_t * csgso, - const char * operationType) -{ - return (csgso != NULL) ? csgso->setOperationType(operationType): - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "complementA" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_setComplementA(CSGSetOperator_t * csgso, - const char * complementA) -{ - return (csgso != NULL) ? csgso->setComplementA(complementA) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "complementB" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_setComplementB(CSGSetOperator_t * csgso, - const char * complementB) -{ - return (csgso != NULL) ? csgso->setComplementB(complementB) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "operationType" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_unsetOperationType(CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? csgso->unsetOperationType() : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "complementA" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_unsetComplementA(CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? csgso->unsetComplementA() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "complementB" attribute of this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_unsetComplementB(CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? csgso->unsetComplementB() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing CSGNode_t objects from this - * CSGSetOperator_t. - */ -LIBSBML_EXTERN -ListOf_t* -CSGSetOperator_getListOfCSGNodes(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->getListOfCSGNodes() : NULL; -} - - -/* - * Get a CSGNode_t from the CSGSetOperator_t. - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_getCSGNode(CSGSetOperator_t* csgso, unsigned int n) -{ - return (csgso != NULL) ? csgso->getCSGNode(n) : NULL; -} - - -/* - * Get a CSGNode_t from the CSGSetOperator_t based on its identifier. - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_getCSGNodeById(CSGSetOperator_t* csgso, const char *sid) -{ - return (csgso != NULL && sid != NULL) ? csgso->getCSGNode(sid) : NULL; -} - - -/* - * Adds a copy of the given CSGNode_t to this CSGSetOperator_t. - */ -LIBSBML_EXTERN -int -CSGSetOperator_addCSGNode(CSGSetOperator_t* csgso, const CSGNode_t* csgn) -{ - return (csgso != NULL) ? csgso->addCSGNode(csgn) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of CSGNode_t objects in this CSGSetOperator_t. - */ -LIBSBML_EXTERN -unsigned int -CSGSetOperator_getNumCSGNodes(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->getNumCSGNodes() : SBML_INT_MAX; -} - - -/* - * Creates a new CSGPrimitive_t object, adds it to this CSGSetOperator_t object - * and returns the CSGPrimitive_t object created. - */ -LIBSBML_EXTERN -CSGPrimitive_t* -CSGSetOperator_createCSGPrimitive(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->createCSGPrimitive() : NULL; -} - - -/* - * Creates a new CSGTranslation_t object, adds it to this CSGSetOperator_t - * object and returns the CSGTranslation_t object created. - */ -LIBSBML_EXTERN -CSGTranslation_t* -CSGSetOperator_createCSGTranslation(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->createCSGTranslation() : NULL; -} - - -/* - * Creates a new CSGRotation_t object, adds it to this CSGSetOperator_t object - * and returns the CSGRotation_t object created. - */ -LIBSBML_EXTERN -CSGRotation_t* -CSGSetOperator_createCSGRotation(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->createCSGRotation() : NULL; -} - - -/* - * Creates a new CSGScale_t object, adds it to this CSGSetOperator_t object and - * returns the CSGScale_t object created. - */ -LIBSBML_EXTERN -CSGScale_t* -CSGSetOperator_createCSGScale(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->createCSGScale() : NULL; -} - - -/* - * Creates a new CSGHomogeneousTransformation_t object, adds it to this - * CSGSetOperator_t object and returns the CSGHomogeneousTransformation_t - * object created. - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t* -CSGSetOperator_createCSGHomogeneousTransformation(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->createCSGHomogeneousTransformation() : NULL; -} - - -/* - * Creates a new CSGSetOperator_t object, adds it to this CSGSetOperator_t - * object and returns the CSGSetOperator_t object created. - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGSetOperator_createCSGSetOperator(CSGSetOperator_t* csgso) -{ - return (csgso != NULL) ? csgso->createCSGSetOperator() : NULL; -} - - -/* - * Removes the nth CSGNode_t from this CSGSetOperator_t and returns a pointer - * to it. - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_removeCSGNode(CSGSetOperator_t* csgso, unsigned int n) -{ - return (csgso != NULL) ? csgso->removeCSGNode(n) : NULL; -} - - -/* - * Removes the CSGNode_t from this CSGSetOperator_t based on its identifier and - * returns a pointer to it. - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_removeCSGNodeById(CSGSetOperator_t* csgso, const char* sid) -{ - return (csgso != NULL && sid != NULL) ? csgso->removeCSGNode(sid) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGSetOperator_t object have been set. - */ -LIBSBML_EXTERN -int -CSGSetOperator_hasRequiredAttributes(const CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? static_cast(csgso->hasRequiredAttributes()) : - 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * CSGSetOperator_t object have been set. - */ -LIBSBML_EXTERN -int -CSGSetOperator_hasRequiredElements(const CSGSetOperator_t * csgso) -{ - return (csgso != NULL) ? static_cast(csgso->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file CSGSetOperator.cpp + * @brief Implementation of the CSGSetOperator class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CSGSetOperator using the given SBML Level, Version and + * “spatial” package version. + */ +CSGSetOperator::CSGSetOperator(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : CSGNode(level, version, pkgVersion) + , mOperationType (SPATIAL_SETOPERATION_INVALID) + , mComplementA ("") + , mComplementB ("") + , mCSGNodes (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new CSGSetOperator using the given SpatialPkgNamespaces object. + */ +CSGSetOperator::CSGSetOperator(SpatialPkgNamespaces *spatialns) + : CSGNode(spatialns) + , mOperationType (SPATIAL_SETOPERATION_INVALID) + , mComplementA ("") + , mComplementB ("") + , mCSGNodes (spatialns) +{ + setElementNamespace(spatialns->getURI()); + connectToChild(); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for CSGSetOperator. + */ +CSGSetOperator::CSGSetOperator(const CSGSetOperator& orig) + : CSGNode( orig ) + , mOperationType ( orig.mOperationType ) + , mComplementA ( orig.mComplementA ) + , mComplementB ( orig.mComplementB ) + , mCSGNodes ( orig.mCSGNodes ) +{ + connectToChild(); +} + + +/* + * Assignment operator for CSGSetOperator. + */ +CSGSetOperator& +CSGSetOperator::operator=(const CSGSetOperator& rhs) +{ + if (&rhs != this) + { + CSGNode::operator=(rhs); + mOperationType = rhs.mOperationType; + mComplementA = rhs.mComplementA; + mComplementB = rhs.mComplementB; + mCSGNodes = rhs.mCSGNodes; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CSGSetOperator object. + */ +CSGSetOperator* +CSGSetOperator::clone() const +{ + return new CSGSetOperator(*this); +} + + +/* + * Destructor for CSGSetOperator. + */ +CSGSetOperator::~CSGSetOperator() +{ +} + + +/* + * Returns the value of the "operationType" attribute of this CSGSetOperator. + */ +SetOperation_t +CSGSetOperator::getOperationType() const +{ + return mOperationType; +} + + +/* + * Returns the value of the "operationType" attribute of this CSGSetOperator. + */ +std::string +CSGSetOperator::getOperationTypeAsString() const +{ + std::string code_str = SetOperation_toString(mOperationType); + return code_str; +} + + +/* + * Returns the value of the "complementA" attribute of this CSGSetOperator. + */ +const std::string& +CSGSetOperator::getComplementA() const +{ + return mComplementA; +} + + +/* + * Returns the value of the "complementB" attribute of this CSGSetOperator. + */ +const std::string& +CSGSetOperator::getComplementB() const +{ + return mComplementB; +} + + +/* + * Predicate returning @c true if this CSGSetOperator's "operationType" + * attribute is set. + */ +bool +CSGSetOperator::isSetOperationType() const +{ + return (mOperationType != SPATIAL_SETOPERATION_INVALID); +} + + +/* + * Predicate returning @c true if this CSGSetOperator's "complementA" attribute + * is set. + */ +bool +CSGSetOperator::isSetComplementA() const +{ + return (mComplementA.empty() == false); +} + + +/* + * Predicate returning @c true if this CSGSetOperator's "complementB" attribute + * is set. + */ +bool +CSGSetOperator::isSetComplementB() const +{ + return (mComplementB.empty() == false); +} + + +/* + * Sets the value of the "operationType" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setOperationType(const SetOperation_t operationType) +{ + if (SetOperation_isValid(operationType) == 0) + { + mOperationType = SPATIAL_SETOPERATION_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mOperationType = operationType; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "operationType" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setOperationType(const std::string& operationType) +{ + mOperationType = SetOperation_fromString(operationType.c_str()); + + if (mOperationType == SPATIAL_SETOPERATION_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "complementA" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setComplementA(const std::string& complementA) +{ + if (!(SyntaxChecker::isValidInternalSId(complementA))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mComplementA = complementA; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "complementB" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setComplementB(const std::string& complementB) +{ + if (!(SyntaxChecker::isValidInternalSId(complementB))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mComplementB = complementB; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "operationType" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::unsetOperationType() +{ + mOperationType = SPATIAL_SETOPERATION_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "complementA" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::unsetComplementA() +{ + mComplementA.erase(); + + if (mComplementA.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "complementB" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::unsetComplementB() +{ + mComplementB.erase(); + + if (mComplementB.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the ListOfCSGNodes from this CSGSetOperator. + */ +const ListOfCSGNodes* +CSGSetOperator::getListOfCSGNodes() const +{ + return &mCSGNodes; +} + + +/* + * Returns the ListOfCSGNodes from this CSGSetOperator. + */ +ListOfCSGNodes* +CSGSetOperator::getListOfCSGNodes() +{ + return &mCSGNodes; +} + + +/* + * Get a CSGNode from the CSGSetOperator. + */ +CSGNode* +CSGSetOperator::getCSGNode(unsigned int n) +{ + return mCSGNodes.get(n); +} + + +/* + * Get a CSGNode from the CSGSetOperator. + */ +const CSGNode* +CSGSetOperator::getCSGNode(unsigned int n) const +{ + return mCSGNodes.get(n); +} + + +/* + * Get a CSGNode from the CSGSetOperator based on its identifier. + */ +CSGNode* +CSGSetOperator::getCSGNode(const std::string& sid) +{ + return mCSGNodes.get(sid); +} + + +/* + * Get a CSGNode from the CSGSetOperator based on its identifier. + */ +const CSGNode* +CSGSetOperator::getCSGNode(const std::string& sid) const +{ + return mCSGNodes.get(sid); +} + + +/* + * Adds a copy of the given CSGNode to this CSGSetOperator. + */ +int +CSGSetOperator::addCSGNode(const CSGNode* csgn) +{ + if (csgn == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (csgn->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != csgn->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != csgn->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(csgn)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (csgn->isSetId() && (mCSGNodes.get(csgn->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mCSGNodes.append(csgn); + } +} + + +/* + * Get the number of CSGNode objects in this CSGSetOperator. + */ +unsigned int +CSGSetOperator::getNumCSGNodes() const +{ + return mCSGNodes.size(); +} + + +/* + * Creates a new CSGPrimitive object, adds it to this CSGSetOperator object and + * returns the CSGPrimitive object created. + */ +CSGPrimitive* +CSGSetOperator::createCSGPrimitive() +{ + CSGPrimitive* csgp = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csgp = new CSGPrimitive(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csgp != NULL) + { + mCSGNodes.appendAndOwn(csgp); + } + + return csgp; +} + + +/* + * Creates a new CSGTranslation object, adds it to this CSGSetOperator object + * and returns the CSGTranslation object created. + */ +CSGTranslation* +CSGSetOperator::createCSGTranslation() +{ + CSGTranslation* csgt = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csgt = new CSGTranslation(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csgt != NULL) + { + mCSGNodes.appendAndOwn(csgt); + } + + return csgt; +} + + +/* + * Creates a new CSGRotation object, adds it to this CSGSetOperator object and + * returns the CSGRotation object created. + */ +CSGRotation* +CSGSetOperator::createCSGRotation() +{ + CSGRotation* csgr = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csgr = new CSGRotation(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csgr != NULL) + { + mCSGNodes.appendAndOwn(csgr); + } + + return csgr; +} + + +/* + * Creates a new CSGScale object, adds it to this CSGSetOperator object and + * returns the CSGScale object created. + */ +CSGScale* +CSGSetOperator::createCSGScale() +{ + CSGScale* csgs = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csgs = new CSGScale(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csgs != NULL) + { + mCSGNodes.appendAndOwn(csgs); + } + + return csgs; +} + + +/* + * Creates a new CSGHomogeneousTransformation object, adds it to this + * CSGSetOperator object and returns the CSGHomogeneousTransformation object + * created. + */ +CSGHomogeneousTransformation* +CSGSetOperator::createCSGHomogeneousTransformation() +{ + CSGHomogeneousTransformation* csght = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csght = new CSGHomogeneousTransformation(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csght != NULL) + { + mCSGNodes.appendAndOwn(csght); + } + + return csght; +} + + +/* + * Creates a new CSGSetOperator object, adds it to this CSGSetOperator object + * and returns the CSGSetOperator object created. + */ +CSGSetOperator* +CSGSetOperator::createCSGSetOperator() +{ + CSGSetOperator* csgso = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csgso = new CSGSetOperator(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csgso != NULL) + { + mCSGNodes.appendAndOwn(csgso); + } + + return csgso; +} + + +/* + * Removes the nth CSGNode from this CSGSetOperator and returns a pointer to + * it. + */ +CSGNode* +CSGSetOperator::removeCSGNode(unsigned int n) +{ + return mCSGNodes.remove(n); +} + + +/* + * Removes the CSGNode from this CSGSetOperator based on its identifier and + * returns a pointer to it. + */ +CSGNode* +CSGSetOperator::removeCSGNode(const std::string& sid) +{ + return mCSGNodes.remove(sid); +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +CSGSetOperator::renameSIdRefs(const std::string& oldid, + const std::string& newid) +{ + if (isSetComplementA() && mComplementA == oldid) + { + setComplementA(newid); + } + + if (isSetComplementB() && mComplementB == oldid) + { + setComplementB(newid); + } +} + + +/* + * Returns the XML element name of this CSGSetOperator object. + */ +const std::string& +CSGSetOperator::getElementName() const +{ + static const string name = "csgSetOperator"; + return name; +} + + +/* + * Returns the libSBML type code for this CSGSetOperator object. + */ +int +CSGSetOperator::getTypeCode() const +{ + return SBML_SPATIAL_CSGSETOPERATOR; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CSGSetOperator object have been set. + */ +bool +CSGSetOperator::hasRequiredAttributes() const +{ + bool allPresent = CSGNode::hasRequiredAttributes(); + + if (isSetOperationType() == false) + { + allPresent = false; + } + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * CSGSetOperator object have been set. + */ +bool +CSGSetOperator::hasRequiredElements() const +{ + bool allPresent = CSGNode::hasRequiredElements(); + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +CSGSetOperator::writeElements(XMLOutputStream& stream) const +{ + CSGNode::writeElements(stream); + + if (getNumCSGNodes() > 0) + { + mCSGNodes.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +CSGSetOperator::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mCSGNodes.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +CSGSetOperator::setSBMLDocument(SBMLDocument* d) +{ + CSGNode::setSBMLDocument(d); + + mCSGNodes.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +CSGSetOperator::connectToChild() +{ + CSGNode::connectToChild(); + + mCSGNodes.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +CSGSetOperator::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + CSGNode::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mCSGNodes.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +CSGSetOperator::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + CSGNode::updateSBMLNamespace(package, level, version); + + mCSGNodes.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "operationType") + { + value = getOperationTypeAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "complementA") + { + value = getComplementA(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "complementB") + { + value = getComplementB(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this CSGSetOperator's attribute + * "attributeName" is set. + */ +bool +CSGSetOperator::isSetAttribute(const std::string& attributeName) const +{ + bool value = CSGNode::isSetAttribute(attributeName); + + if (attributeName == "operationType") + { + value = isSetOperationType(); + } + else if (attributeName == "complementA") + { + value = isSetComplementA(); + } + else if (attributeName == "complementB") + { + value = isSetComplementB(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setAttribute(const std::string& attributeName, int value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setAttribute(const std::string& attributeName, double value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + if (attributeName == "operationType") + { + return_value = setOperationType(value); + } + else if (attributeName == "complementA") + { + return_value = setComplementA(value); + } + else if (attributeName == "complementB") + { + return_value = setComplementB(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CSGSetOperator. + */ +int +CSGSetOperator::unsetAttribute(const std::string& attributeName) +{ + int value = CSGNode::unsetAttribute(attributeName); + + if (attributeName == "operationType") + { + value = unsetOperationType(); + } + else if (attributeName == "complementA") + { + value = unsetComplementA(); + } + else if (attributeName == "complementB") + { + value = unsetComplementB(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this CSGSetOperator. + */ +SBase* +CSGSetOperator::createChildObject(const std::string& elementName) +{ + CSGNode* obj = NULL; + + if (elementName == "csgPrimitive") + { + return createCSGPrimitive(); + } + else if (elementName == "csgTranslation") + { + return createCSGTranslation(); + } + else if (elementName == "csgRotation") + { + return createCSGRotation(); + } + else if (elementName == "csgScale") + { + return createCSGScale(); + } + else if (elementName == "csgHomogeneousTransformation") + { + return createCSGHomogeneousTransformation(); + } + else if (elementName == "csgSetOperator") + { + return createCSGSetOperator(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this CSGSetOperator. + */ +int +CSGSetOperator::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "csgPrimitive" && element->getTypeCode() == + SBML_SPATIAL_CSGPRIMITIVE) + { + return addCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgTranslation" && element->getTypeCode() == + SBML_SPATIAL_CSGTRANSLATION) + { + return addCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgRotation" && element->getTypeCode() == + SBML_SPATIAL_CSGROTATION) + { + return addCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgScale" && element->getTypeCode() == + SBML_SPATIAL_CSGSCALE) + { + return addCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgHomogeneousTransformation" && + element->getTypeCode() == SBML_SPATIAL_CSGHOMOGENEOUSTRANSFORMATION) + { + return addCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgSetOperator" && element->getTypeCode() == + SBML_SPATIAL_CSGSETOPERATOR) + { + return addCSGNode((const CSGNode*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CSGSetOperator. + */ +SBase* +CSGSetOperator::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "csgPrimitive") + { + return removeCSGNode(id); + } + else if (elementName == "csgTranslation") + { + return removeCSGNode(id); + } + else if (elementName == "csgRotation") + { + return removeCSGNode(id); + } + else if (elementName == "csgScale") + { + return removeCSGNode(id); + } + else if (elementName == "csgHomogeneousTransformation") + { + return removeCSGNode(id); + } + else if (elementName == "csgSetOperator") + { + return removeCSGNode(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this CSGSetOperator. + */ +unsigned int +CSGSetOperator::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "csgNode") + { + return getNumCSGNodes(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this CSGSetOperator. + */ +SBase* +CSGSetOperator::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "csgNode") + { + return getCSGNode(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +CSGSetOperator::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + obj = mCSGNodes.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +CSGSetOperator::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCSGNodes.getMetaId() == metaid) + { + return &mCSGNodes; + } + + obj = mCSGNodes.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +CSGSetOperator::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mCSGNodes, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +CSGSetOperator::createObject(XMLInputStream& stream) +{ + SBase* obj = CSGNode::createObject(stream); + + const std::string& name = stream.peek().getName(); + + if (name == "listOfCSGNodes") + { + if (getErrorLog() && mCSGNodes.size() != 0) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGSetOperatorAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + obj = &mCSGNodes; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CSGSetOperator::addExpectedAttributes(ExpectedAttributes& attributes) +{ + CSGNode::addExpectedAttributes(attributes); + + attributes.add("operationType"); + + attributes.add("complementA"); + + attributes.add("complementB"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CSGSetOperator::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + CSGNode::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", SpatialCSGSetOperatorAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialCSGSetOperatorAllowedCoreAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + } + } + + // + // operationType enum (use = "required" ) + // + + std::string operationType; + assigned = attributes.readInto("operationType", operationType); + + if (assigned == true) + { + if (operationType.empty() == true) + { + logEmptyString(operationType, level, version, ""); + } + else + { + mOperationType = SetOperation_fromString(operationType.c_str()); + + if (log && SetOperation_isValid(mOperationType) == 0) + { + std::string msg = "The operationType on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + operationType + "', which is not a valid option."; + + log->logPackageError("spatial", + SpatialCSGSetOperatorOperationTypeMustBeSetOperationEnum, pkgVersion, + level, version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'operationType' is missing."; + log->logPackageError("spatial", SpatialCSGSetOperatorAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } + + // + // complementA SIdRef (use = "optional" ) + // + + assigned = attributes.readInto("complementA", mComplementA); + + if (assigned == true) + { + if (mComplementA.empty() == true) + { + logEmptyString(mComplementA, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mComplementA) == false) + { + std::string msg = "The complementA attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mComplementA + "', which does not conform to the " + "syntax."; + log->logPackageError("spatial", + SpatialCSGSetOperatorComplementAMustBeCSGNode, pkgVersion, level, + version, msg, getLine(), getColumn()); + } + } + + // + // complementB SIdRef (use = "optional" ) + // + + assigned = attributes.readInto("complementB", mComplementB); + + if (assigned == true) + { + if (mComplementB.empty() == true) + { + logEmptyString(mComplementB, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mComplementB) == false) + { + std::string msg = "The complementB attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mComplementB + "', which does not conform to the " + "syntax."; + log->logPackageError("spatial", + SpatialCSGSetOperatorComplementBMustBeCSGNode, pkgVersion, level, + version, msg, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +CSGSetOperator::writeAttributes(XMLOutputStream& stream) const +{ + CSGNode::writeAttributes(stream); + + if (isSetOperationType() == true) + { + stream.writeAttribute("operationType", getPrefix(), + SetOperation_toString(mOperationType)); + } + + if (isSetComplementA() == true) + { + stream.writeAttribute("complementA", getPrefix(), mComplementA); + } + + if (isSetComplementB() == true) + { + stream.writeAttribute("complementB", getPrefix(), mComplementB); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CSGSetOperator_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGSetOperator_t * +CSGSetOperator_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGSetOperator(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this CSGSetOperator_t object. + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGSetOperator_clone(const CSGSetOperator_t* csgso) +{ + if (csgso != NULL) + { + return static_cast(csgso->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CSGSetOperator_t object. + */ +LIBSBML_EXTERN +void +CSGSetOperator_free(CSGSetOperator_t* csgso) +{ + if (csgso != NULL) + { + delete csgso; + } +} + + +/* + * Returns the value of the "operationType" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +SetOperation_t +CSGSetOperator_getOperationType(const CSGSetOperator_t * csgso) +{ + if (csgso == NULL) + { + return SPATIAL_SETOPERATION_INVALID; + } + + return csgso->getOperationType(); +} + + +/* + * Returns the value of the "operationType" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +char * +CSGSetOperator_getOperationTypeAsString(const CSGSetOperator_t * csgso) +{ + return (char*)(SetOperation_toString(csgso->getOperationType())); +} + + +/* + * Returns the value of the "complementA" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +char * +CSGSetOperator_getComplementA(const CSGSetOperator_t * csgso) +{ + if (csgso == NULL) + { + return NULL; + } + + return csgso->getComplementA().empty() ? NULL : + safe_strdup(csgso->getComplementA().c_str()); +} + + +/* + * Returns the value of the "complementB" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +char * +CSGSetOperator_getComplementB(const CSGSetOperator_t * csgso) +{ + if (csgso == NULL) + { + return NULL; + } + + return csgso->getComplementB().empty() ? NULL : + safe_strdup(csgso->getComplementB().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this CSGSetOperator_t's "operationType" + * attribute is set. + */ +LIBSBML_EXTERN +int +CSGSetOperator_isSetOperationType(const CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? static_cast(csgso->isSetOperationType()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementA" + * attribute is set. + */ +LIBSBML_EXTERN +int +CSGSetOperator_isSetComplementA(const CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? static_cast(csgso->isSetComplementA()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementB" + * attribute is set. + */ +LIBSBML_EXTERN +int +CSGSetOperator_isSetComplementB(const CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? static_cast(csgso->isSetComplementB()) : 0; +} + + +/* + * Sets the value of the "operationType" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_setOperationType(CSGSetOperator_t * csgso, + SetOperation_t operationType) +{ + return (csgso != NULL) ? csgso->setOperationType(operationType) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "operationType" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_setOperationTypeAsString(CSGSetOperator_t * csgso, + const char * operationType) +{ + return (csgso != NULL) ? csgso->setOperationType(operationType): + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "complementA" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_setComplementA(CSGSetOperator_t * csgso, + const char * complementA) +{ + return (csgso != NULL) ? csgso->setComplementA(complementA) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "complementB" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_setComplementB(CSGSetOperator_t * csgso, + const char * complementB) +{ + return (csgso != NULL) ? csgso->setComplementB(complementB) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "operationType" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_unsetOperationType(CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? csgso->unsetOperationType() : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "complementA" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_unsetComplementA(CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? csgso->unsetComplementA() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "complementB" attribute of this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_unsetComplementB(CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? csgso->unsetComplementB() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing CSGNode_t objects from this + * CSGSetOperator_t. + */ +LIBSBML_EXTERN +ListOf_t* +CSGSetOperator_getListOfCSGNodes(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->getListOfCSGNodes() : NULL; +} + + +/* + * Get a CSGNode_t from the CSGSetOperator_t. + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_getCSGNode(CSGSetOperator_t* csgso, unsigned int n) +{ + return (csgso != NULL) ? csgso->getCSGNode(n) : NULL; +} + + +/* + * Get a CSGNode_t from the CSGSetOperator_t based on its identifier. + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_getCSGNodeById(CSGSetOperator_t* csgso, const char *sid) +{ + return (csgso != NULL && sid != NULL) ? csgso->getCSGNode(sid) : NULL; +} + + +/* + * Adds a copy of the given CSGNode_t to this CSGSetOperator_t. + */ +LIBSBML_EXTERN +int +CSGSetOperator_addCSGNode(CSGSetOperator_t* csgso, const CSGNode_t* csgn) +{ + return (csgso != NULL) ? csgso->addCSGNode(csgn) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of CSGNode_t objects in this CSGSetOperator_t. + */ +LIBSBML_EXTERN +unsigned int +CSGSetOperator_getNumCSGNodes(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->getNumCSGNodes() : SBML_INT_MAX; +} + + +/* + * Creates a new CSGPrimitive_t object, adds it to this CSGSetOperator_t object + * and returns the CSGPrimitive_t object created. + */ +LIBSBML_EXTERN +CSGPrimitive_t* +CSGSetOperator_createCSGPrimitive(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->createCSGPrimitive() : NULL; +} + + +/* + * Creates a new CSGTranslation_t object, adds it to this CSGSetOperator_t + * object and returns the CSGTranslation_t object created. + */ +LIBSBML_EXTERN +CSGTranslation_t* +CSGSetOperator_createCSGTranslation(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->createCSGTranslation() : NULL; +} + + +/* + * Creates a new CSGRotation_t object, adds it to this CSGSetOperator_t object + * and returns the CSGRotation_t object created. + */ +LIBSBML_EXTERN +CSGRotation_t* +CSGSetOperator_createCSGRotation(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->createCSGRotation() : NULL; +} + + +/* + * Creates a new CSGScale_t object, adds it to this CSGSetOperator_t object and + * returns the CSGScale_t object created. + */ +LIBSBML_EXTERN +CSGScale_t* +CSGSetOperator_createCSGScale(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->createCSGScale() : NULL; +} + + +/* + * Creates a new CSGHomogeneousTransformation_t object, adds it to this + * CSGSetOperator_t object and returns the CSGHomogeneousTransformation_t + * object created. + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t* +CSGSetOperator_createCSGHomogeneousTransformation(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->createCSGHomogeneousTransformation() : NULL; +} + + +/* + * Creates a new CSGSetOperator_t object, adds it to this CSGSetOperator_t + * object and returns the CSGSetOperator_t object created. + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGSetOperator_createCSGSetOperator(CSGSetOperator_t* csgso) +{ + return (csgso != NULL) ? csgso->createCSGSetOperator() : NULL; +} + + +/* + * Removes the nth CSGNode_t from this CSGSetOperator_t and returns a pointer + * to it. + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_removeCSGNode(CSGSetOperator_t* csgso, unsigned int n) +{ + return (csgso != NULL) ? csgso->removeCSGNode(n) : NULL; +} + + +/* + * Removes the CSGNode_t from this CSGSetOperator_t based on its identifier and + * returns a pointer to it. + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_removeCSGNodeById(CSGSetOperator_t* csgso, const char* sid) +{ + return (csgso != NULL && sid != NULL) ? csgso->removeCSGNode(sid) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGSetOperator_t object have been set. + */ +LIBSBML_EXTERN +int +CSGSetOperator_hasRequiredAttributes(const CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? static_cast(csgso->hasRequiredAttributes()) : + 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * CSGSetOperator_t object have been set. + */ +LIBSBML_EXTERN +int +CSGSetOperator_hasRequiredElements(const CSGSetOperator_t * csgso) +{ + return (csgso != NULL) ? static_cast(csgso->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/CSGSetOperator.h b/generator/tests/test_cpp_code/test-code/CSGSetOperator.h index f629087c..9c61411a 100644 --- a/generator/tests/test_cpp_code/test-code/CSGSetOperator.h +++ b/generator/tests/test_cpp_code/test-code/CSGSetOperator.h @@ -1,1861 +1,1861 @@ -/** - * @file CSGSetOperator.h - * @brief Definition of the CSGSetOperator class. - * @author SBMLTeam - * - * - * - * @class CSGSetOperator - * @sbmlbrief{spatial} TODO:Definition of the CSGSetOperator class. - */ - -/** - * - * - * - * @class doc_csgsetoperator_operationType - * - * @par - * The attribute "operationType" on a CSGSetOperator object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Spatial specification, the following are the - * allowable values for "operationType": - *
    - *
  • @c "union", TODO:add description - * - *
  • @c "intersection", TODO:add description - * - *
  • @c "relativeComplement", TODO:add description - * - *
- */ - - -#ifndef CSGSetOperator_H__ -#define CSGSetOperator_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN CSGSetOperator : public CSGNode -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - SetOperation_t mOperationType; - std::string mComplementA; - std::string mComplementB; - ListOfCSGNodes mCSGNodes; - - /** @endcond */ - -public: - - /** - * Creates a new CSGSetOperator using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CSGSetOperator. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGSetOperator. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGSetOperator. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGSetOperator(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new CSGSetOperator using the given SpatialPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGSetOperator(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for CSGSetOperator. - * - * @param orig the CSGSetOperator instance to copy. - */ - CSGSetOperator(const CSGSetOperator& orig); - - - /** - * Assignment operator for CSGSetOperator. - * - * @param rhs the CSGSetOperator object whose values are to be used as the - * basis of the assignment. - */ - CSGSetOperator& operator=(const CSGSetOperator& rhs); - - - /** - * Creates and returns a deep copy of this CSGSetOperator object. - * - * @return a (deep) copy of this CSGSetOperator object. - */ - virtual CSGSetOperator* clone() const; - - - /** - * Destructor for CSGSetOperator. - */ - virtual ~CSGSetOperator(); - - - /** - * Returns the value of the "operationType" attribute of this CSGSetOperator. - * - * @return the value of the "operationType" attribute of this CSGSetOperator - * as a SetOperation_t. - * - * @copydetails doc_csgsetoperator_operationType - * @if clike The value is drawn from the enumeration @ref SetOperation_t - * @endif - * The possible values returned by this method are: - * @li @sbmlconstant{SPATIAL_SETOPERATION_UNION, SetOperation_t} - * @li @sbmlconstant{SPATIAL_SETOPERATION_INTERSECTION, SetOperation_t} - * @li @sbmlconstant{SPATIAL_SETOPERATION_RELATIVECOMPLEMENT, SetOperation_t} - * @li @sbmlconstant{SPATIAL_SETOPERATION_INVALID, SetOperation_t} - */ - SetOperation_t getOperationType() const; - - - /** - * Returns the value of the "operationType" attribute of this CSGSetOperator. - * - * @return the value of the "operationType" attribute of this CSGSetOperator - * as a string. - * - * @copydetails doc_csgsetoperator_operationType - * The possible values returned by this method are: - * @li @c "union" - * @li @c "intersection" - * @li @c "relativeComplement" - * @li @c "invalid SetOperation value" - */ - std::string getOperationTypeAsString() const; - - - /** - * Returns the value of the "complementA" attribute of this CSGSetOperator. - * - * @return the value of the "complementA" attribute of this CSGSetOperator as - * a string. - */ - const std::string& getComplementA() const; - - - /** - * Returns the value of the "complementB" attribute of this CSGSetOperator. - * - * @return the value of the "complementB" attribute of this CSGSetOperator as - * a string. - */ - const std::string& getComplementB() const; - - - /** - * Predicate returning @c true if this CSGSetOperator's "operationType" - * attribute is set. - * - * @return @c true if this CSGSetOperator's "operationType" attribute has - * been set, otherwise @c false is returned. - * - * @copydetails doc_csgsetoperator_operationType - */ - bool isSetOperationType() const; - - - /** - * Predicate returning @c true if this CSGSetOperator's "complementA" - * attribute is set. - * - * @return @c true if this CSGSetOperator's "complementA" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetComplementA() const; - - - /** - * Predicate returning @c true if this CSGSetOperator's "complementB" - * attribute is set. - * - * @return @c true if this CSGSetOperator's "complementB" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetComplementB() const; - - - /** - * Sets the value of the "operationType" attribute of this CSGSetOperator. - * - * @param operationType @if clike SetOperation_t@else int@endif value of the - * "operationType" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_csgsetoperator_operationType - */ - int setOperationType(const SetOperation_t operationType); - - - /** - * Sets the value of the "operationType" attribute of this CSGSetOperator. - * - * @param operationType std::string& of the "operationType" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_csgsetoperator_operationType - */ - int setOperationType(const std::string& operationType); - - - /** - * Sets the value of the "complementA" attribute of this CSGSetOperator. - * - * @param complementA std::string& value of the "complementA" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setComplementA(const std::string& complementA); - - - /** - * Sets the value of the "complementB" attribute of this CSGSetOperator. - * - * @param complementB std::string& value of the "complementB" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setComplementB(const std::string& complementB); - - - /** - * Unsets the value of the "operationType" attribute of this CSGSetOperator. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_csgsetoperator_operationType - */ - int unsetOperationType(); - - - /** - * Unsets the value of the "complementA" attribute of this CSGSetOperator. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetComplementA(); - - - /** - * Unsets the value of the "complementB" attribute of this CSGSetOperator. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetComplementB(); - - - /** - * Returns the ListOfCSGNodes from this CSGSetOperator. - * - * @return the ListOfCSGNodes from this CSGSetOperator. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - const ListOfCSGNodes* getListOfCSGNodes() const; - - - /** - * Returns the ListOfCSGNodes from this CSGSetOperator. - * - * @return the ListOfCSGNodes from this CSGSetOperator. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - ListOfCSGNodes* getListOfCSGNodes(); - - - /** - * Get a CSGNode from the CSGSetOperator. - * - * @param n an unsigned int representing the index of the CSGNode to - * retrieve. - * - * @return the nth CSGNode in the ListOfCSGNodes within this CSGSetOperator - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGNode* getCSGNode(unsigned int n); - - - /** - * Get a CSGNode from the CSGSetOperator. - * - * @param n an unsigned int representing the index of the CSGNode to - * retrieve. - * - * @return the nth CSGNode in the ListOfCSGNodes within this CSGSetOperator - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - const CSGNode* getCSGNode(unsigned int n) const; - - - /** - * Get a CSGNode from the CSGSetOperator based on its identifier. - * - * @param sid a string representing the identifier of the CSGNode to - * retrieve. - * - * @return the CSGNode in the ListOfCSGNodes within this CSGSetOperator with - * the given @p sid or @c NULL if no such CSGNode exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGNode* getCSGNode(const std::string& sid); - - - /** - * Get a CSGNode from the CSGSetOperator based on its identifier. - * - * @param sid a string representing the identifier of the CSGNode to - * retrieve. - * - * @return the CSGNode in the ListOfCSGNodes within this CSGSetOperator with - * the given @p sid or @c NULL if no such CSGNode exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - const CSGNode* getCSGNode(const std::string& sid) const; - - - /** - * Adds a copy of the given CSGNode to this CSGSetOperator. - * - * @param csgn the CSGNode object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - int addCSGNode(const CSGNode* csgn); - - - /** - * Get the number of CSGNode objects in this CSGSetOperator. - * - * @return the number of CSGNode objects in this CSGSetOperator. - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - unsigned int getNumCSGNodes() const; - - - /** - * Creates a new CSGPrimitive object, adds it to this CSGSetOperator object - * and returns the CSGPrimitive object created. - * - * @return a new CSGPrimitive object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGPrimitive* createCSGPrimitive(); - - - /** - * Creates a new CSGTranslation object, adds it to this CSGSetOperator object - * and returns the CSGTranslation object created. - * - * @return a new CSGTranslation object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGTranslation* createCSGTranslation(); - - - /** - * Creates a new CSGRotation object, adds it to this CSGSetOperator object - * and returns the CSGRotation object created. - * - * @return a new CSGRotation object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGRotation* createCSGRotation(); - - - /** - * Creates a new CSGScale object, adds it to this CSGSetOperator object and - * returns the CSGScale object created. - * - * @return a new CSGScale object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGScale* createCSGScale(); - - - /** - * Creates a new CSGHomogeneousTransformation object, adds it to this - * CSGSetOperator object and returns the CSGHomogeneousTransformation object - * created. - * - * @return a new CSGHomogeneousTransformation object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGHomogeneousTransformation* createCSGHomogeneousTransformation(); - - - /** - * Creates a new CSGSetOperator object, adds it to this CSGSetOperator object - * and returns the CSGSetOperator object created. - * - * @return a new CSGSetOperator object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - * @see removeCSGNode(unsigned int n) - */ - CSGSetOperator* createCSGSetOperator(); - - - /** - * Removes the nth CSGNode from this CSGSetOperator and returns a pointer to - * it. - * - * @param n an unsigned int representing the index of the CSGNode to remove. - * - * @return a pointer to the nth CSGNode in this CSGSetOperator. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(const std::string& sid) - */ - CSGNode* removeCSGNode(unsigned int n); - - - /** - * Removes the CSGNode from this CSGSetOperator based on its identifier and - * returns a pointer to it. - * - * @param sid a string representing the identifier of the CSGNode to remove. - * - * @return the CSGNode in this CSGSetOperator based on the identifier or NULL - * if no such CSGNode exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addCSGNode(const CSGNode* object) - * @see createCSGNode() - * @see getCSGNode(const std::string& sid) - * @see getCSGNode(unsigned int n) - * @see getNumCSGNodes() - * @see removeCSGNode(unsigned int n) - */ - CSGNode* removeCSGNode(const std::string& sid); - - - /** - * @copydoc doc_renamesidref_common - */ - virtual void renameSIdRefs(const std::string& oldid, - const std::string& newid); - - - /** - * Returns the XML element name of this CSGSetOperator object. - * - * For CSGSetOperator, the XML element name is always @c "csgSetOperator". - * - * @return the name of this element, i.e. @c "csgSetOperator". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this CSGSetOperator object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_CSGSETOPERATOR, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * CSGSetOperator object have been set. - * - * @return @c true to indicate that all the required attributes of this - * CSGSetOperator have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the CSGSetOperator object are: - * @li "operationType" - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * CSGSetOperator object have been set. - * - * @return @c true to indicate that all the required elements of this - * CSGSetOperator have been set, otherwise @c false is returned. - * - * - * @note The required elements for the CSGSetOperator object are: - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this CSGSetOperator's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this CSGSetOperator's attribute "attributeName" has - * been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this CSGSetOperator. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this CSGSetOperator. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this CSGSetOperator. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * CSGSetOperator. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this CSGSetOperator. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this CSGSetOperator. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new CSGSetOperator_t using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CSGSetOperator_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGSetOperator_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGSetOperator_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGSetOperator_t * -CSGSetOperator_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this CSGSetOperator_t object. - * - * @param csgso the CSGSetOperator_t structure. - * - * @return a (deep) copy of this CSGSetOperator_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGSetOperator_clone(const CSGSetOperator_t* csgso); - - -/** - * Frees this CSGSetOperator_t object. - * - * @param csgso the CSGSetOperator_t structure. - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -void -CSGSetOperator_free(CSGSetOperator_t* csgso); - - -/** - * Returns the value of the "operationType" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure whose operationType is sought. - * - * @return the value of the "operationType" attribute of this CSGSetOperator_t - * as a SetOperation_t. - * - * @copydetails doc_csgsetoperator_operationType - * @if clike The value is drawn from the enumeration @ref SetOperation_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{SPATIAL_SETOPERATION_UNION, SetOperation_t} - * @li @sbmlconstant{SPATIAL_SETOPERATION_INTERSECTION, SetOperation_t} - * @li @sbmlconstant{SPATIAL_SETOPERATION_RELATIVECOMPLEMENT, SetOperation_t} - * @li @sbmlconstant{SPATIAL_SETOPERATION_INVALID, SetOperation_t} - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -SetOperation_t -CSGSetOperator_getOperationType(const CSGSetOperator_t * csgso); - - -/** - * Returns the value of the "operationType" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure whose operationType is sought. - * - * @return the value of the "operationType" attribute of this CSGSetOperator_t - * as a const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_csgsetoperator_operationType - * The possible values returned by this method are: - * @li @c "union" - * @li @c "intersection" - * @li @c "relativeComplement" - * @li @c "invalid SetOperation value" - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -char * -CSGSetOperator_getOperationTypeAsString(const CSGSetOperator_t * csgso); - - -/** - * Returns the value of the "complementA" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure whose complementA is sought. - * - * @return the value of the "complementA" attribute of this CSGSetOperator_t as - * a pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -char * -CSGSetOperator_getComplementA(const CSGSetOperator_t * csgso); - - -/** - * Returns the value of the "complementB" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure whose complementB is sought. - * - * @return the value of the "complementB" attribute of this CSGSetOperator_t as - * a pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -char * -CSGSetOperator_getComplementB(const CSGSetOperator_t * csgso); - - -/** - * Predicate returning @c 1 (true) if this CSGSetOperator_t's "operationType" - * attribute is set. - * - * @param csgso the CSGSetOperator_t structure. - * - * @return @c 1 (true) if this CSGSetOperator_t's "operationType" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @copydetails doc_csgsetoperator_operationType - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_isSetOperationType(const CSGSetOperator_t * csgso); - - -/** - * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementA" - * attribute is set. - * - * @param csgso the CSGSetOperator_t structure. - * - * @return @c 1 (true) if this CSGSetOperator_t's "complementA" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_isSetComplementA(const CSGSetOperator_t * csgso); - - -/** - * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementB" - * attribute is set. - * - * @param csgso the CSGSetOperator_t structure. - * - * @return @c 1 (true) if this CSGSetOperator_t's "complementB" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_isSetComplementB(const CSGSetOperator_t * csgso); - - -/** - * Sets the value of the "operationType" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure. - * - * @param operationType SetOperation_t value of the "operationType" attribute - * to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_csgsetoperator_operationType - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_setOperationType(CSGSetOperator_t * csgso, - SetOperation_t operationType); - - -/** - * Sets the value of the "operationType" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure. - * - * @param operationType const char * of the "operationType" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_csgsetoperator_operationType - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_setOperationTypeAsString(CSGSetOperator_t * csgso, - const char * operationType); - - -/** - * Sets the value of the "complementA" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure. - * - * @param complementA const char * value of the "complementA" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_setComplementA(CSGSetOperator_t * csgso, - const char * complementA); - - -/** - * Sets the value of the "complementB" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure. - * - * @param complementB const char * value of the "complementB" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_setComplementB(CSGSetOperator_t * csgso, - const char * complementB); - - -/** - * Unsets the value of the "operationType" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_csgsetoperator_operationType - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_unsetOperationType(CSGSetOperator_t * csgso); - - -/** - * Unsets the value of the "complementA" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_unsetComplementA(CSGSetOperator_t * csgso); - - -/** - * Unsets the value of the "complementB" attribute of this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_unsetComplementB(CSGSetOperator_t * csgso); - - -/** - * Returns a ListOf_t * containing CSGNode_t objects from this - * CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure whose ListOfCSGNodes is sought. - * - * @return the ListOfCSGNodes from this CSGSetOperator_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see CSGSetOperator_addCSGNode() - * @see CSGSetOperator_createCSGNode() - * @see CSGSetOperator_getCSGNodeById() - * @see CSGSetOperator_getCSGNode() - * @see CSGSetOperator_getNumCSGNodes() - * @see CSGSetOperator_removeCSGNodeById() - * @see CSGSetOperator_removeCSGNode() - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -ListOf_t* -CSGSetOperator_getListOfCSGNodes(CSGSetOperator_t* csgso); - - -/** - * Get a CSGNode_t from the CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure to search. - * - * @param n an unsigned int representing the index of the CSGNode_t to - * retrieve. - * - * @return the nth CSGNode_t in the ListOfCSGNodes within this CSGSetOperator - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_getCSGNode(CSGSetOperator_t* csgso, unsigned int n); - - -/** - * Get a CSGNode_t from the CSGSetOperator_t based on its identifier. - * - * @param csgso the CSGSetOperator_t structure to search. - * - * @param sid a string representing the identifier of the CSGNode_t to - * retrieve. - * - * @return the CSGNode_t in the ListOfCSGNodes within this CSGSetOperator with - * the given @p sid or @c NULL if no such CSGNode_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_getCSGNodeById(CSGSetOperator_t* csgso, const char *sid); - - -/** - * Adds a copy of the given CSGNode_t to this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure to which the CSGNode_t should be - * added. - * - * @param csgn the CSGNode_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_addCSGNode(CSGSetOperator_t* csgso, const CSGNode_t* csgn); - - -/** - * Get the number of CSGNode_t objects in this CSGSetOperator_t. - * - * @param csgso the CSGSetOperator_t structure to query. - * - * @return the number of CSGNode_t objects in this CSGSetOperator_t. - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -unsigned int -CSGSetOperator_getNumCSGNodes(CSGSetOperator_t* csgso); - - -/** - * Creates a new CSGPrimitive_t object, adds it to this CSGSetOperator_t object - * and returns the CSGPrimitive_t object created. - * - * @param csgso the CSGSetOperator_t structure to which the CSGPrimitive_t - * should be added. - * - * @return a new CSGPrimitive_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGPrimitive_t* -CSGSetOperator_createCSGPrimitive(CSGSetOperator_t* csgso); - - -/** - * Creates a new CSGTranslation_t object, adds it to this CSGSetOperator_t - * object and returns the CSGTranslation_t object created. - * - * @param csgso the CSGSetOperator_t structure to which the CSGTranslation_t - * should be added. - * - * @return a new CSGTranslation_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGTranslation_t* -CSGSetOperator_createCSGTranslation(CSGSetOperator_t* csgso); - - -/** - * Creates a new CSGRotation_t object, adds it to this CSGSetOperator_t object - * and returns the CSGRotation_t object created. - * - * @param csgso the CSGSetOperator_t structure to which the CSGRotation_t - * should be added. - * - * @return a new CSGRotation_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGRotation_t* -CSGSetOperator_createCSGRotation(CSGSetOperator_t* csgso); - - -/** - * Creates a new CSGScale_t object, adds it to this CSGSetOperator_t object and - * returns the CSGScale_t object created. - * - * @param csgso the CSGSetOperator_t structure to which the CSGScale_t should - * be added. - * - * @return a new CSGScale_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGScale_t* -CSGSetOperator_createCSGScale(CSGSetOperator_t* csgso); - - -/** - * Creates a new CSGHomogeneousTransformation_t object, adds it to this - * CSGSetOperator_t object and returns the CSGHomogeneousTransformation_t - * object created. - * - * @param csgso the CSGSetOperator_t structure to which the - * CSGHomogeneousTransformation_t should be added. - * - * @return a new CSGHomogeneousTransformation_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t* -CSGSetOperator_createCSGHomogeneousTransformation(CSGSetOperator_t* csgso); - - -/** - * Creates a new CSGSetOperator_t object, adds it to this CSGSetOperator_t - * object and returns the CSGSetOperator_t object created. - * - * @param csgso the CSGSetOperator_t structure to which the CSGSetOperator_t - * should be added. - * - * @return a new CSGSetOperator_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGSetOperator_createCSGSetOperator(CSGSetOperator_t* csgso); - - -/** - * Removes the nth CSGNode_t from this CSGSetOperator_t and returns a pointer - * to it. - * - * @param csgso the CSGSetOperator_t structure to search. - * - * @param n an unsigned int representing the index of the CSGNode_t to remove. - * - * @return a pointer to the nth CSGNode_t in this CSGSetOperator_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_removeCSGNode(CSGSetOperator_t* csgso, unsigned int n); - - -/** - * Removes the CSGNode_t from this CSGSetOperator_t based on its identifier and - * returns a pointer to it. - * - * @param csgso the CSGSetOperator_t structure to search. - * - * @param sid a string representing the identifier of the CSGNode_t to remove. - * - * @return the CSGNode_t in this CSGSetOperator_t based on the identifier or - * NULL if no such CSGNode_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -CSGNode_t* -CSGSetOperator_removeCSGNodeById(CSGSetOperator_t* csgso, const char* sid); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGSetOperator_t object have been set. - * - * @param csgso the CSGSetOperator_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * CSGSetOperator_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the CSGSetOperator_t object are: - * @li "operationType" - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_hasRequiredAttributes(const CSGSetOperator_t * csgso); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * CSGSetOperator_t object have been set. - * - * @param csgso the CSGSetOperator_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * CSGSetOperator_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the CSGSetOperator_t object are: - * - * @memberof CSGSetOperator_t - */ -LIBSBML_EXTERN -int -CSGSetOperator_hasRequiredElements(const CSGSetOperator_t * csgso); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !CSGSetOperator_H__ */ - - +/** + * @file CSGSetOperator.h + * @brief Definition of the CSGSetOperator class. + * @author SBMLTeam + * + * + * + * @class CSGSetOperator + * @sbmlbrief{spatial} TODO:Definition of the CSGSetOperator class. + */ + +/** + * + * + * + * @class doc_csgsetoperator_operationType + * + * @par + * The attribute "operationType" on a CSGSetOperator object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Spatial specification, the following are the + * allowable values for "operationType": + *
    + *
  • @c "union", TODO:add description + * + *
  • @c "intersection", TODO:add description + * + *
  • @c "relativeComplement", TODO:add description + * + *
+ */ + + +#ifndef CSGSetOperator_H__ +#define CSGSetOperator_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN CSGSetOperator : public CSGNode +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + SetOperation_t mOperationType; + std::string mComplementA; + std::string mComplementB; + ListOfCSGNodes mCSGNodes; + + /** @endcond */ + +public: + + /** + * Creates a new CSGSetOperator using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CSGSetOperator. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGSetOperator. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGSetOperator. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGSetOperator(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new CSGSetOperator using the given SpatialPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGSetOperator(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for CSGSetOperator. + * + * @param orig the CSGSetOperator instance to copy. + */ + CSGSetOperator(const CSGSetOperator& orig); + + + /** + * Assignment operator for CSGSetOperator. + * + * @param rhs the CSGSetOperator object whose values are to be used as the + * basis of the assignment. + */ + CSGSetOperator& operator=(const CSGSetOperator& rhs); + + + /** + * Creates and returns a deep copy of this CSGSetOperator object. + * + * @return a (deep) copy of this CSGSetOperator object. + */ + virtual CSGSetOperator* clone() const; + + + /** + * Destructor for CSGSetOperator. + */ + virtual ~CSGSetOperator(); + + + /** + * Returns the value of the "operationType" attribute of this CSGSetOperator. + * + * @return the value of the "operationType" attribute of this CSGSetOperator + * as a SetOperation_t. + * + * @copydetails doc_csgsetoperator_operationType + * @if clike The value is drawn from the enumeration @ref SetOperation_t + * @endif + * The possible values returned by this method are: + * @li @sbmlconstant{SPATIAL_SETOPERATION_UNION, SetOperation_t} + * @li @sbmlconstant{SPATIAL_SETOPERATION_INTERSECTION, SetOperation_t} + * @li @sbmlconstant{SPATIAL_SETOPERATION_RELATIVECOMPLEMENT, SetOperation_t} + * @li @sbmlconstant{SPATIAL_SETOPERATION_INVALID, SetOperation_t} + */ + SetOperation_t getOperationType() const; + + + /** + * Returns the value of the "operationType" attribute of this CSGSetOperator. + * + * @return the value of the "operationType" attribute of this CSGSetOperator + * as a string. + * + * @copydetails doc_csgsetoperator_operationType + * The possible values returned by this method are: + * @li @c "union" + * @li @c "intersection" + * @li @c "relativeComplement" + * @li @c "invalid SetOperation value" + */ + std::string getOperationTypeAsString() const; + + + /** + * Returns the value of the "complementA" attribute of this CSGSetOperator. + * + * @return the value of the "complementA" attribute of this CSGSetOperator as + * a string. + */ + const std::string& getComplementA() const; + + + /** + * Returns the value of the "complementB" attribute of this CSGSetOperator. + * + * @return the value of the "complementB" attribute of this CSGSetOperator as + * a string. + */ + const std::string& getComplementB() const; + + + /** + * Predicate returning @c true if this CSGSetOperator's "operationType" + * attribute is set. + * + * @return @c true if this CSGSetOperator's "operationType" attribute has + * been set, otherwise @c false is returned. + * + * @copydetails doc_csgsetoperator_operationType + */ + bool isSetOperationType() const; + + + /** + * Predicate returning @c true if this CSGSetOperator's "complementA" + * attribute is set. + * + * @return @c true if this CSGSetOperator's "complementA" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetComplementA() const; + + + /** + * Predicate returning @c true if this CSGSetOperator's "complementB" + * attribute is set. + * + * @return @c true if this CSGSetOperator's "complementB" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetComplementB() const; + + + /** + * Sets the value of the "operationType" attribute of this CSGSetOperator. + * + * @param operationType @if clike SetOperation_t@else int@endif value of the + * "operationType" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_csgsetoperator_operationType + */ + int setOperationType(const SetOperation_t operationType); + + + /** + * Sets the value of the "operationType" attribute of this CSGSetOperator. + * + * @param operationType std::string& of the "operationType" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_csgsetoperator_operationType + */ + int setOperationType(const std::string& operationType); + + + /** + * Sets the value of the "complementA" attribute of this CSGSetOperator. + * + * @param complementA std::string& value of the "complementA" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setComplementA(const std::string& complementA); + + + /** + * Sets the value of the "complementB" attribute of this CSGSetOperator. + * + * @param complementB std::string& value of the "complementB" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setComplementB(const std::string& complementB); + + + /** + * Unsets the value of the "operationType" attribute of this CSGSetOperator. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_csgsetoperator_operationType + */ + int unsetOperationType(); + + + /** + * Unsets the value of the "complementA" attribute of this CSGSetOperator. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetComplementA(); + + + /** + * Unsets the value of the "complementB" attribute of this CSGSetOperator. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetComplementB(); + + + /** + * Returns the ListOfCSGNodes from this CSGSetOperator. + * + * @return the ListOfCSGNodes from this CSGSetOperator. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + const ListOfCSGNodes* getListOfCSGNodes() const; + + + /** + * Returns the ListOfCSGNodes from this CSGSetOperator. + * + * @return the ListOfCSGNodes from this CSGSetOperator. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + ListOfCSGNodes* getListOfCSGNodes(); + + + /** + * Get a CSGNode from the CSGSetOperator. + * + * @param n an unsigned int representing the index of the CSGNode to + * retrieve. + * + * @return the nth CSGNode in the ListOfCSGNodes within this CSGSetOperator + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGNode* getCSGNode(unsigned int n); + + + /** + * Get a CSGNode from the CSGSetOperator. + * + * @param n an unsigned int representing the index of the CSGNode to + * retrieve. + * + * @return the nth CSGNode in the ListOfCSGNodes within this CSGSetOperator + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + const CSGNode* getCSGNode(unsigned int n) const; + + + /** + * Get a CSGNode from the CSGSetOperator based on its identifier. + * + * @param sid a string representing the identifier of the CSGNode to + * retrieve. + * + * @return the CSGNode in the ListOfCSGNodes within this CSGSetOperator with + * the given @p sid or @c NULL if no such CSGNode exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGNode* getCSGNode(const std::string& sid); + + + /** + * Get a CSGNode from the CSGSetOperator based on its identifier. + * + * @param sid a string representing the identifier of the CSGNode to + * retrieve. + * + * @return the CSGNode in the ListOfCSGNodes within this CSGSetOperator with + * the given @p sid or @c NULL if no such CSGNode exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + const CSGNode* getCSGNode(const std::string& sid) const; + + + /** + * Adds a copy of the given CSGNode to this CSGSetOperator. + * + * @param csgn the CSGNode object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + int addCSGNode(const CSGNode* csgn); + + + /** + * Get the number of CSGNode objects in this CSGSetOperator. + * + * @return the number of CSGNode objects in this CSGSetOperator. + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + unsigned int getNumCSGNodes() const; + + + /** + * Creates a new CSGPrimitive object, adds it to this CSGSetOperator object + * and returns the CSGPrimitive object created. + * + * @return a new CSGPrimitive object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGPrimitive* createCSGPrimitive(); + + + /** + * Creates a new CSGTranslation object, adds it to this CSGSetOperator object + * and returns the CSGTranslation object created. + * + * @return a new CSGTranslation object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGTranslation* createCSGTranslation(); + + + /** + * Creates a new CSGRotation object, adds it to this CSGSetOperator object + * and returns the CSGRotation object created. + * + * @return a new CSGRotation object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGRotation* createCSGRotation(); + + + /** + * Creates a new CSGScale object, adds it to this CSGSetOperator object and + * returns the CSGScale object created. + * + * @return a new CSGScale object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGScale* createCSGScale(); + + + /** + * Creates a new CSGHomogeneousTransformation object, adds it to this + * CSGSetOperator object and returns the CSGHomogeneousTransformation object + * created. + * + * @return a new CSGHomogeneousTransformation object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGHomogeneousTransformation* createCSGHomogeneousTransformation(); + + + /** + * Creates a new CSGSetOperator object, adds it to this CSGSetOperator object + * and returns the CSGSetOperator object created. + * + * @return a new CSGSetOperator object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + * @see removeCSGNode(unsigned int n) + */ + CSGSetOperator* createCSGSetOperator(); + + + /** + * Removes the nth CSGNode from this CSGSetOperator and returns a pointer to + * it. + * + * @param n an unsigned int representing the index of the CSGNode to remove. + * + * @return a pointer to the nth CSGNode in this CSGSetOperator. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(const std::string& sid) + */ + CSGNode* removeCSGNode(unsigned int n); + + + /** + * Removes the CSGNode from this CSGSetOperator based on its identifier and + * returns a pointer to it. + * + * @param sid a string representing the identifier of the CSGNode to remove. + * + * @return the CSGNode in this CSGSetOperator based on the identifier or NULL + * if no such CSGNode exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addCSGNode(const CSGNode* object) + * @see createCSGNode() + * @see getCSGNode(const std::string& sid) + * @see getCSGNode(unsigned int n) + * @see getNumCSGNodes() + * @see removeCSGNode(unsigned int n) + */ + CSGNode* removeCSGNode(const std::string& sid); + + + /** + * @copydoc doc_renamesidref_common + */ + virtual void renameSIdRefs(const std::string& oldid, + const std::string& newid); + + + /** + * Returns the XML element name of this CSGSetOperator object. + * + * For CSGSetOperator, the XML element name is always @c "csgSetOperator". + * + * @return the name of this element, i.e. @c "csgSetOperator". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this CSGSetOperator object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_CSGSETOPERATOR, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CSGSetOperator object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CSGSetOperator have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the CSGSetOperator object are: + * @li "operationType" + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * CSGSetOperator object have been set. + * + * @return @c true to indicate that all the required elements of this + * CSGSetOperator have been set, otherwise @c false is returned. + * + * + * @note The required elements for the CSGSetOperator object are: + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this CSGSetOperator's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CSGSetOperator's attribute "attributeName" has + * been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CSGSetOperator. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this CSGSetOperator. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this CSGSetOperator. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CSGSetOperator. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this CSGSetOperator. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this CSGSetOperator. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CSGSetOperator_t using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CSGSetOperator_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGSetOperator_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGSetOperator_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGSetOperator_t * +CSGSetOperator_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this CSGSetOperator_t object. + * + * @param csgso the CSGSetOperator_t structure. + * + * @return a (deep) copy of this CSGSetOperator_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGSetOperator_clone(const CSGSetOperator_t* csgso); + + +/** + * Frees this CSGSetOperator_t object. + * + * @param csgso the CSGSetOperator_t structure. + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +void +CSGSetOperator_free(CSGSetOperator_t* csgso); + + +/** + * Returns the value of the "operationType" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure whose operationType is sought. + * + * @return the value of the "operationType" attribute of this CSGSetOperator_t + * as a SetOperation_t. + * + * @copydetails doc_csgsetoperator_operationType + * @if clike The value is drawn from the enumeration @ref SetOperation_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{SPATIAL_SETOPERATION_UNION, SetOperation_t} + * @li @sbmlconstant{SPATIAL_SETOPERATION_INTERSECTION, SetOperation_t} + * @li @sbmlconstant{SPATIAL_SETOPERATION_RELATIVECOMPLEMENT, SetOperation_t} + * @li @sbmlconstant{SPATIAL_SETOPERATION_INVALID, SetOperation_t} + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +SetOperation_t +CSGSetOperator_getOperationType(const CSGSetOperator_t * csgso); + + +/** + * Returns the value of the "operationType" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure whose operationType is sought. + * + * @return the value of the "operationType" attribute of this CSGSetOperator_t + * as a const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_csgsetoperator_operationType + * The possible values returned by this method are: + * @li @c "union" + * @li @c "intersection" + * @li @c "relativeComplement" + * @li @c "invalid SetOperation value" + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +char * +CSGSetOperator_getOperationTypeAsString(const CSGSetOperator_t * csgso); + + +/** + * Returns the value of the "complementA" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure whose complementA is sought. + * + * @return the value of the "complementA" attribute of this CSGSetOperator_t as + * a pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +char * +CSGSetOperator_getComplementA(const CSGSetOperator_t * csgso); + + +/** + * Returns the value of the "complementB" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure whose complementB is sought. + * + * @return the value of the "complementB" attribute of this CSGSetOperator_t as + * a pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +char * +CSGSetOperator_getComplementB(const CSGSetOperator_t * csgso); + + +/** + * Predicate returning @c 1 (true) if this CSGSetOperator_t's "operationType" + * attribute is set. + * + * @param csgso the CSGSetOperator_t structure. + * + * @return @c 1 (true) if this CSGSetOperator_t's "operationType" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @copydetails doc_csgsetoperator_operationType + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_isSetOperationType(const CSGSetOperator_t * csgso); + + +/** + * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementA" + * attribute is set. + * + * @param csgso the CSGSetOperator_t structure. + * + * @return @c 1 (true) if this CSGSetOperator_t's "complementA" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_isSetComplementA(const CSGSetOperator_t * csgso); + + +/** + * Predicate returning @c 1 (true) if this CSGSetOperator_t's "complementB" + * attribute is set. + * + * @param csgso the CSGSetOperator_t structure. + * + * @return @c 1 (true) if this CSGSetOperator_t's "complementB" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_isSetComplementB(const CSGSetOperator_t * csgso); + + +/** + * Sets the value of the "operationType" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure. + * + * @param operationType SetOperation_t value of the "operationType" attribute + * to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_csgsetoperator_operationType + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_setOperationType(CSGSetOperator_t * csgso, + SetOperation_t operationType); + + +/** + * Sets the value of the "operationType" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure. + * + * @param operationType const char * of the "operationType" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_csgsetoperator_operationType + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_setOperationTypeAsString(CSGSetOperator_t * csgso, + const char * operationType); + + +/** + * Sets the value of the "complementA" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure. + * + * @param complementA const char * value of the "complementA" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_setComplementA(CSGSetOperator_t * csgso, + const char * complementA); + + +/** + * Sets the value of the "complementB" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure. + * + * @param complementB const char * value of the "complementB" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_setComplementB(CSGSetOperator_t * csgso, + const char * complementB); + + +/** + * Unsets the value of the "operationType" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_csgsetoperator_operationType + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_unsetOperationType(CSGSetOperator_t * csgso); + + +/** + * Unsets the value of the "complementA" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_unsetComplementA(CSGSetOperator_t * csgso); + + +/** + * Unsets the value of the "complementB" attribute of this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_unsetComplementB(CSGSetOperator_t * csgso); + + +/** + * Returns a ListOf_t * containing CSGNode_t objects from this + * CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure whose ListOfCSGNodes is sought. + * + * @return the ListOfCSGNodes from this CSGSetOperator_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see CSGSetOperator_addCSGNode() + * @see CSGSetOperator_createCSGNode() + * @see CSGSetOperator_getCSGNodeById() + * @see CSGSetOperator_getCSGNode() + * @see CSGSetOperator_getNumCSGNodes() + * @see CSGSetOperator_removeCSGNodeById() + * @see CSGSetOperator_removeCSGNode() + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +ListOf_t* +CSGSetOperator_getListOfCSGNodes(CSGSetOperator_t* csgso); + + +/** + * Get a CSGNode_t from the CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure to search. + * + * @param n an unsigned int representing the index of the CSGNode_t to + * retrieve. + * + * @return the nth CSGNode_t in the ListOfCSGNodes within this CSGSetOperator + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_getCSGNode(CSGSetOperator_t* csgso, unsigned int n); + + +/** + * Get a CSGNode_t from the CSGSetOperator_t based on its identifier. + * + * @param csgso the CSGSetOperator_t structure to search. + * + * @param sid a string representing the identifier of the CSGNode_t to + * retrieve. + * + * @return the CSGNode_t in the ListOfCSGNodes within this CSGSetOperator with + * the given @p sid or @c NULL if no such CSGNode_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_getCSGNodeById(CSGSetOperator_t* csgso, const char *sid); + + +/** + * Adds a copy of the given CSGNode_t to this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure to which the CSGNode_t should be + * added. + * + * @param csgn the CSGNode_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_addCSGNode(CSGSetOperator_t* csgso, const CSGNode_t* csgn); + + +/** + * Get the number of CSGNode_t objects in this CSGSetOperator_t. + * + * @param csgso the CSGSetOperator_t structure to query. + * + * @return the number of CSGNode_t objects in this CSGSetOperator_t. + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +unsigned int +CSGSetOperator_getNumCSGNodes(CSGSetOperator_t* csgso); + + +/** + * Creates a new CSGPrimitive_t object, adds it to this CSGSetOperator_t object + * and returns the CSGPrimitive_t object created. + * + * @param csgso the CSGSetOperator_t structure to which the CSGPrimitive_t + * should be added. + * + * @return a new CSGPrimitive_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGPrimitive_t* +CSGSetOperator_createCSGPrimitive(CSGSetOperator_t* csgso); + + +/** + * Creates a new CSGTranslation_t object, adds it to this CSGSetOperator_t + * object and returns the CSGTranslation_t object created. + * + * @param csgso the CSGSetOperator_t structure to which the CSGTranslation_t + * should be added. + * + * @return a new CSGTranslation_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGTranslation_t* +CSGSetOperator_createCSGTranslation(CSGSetOperator_t* csgso); + + +/** + * Creates a new CSGRotation_t object, adds it to this CSGSetOperator_t object + * and returns the CSGRotation_t object created. + * + * @param csgso the CSGSetOperator_t structure to which the CSGRotation_t + * should be added. + * + * @return a new CSGRotation_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGRotation_t* +CSGSetOperator_createCSGRotation(CSGSetOperator_t* csgso); + + +/** + * Creates a new CSGScale_t object, adds it to this CSGSetOperator_t object and + * returns the CSGScale_t object created. + * + * @param csgso the CSGSetOperator_t structure to which the CSGScale_t should + * be added. + * + * @return a new CSGScale_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGScale_t* +CSGSetOperator_createCSGScale(CSGSetOperator_t* csgso); + + +/** + * Creates a new CSGHomogeneousTransformation_t object, adds it to this + * CSGSetOperator_t object and returns the CSGHomogeneousTransformation_t + * object created. + * + * @param csgso the CSGSetOperator_t structure to which the + * CSGHomogeneousTransformation_t should be added. + * + * @return a new CSGHomogeneousTransformation_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t* +CSGSetOperator_createCSGHomogeneousTransformation(CSGSetOperator_t* csgso); + + +/** + * Creates a new CSGSetOperator_t object, adds it to this CSGSetOperator_t + * object and returns the CSGSetOperator_t object created. + * + * @param csgso the CSGSetOperator_t structure to which the CSGSetOperator_t + * should be added. + * + * @return a new CSGSetOperator_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGSetOperator_createCSGSetOperator(CSGSetOperator_t* csgso); + + +/** + * Removes the nth CSGNode_t from this CSGSetOperator_t and returns a pointer + * to it. + * + * @param csgso the CSGSetOperator_t structure to search. + * + * @param n an unsigned int representing the index of the CSGNode_t to remove. + * + * @return a pointer to the nth CSGNode_t in this CSGSetOperator_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_removeCSGNode(CSGSetOperator_t* csgso, unsigned int n); + + +/** + * Removes the CSGNode_t from this CSGSetOperator_t based on its identifier and + * returns a pointer to it. + * + * @param csgso the CSGSetOperator_t structure to search. + * + * @param sid a string representing the identifier of the CSGNode_t to remove. + * + * @return the CSGNode_t in this CSGSetOperator_t based on the identifier or + * NULL if no such CSGNode_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +CSGNode_t* +CSGSetOperator_removeCSGNodeById(CSGSetOperator_t* csgso, const char* sid); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGSetOperator_t object have been set. + * + * @param csgso the CSGSetOperator_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CSGSetOperator_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the CSGSetOperator_t object are: + * @li "operationType" + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_hasRequiredAttributes(const CSGSetOperator_t * csgso); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * CSGSetOperator_t object have been set. + * + * @param csgso the CSGSetOperator_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * CSGSetOperator_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the CSGSetOperator_t object are: + * + * @memberof CSGSetOperator_t + */ +LIBSBML_EXTERN +int +CSGSetOperator_hasRequiredElements(const CSGSetOperator_t * csgso); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CSGSetOperator_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/CSGTransformation.cpp b/generator/tests/test_cpp_code/test-code/CSGTransformation.cpp index c323d574..199131f4 100644 --- a/generator/tests/test_cpp_code/test-code/CSGTransformation.cpp +++ b/generator/tests/test_cpp_code/test-code/CSGTransformation.cpp @@ -1,1525 +1,1525 @@ -/** - * @file CSGTransformation.cpp - * @brief Implementation of the CSGTransformation class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new CSGTransformation using the given SBML Level, Version and - * “spatial” package version. - */ -CSGTransformation::CSGTransformation(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : CSGNode(level, version, pkgVersion) - , mCSGNode (NULL) - , mElementName("csgTransformation") -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new CSGTransformation using the given SpatialPkgNamespaces object. - */ -CSGTransformation::CSGTransformation(SpatialPkgNamespaces *spatialns) - : CSGNode(spatialns) - , mCSGNode (NULL) - , mElementName("csgTransformation") -{ - setElementNamespace(spatialns->getURI()); - connectToChild(); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for CSGTransformation. - */ -CSGTransformation::CSGTransformation(const CSGTransformation& orig) - : CSGNode( orig ) - , mCSGNode ( NULL ) - , mElementName ( orig.mElementName ) -{ - if (orig.mCSGNode != NULL) - { - mCSGNode = orig.mCSGNode->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for CSGTransformation. - */ -CSGTransformation& -CSGTransformation::operator=(const CSGTransformation& rhs) -{ - if (&rhs != this) - { - CSGNode::operator=(rhs); - mElementName = rhs.mElementName; - delete mCSGNode; - if (rhs.mCSGNode != NULL) - { - mCSGNode = rhs.mCSGNode->clone(); - } - else - { - mCSGNode = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this CSGTransformation object. - */ -CSGTransformation* -CSGTransformation::clone() const -{ - return new CSGTransformation(*this); -} - - -/* - * Destructor for CSGTransformation. - */ -CSGTransformation::~CSGTransformation() -{ - delete mCSGNode; - mCSGNode = NULL; -} - - -/* - * Returns the value of the "csgNode" element of this CSGTransformation. - */ -const CSGNode* -CSGTransformation::getCSGNode() const -{ - return mCSGNode; -} - - -/* - * Returns the value of the "csgNode" element of this CSGTransformation. - */ -CSGNode* -CSGTransformation::getCSGNode() -{ - return mCSGNode; -} - - -/* - * Predicate returning @c true if this CSGTransformation's "csgNode" element is - * set. - */ -bool -CSGTransformation::isSetCSGNode() const -{ - return (mCSGNode != NULL); -} - - -/* - * Sets the value of the "csgNode" element of this CSGTransformation. - */ -int -CSGTransformation::setCSGNode(const CSGNode* csgNode) -{ - if (mCSGNode == csgNode) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (csgNode == NULL) - { - delete mCSGNode; - mCSGNode = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mCSGNode; - mCSGNode = (csgNode != NULL) ? csgNode->clone() : NULL; - if (mCSGNode != NULL) - { - mCSGNode->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new CSGPrimitive object, adds it to this CSGTransformation object - * and returns the CSGPrimitive object created. - */ -CSGPrimitive* -CSGTransformation::createCSGPrimitive() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGPrimitive(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGTranslation object, adds it to this CSGTransformation - * object and returns the CSGTranslation object created. - */ -CSGTranslation* -CSGTransformation::createCSGTranslation() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGTranslation(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGRotation object, adds it to this CSGTransformation object - * and returns the CSGRotation object created. - */ -CSGRotation* -CSGTransformation::createCSGRotation() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGRotation(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGScale object, adds it to this CSGTransformation object and - * returns the CSGScale object created. - */ -CSGScale* -CSGTransformation::createCSGScale() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGScale(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGHomogeneousTransformation object, adds it to this - * CSGTransformation object and returns the CSGHomogeneousTransformation object - * created. - */ -CSGHomogeneousTransformation* -CSGTransformation::createCSGHomogeneousTransformation() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGHomogeneousTransformation(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Creates a new CSGSetOperator object, adds it to this CSGTransformation - * object and returns the CSGSetOperator object created. - */ -CSGSetOperator* -CSGTransformation::createCSGSetOperator() -{ - if (mCSGNode != NULL) - { - delete mCSGNode; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mCSGNode = new CSGSetOperator(spatialns); - - delete spatialns; - - connectToChild(); - - return static_cast(mCSGNode); -} - - -/* - * Unsets the value of the "csgNode" element of this CSGTransformation. - */ -int -CSGTransformation::unsetCSGNode() -{ - delete mCSGNode; - mCSGNode = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Predicate returning @c true if this abstract "CSGTransformation" is of type - * CSGTranslation - */ -bool -CSGTransformation::isCSGTranslation() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGTransformation" is of type - * CSGRotation - */ -bool -CSGTransformation::isCSGRotation() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGTransformation" is of type - * CSGScale - */ -bool -CSGTransformation::isCSGScale() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "CSGTransformation" is of type - * CSGHomogeneousTransformation - */ -bool -CSGTransformation::isCSGHomogeneousTransformation() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Returns the XML element name of this CSGTransformation object. - */ -const std::string& -CSGTransformation::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this CSGTransformation object. - */ -void -CSGTransformation::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this CSGTransformation object. - */ -int -CSGTransformation::getTypeCode() const -{ - return SBML_SPATIAL_CSGTRANSFORMATION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * CSGTransformation object have been set. - */ -bool -CSGTransformation::hasRequiredAttributes() const -{ - bool allPresent = CSGNode::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * CSGTransformation object have been set. - */ -bool -CSGTransformation::hasRequiredElements() const -{ - bool allPresent = CSGNode::hasRequiredElements(); - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -CSGTransformation::writeElements(XMLOutputStream& stream) const -{ - CSGNode::writeElements(stream); - - if (isSetCSGNode() == true) - { - mCSGNode->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -CSGTransformation::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mCSGNode != NULL) - { - mCSGNode->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -CSGTransformation::setSBMLDocument(SBMLDocument* d) -{ - CSGNode::setSBMLDocument(d); - - if (mCSGNode != NULL) - { - mCSGNode->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -CSGTransformation::connectToChild() -{ - CSGNode::connectToChild(); - - if (mCSGNode != NULL) - { - mCSGNode->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -CSGTransformation::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - CSGNode::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetCSGNode()) - { - mCSGNode->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -CSGTransformation::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - CSGNode::updateSBMLNamespace(package, level, version); - - if (mCSGNode != NULL) - { - mCSGNode->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = CSGNode::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this CSGTransformation's attribute - * "attributeName" is set. - */ -bool -CSGTransformation::isSetAttribute(const std::string& attributeName) const -{ - bool value = CSGNode::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::setAttribute(const std::string& attributeName, int value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = CSGNode::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this CSGTransformation. - */ -int -CSGTransformation::unsetAttribute(const std::string& attributeName) -{ - int value = CSGNode::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this CSGTransformation. - */ -SBase* -CSGTransformation::createChildObject(const std::string& elementName) -{ - CSGNode* obj = NULL; - - if (elementName == "csgPrimitive") - { - return createCSGPrimitive(); - } - else if (elementName == "csgTranslation") - { - return createCSGTranslation(); - } - else if (elementName == "csgRotation") - { - return createCSGRotation(); - } - else if (elementName == "csgScale") - { - return createCSGScale(); - } - else if (elementName == "csgHomogeneousTransformation") - { - return createCSGHomogeneousTransformation(); - } - else if (elementName == "csgSetOperator") - { - return createCSGSetOperator(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this CSGTransformation. - */ -int -CSGTransformation::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "csgPrimitive" && element->getTypeCode() == - SBML_SPATIAL_CSGPRIMITIVE) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgTranslation" && element->getTypeCode() == - SBML_SPATIAL_CSGTRANSLATION) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgRotation" && element->getTypeCode() == - SBML_SPATIAL_CSGROTATION) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgScale" && element->getTypeCode() == - SBML_SPATIAL_CSGSCALE) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgHomogeneousTransformation" && - element->getTypeCode() == SBML_SPATIAL_CSGHOMOGENEOUSTRANSFORMATION) - { - return setCSGNode((const CSGNode*)(element)); - } - else if (elementName == "csgSetOperator" && element->getTypeCode() == - SBML_SPATIAL_CSGSETOPERATOR) - { - return setCSGNode((const CSGNode*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * CSGTransformation. - */ -SBase* -CSGTransformation::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "csgPrimitive") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgTranslation") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgRotation") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgScale") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgHomogeneousTransformation") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - else if (elementName == "csgSetOperator") - { - CSGNode * obj = mCSGNode; - mCSGNode = NULL; - return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this CSGTransformation. - */ -unsigned int -CSGTransformation::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "csgNode") - { - if (isSetCSGNode()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this CSGTransformation. - */ -SBase* -CSGTransformation::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "csgNode") - { - return getCSGNode(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -CSGTransformation::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCSGNode != NULL) - { - if (mCSGNode->getId() == id) - { - return mCSGNode; - } - - obj = mCSGNode->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -CSGTransformation::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCSGNode != NULL) - { - if (mCSGNode->getMetaId() == metaid) - { - return mCSGNode; - } - - obj = mCSGNode->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -CSGTransformation::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mCSGNode, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -CSGTransformation::createObject(XMLInputStream& stream) -{ - SBase* obj = CSGNode::createObject(stream); - - const std::string& name = stream.peek().getName(); - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - - if (name == "csgPrimitive") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGPrimitive(spatialns); - obj = mCSGNode; - } - else if (name == "csgTranslation") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGTranslation(spatialns); - obj = mCSGNode; - } - else if (name == "csgRotation") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGRotation(spatialns); - obj = mCSGNode; - } - else if (name == "csgScale") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGScale(spatialns); - obj = mCSGNode; - } - else if (name == "csgHomogeneousTransformation") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGHomogeneousTransformation(spatialns); - obj = mCSGNode; - } - else if (name == "csgSetOperator") - { - if (getErrorLog() && isSetCSGNode()) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mCSGNode; - mCSGNode = new CSGSetOperator(spatialns); - obj = mCSGNode; - } - - delete spatialns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -CSGTransformation::addExpectedAttributes(ExpectedAttributes& attributes) -{ - CSGNode::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -CSGTransformation::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - CSGNode::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialCSGTransformationAllowedAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialCSGTransformationAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -CSGTransformation::writeAttributes(XMLOutputStream& stream) const -{ - CSGNode::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new CSGTransformation_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGTransformation_t * -CSGTransformation_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGTransformation(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this CSGTransformation_t object. - */ -LIBSBML_EXTERN -CSGTransformation_t* -CSGTransformation_clone(const CSGTransformation_t* csgt) -{ - if (csgt != NULL) - { - return static_cast(csgt->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this CSGTransformation_t object. - */ -LIBSBML_EXTERN -void -CSGTransformation_free(CSGTransformation_t* csgt) -{ - if (csgt != NULL) - { - delete csgt; - } -} - - -/* - * Returns the value of the "csgNode" element of this CSGTransformation_t. - */ -LIBSBML_EXTERN -const CSGNode_t* -CSGTransformation_getCSGNode(const CSGTransformation_t * csgt) -{ - if (csgt == NULL) - { - return NULL; - } - - return (CSGNode_t*)(csgt->getCSGNode()); -} - - -/* - * Predicate returning @c 1 (true) if this CSGTransformation_t's "csgNode" - * element is set. - */ -LIBSBML_EXTERN -int -CSGTransformation_isSetCSGNode(const CSGTransformation_t * csgt) -{ - return (csgt != NULL) ? static_cast(csgt->isSetCSGNode()) : 0; -} - - -/* - * Sets the value of the "csgNode" element of this CSGTransformation_t. - */ -LIBSBML_EXTERN -int -CSGTransformation_setCSGNode(CSGTransformation_t * csgt, - const CSGNode_t* csgNode) -{ - return (csgt != NULL) ? csgt->setCSGNode(csgNode) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new CSGPrimitive_t object, adds it to this CSGTransformation_t - * object and returns the CSGPrimitive_t object created. - */ -LIBSBML_EXTERN -CSGPrimitive_t* -CSGTransformation_createCSGPrimitive(CSGTransformation_t* csgt) -{ - return (csgt != NULL) ? csgt->createCSGPrimitive() : NULL; -} - - -/* - * Creates a new CSGTranslation_t object, adds it to this CSGTransformation_t - * object and returns the CSGTranslation_t object created. - */ -LIBSBML_EXTERN -CSGTranslation_t* -CSGTransformation_createCSGTranslation(CSGTransformation_t* csgt) -{ - return (csgt != NULL) ? csgt->createCSGTranslation() : NULL; -} - - -/* - * Creates a new CSGRotation_t object, adds it to this CSGTransformation_t - * object and returns the CSGRotation_t object created. - */ -LIBSBML_EXTERN -CSGRotation_t* -CSGTransformation_createCSGRotation(CSGTransformation_t* csgt) -{ - return (csgt != NULL) ? csgt->createCSGRotation() : NULL; -} - - -/* - * Creates a new CSGScale_t object, adds it to this CSGTransformation_t object - * and returns the CSGScale_t object created. - */ -LIBSBML_EXTERN -CSGScale_t* -CSGTransformation_createCSGScale(CSGTransformation_t* csgt) -{ - return (csgt != NULL) ? csgt->createCSGScale() : NULL; -} - - -/* - * Creates a new CSGHomogeneousTransformation_t object, adds it to this - * CSGTransformation_t object and returns the CSGHomogeneousTransformation_t - * object created. - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t* -CSGTransformation_createCSGHomogeneousTransformation(CSGTransformation_t* csgt) -{ - return (csgt != NULL) ? csgt->createCSGHomogeneousTransformation() : NULL; -} - - -/* - * Creates a new CSGSetOperator_t object, adds it to this CSGTransformation_t - * object and returns the CSGSetOperator_t object created. - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGTransformation_createCSGSetOperator(CSGTransformation_t* csgt) -{ - return (csgt != NULL) ? csgt->createCSGSetOperator() : NULL; -} - - -/* - * Unsets the value of the "csgNode" element of this CSGTransformation_t. - */ -LIBSBML_EXTERN -int -CSGTransformation_unsetCSGNode(CSGTransformation_t * csgt) -{ - return (csgt != NULL) ? csgt->unsetCSGNode() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 if this CSGTransformation_t is of type - * CSGTranslation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGTranslation(const CSGTransformation_t * csgt) -{ - return (csgt != NULL) ? static_cast(csgt->isCSGTranslation()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGTransformation_t is of type - * CSGRotation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGRotation(const CSGTransformation_t * csgt) -{ - return (csgt != NULL) ? static_cast(csgt->isCSGRotation()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGTransformation_t is of type CSGScale_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGScale(const CSGTransformation_t * csgt) -{ - return (csgt != NULL) ? static_cast(csgt->isCSGScale()) : 0; -} - - -/* - * Predicate returning @c 1 if this CSGTransformation_t is of type - * CSGHomogeneousTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGHomogeneousTransformation(const CSGTransformation_t * - csgt) -{ - return (csgt != NULL) ? - static_cast(csgt->isCSGHomogeneousTransformation()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGTransformation_t object have been set. - */ -LIBSBML_EXTERN -int -CSGTransformation_hasRequiredAttributes(const CSGTransformation_t * csgt) -{ - return (csgt != NULL) ? static_cast(csgt->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * CSGTransformation_t object have been set. - */ -LIBSBML_EXTERN -int -CSGTransformation_hasRequiredElements(const CSGTransformation_t * csgt) -{ - return (csgt != NULL) ? static_cast(csgt->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file CSGTransformation.cpp + * @brief Implementation of the CSGTransformation class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CSGTransformation using the given SBML Level, Version and + * “spatial” package version. + */ +CSGTransformation::CSGTransformation(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : CSGNode(level, version, pkgVersion) + , mCSGNode (NULL) + , mElementName("csgTransformation") +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new CSGTransformation using the given SpatialPkgNamespaces object. + */ +CSGTransformation::CSGTransformation(SpatialPkgNamespaces *spatialns) + : CSGNode(spatialns) + , mCSGNode (NULL) + , mElementName("csgTransformation") +{ + setElementNamespace(spatialns->getURI()); + connectToChild(); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for CSGTransformation. + */ +CSGTransformation::CSGTransformation(const CSGTransformation& orig) + : CSGNode( orig ) + , mCSGNode ( NULL ) + , mElementName ( orig.mElementName ) +{ + if (orig.mCSGNode != NULL) + { + mCSGNode = orig.mCSGNode->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for CSGTransformation. + */ +CSGTransformation& +CSGTransformation::operator=(const CSGTransformation& rhs) +{ + if (&rhs != this) + { + CSGNode::operator=(rhs); + mElementName = rhs.mElementName; + delete mCSGNode; + if (rhs.mCSGNode != NULL) + { + mCSGNode = rhs.mCSGNode->clone(); + } + else + { + mCSGNode = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CSGTransformation object. + */ +CSGTransformation* +CSGTransformation::clone() const +{ + return new CSGTransformation(*this); +} + + +/* + * Destructor for CSGTransformation. + */ +CSGTransformation::~CSGTransformation() +{ + delete mCSGNode; + mCSGNode = NULL; +} + + +/* + * Returns the value of the "csgNode" element of this CSGTransformation. + */ +const CSGNode* +CSGTransformation::getCSGNode() const +{ + return mCSGNode; +} + + +/* + * Returns the value of the "csgNode" element of this CSGTransformation. + */ +CSGNode* +CSGTransformation::getCSGNode() +{ + return mCSGNode; +} + + +/* + * Predicate returning @c true if this CSGTransformation's "csgNode" element is + * set. + */ +bool +CSGTransformation::isSetCSGNode() const +{ + return (mCSGNode != NULL); +} + + +/* + * Sets the value of the "csgNode" element of this CSGTransformation. + */ +int +CSGTransformation::setCSGNode(const CSGNode* csgNode) +{ + if (mCSGNode == csgNode) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (csgNode == NULL) + { + delete mCSGNode; + mCSGNode = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mCSGNode; + mCSGNode = (csgNode != NULL) ? csgNode->clone() : NULL; + if (mCSGNode != NULL) + { + mCSGNode->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new CSGPrimitive object, adds it to this CSGTransformation object + * and returns the CSGPrimitive object created. + */ +CSGPrimitive* +CSGTransformation::createCSGPrimitive() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGPrimitive(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGTranslation object, adds it to this CSGTransformation + * object and returns the CSGTranslation object created. + */ +CSGTranslation* +CSGTransformation::createCSGTranslation() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGTranslation(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGRotation object, adds it to this CSGTransformation object + * and returns the CSGRotation object created. + */ +CSGRotation* +CSGTransformation::createCSGRotation() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGRotation(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGScale object, adds it to this CSGTransformation object and + * returns the CSGScale object created. + */ +CSGScale* +CSGTransformation::createCSGScale() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGScale(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGHomogeneousTransformation object, adds it to this + * CSGTransformation object and returns the CSGHomogeneousTransformation object + * created. + */ +CSGHomogeneousTransformation* +CSGTransformation::createCSGHomogeneousTransformation() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGHomogeneousTransformation(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Creates a new CSGSetOperator object, adds it to this CSGTransformation + * object and returns the CSGSetOperator object created. + */ +CSGSetOperator* +CSGTransformation::createCSGSetOperator() +{ + if (mCSGNode != NULL) + { + delete mCSGNode; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mCSGNode = new CSGSetOperator(spatialns); + + delete spatialns; + + connectToChild(); + + return static_cast(mCSGNode); +} + + +/* + * Unsets the value of the "csgNode" element of this CSGTransformation. + */ +int +CSGTransformation::unsetCSGNode() +{ + delete mCSGNode; + mCSGNode = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Predicate returning @c true if this abstract "CSGTransformation" is of type + * CSGTranslation + */ +bool +CSGTransformation::isCSGTranslation() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGTransformation" is of type + * CSGRotation + */ +bool +CSGTransformation::isCSGRotation() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGTransformation" is of type + * CSGScale + */ +bool +CSGTransformation::isCSGScale() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "CSGTransformation" is of type + * CSGHomogeneousTransformation + */ +bool +CSGTransformation::isCSGHomogeneousTransformation() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Returns the XML element name of this CSGTransformation object. + */ +const std::string& +CSGTransformation::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this CSGTransformation object. + */ +void +CSGTransformation::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this CSGTransformation object. + */ +int +CSGTransformation::getTypeCode() const +{ + return SBML_SPATIAL_CSGTRANSFORMATION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CSGTransformation object have been set. + */ +bool +CSGTransformation::hasRequiredAttributes() const +{ + bool allPresent = CSGNode::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * CSGTransformation object have been set. + */ +bool +CSGTransformation::hasRequiredElements() const +{ + bool allPresent = CSGNode::hasRequiredElements(); + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +CSGTransformation::writeElements(XMLOutputStream& stream) const +{ + CSGNode::writeElements(stream); + + if (isSetCSGNode() == true) + { + mCSGNode->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +CSGTransformation::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mCSGNode != NULL) + { + mCSGNode->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +CSGTransformation::setSBMLDocument(SBMLDocument* d) +{ + CSGNode::setSBMLDocument(d); + + if (mCSGNode != NULL) + { + mCSGNode->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +CSGTransformation::connectToChild() +{ + CSGNode::connectToChild(); + + if (mCSGNode != NULL) + { + mCSGNode->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +CSGTransformation::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + CSGNode::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetCSGNode()) + { + mCSGNode->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +CSGTransformation::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + CSGNode::updateSBMLNamespace(package, level, version); + + if (mCSGNode != NULL) + { + mCSGNode->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = CSGNode::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this CSGTransformation's attribute + * "attributeName" is set. + */ +bool +CSGTransformation::isSetAttribute(const std::string& attributeName) const +{ + bool value = CSGNode::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::setAttribute(const std::string& attributeName, int value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = CSGNode::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CSGTransformation. + */ +int +CSGTransformation::unsetAttribute(const std::string& attributeName) +{ + int value = CSGNode::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this CSGTransformation. + */ +SBase* +CSGTransformation::createChildObject(const std::string& elementName) +{ + CSGNode* obj = NULL; + + if (elementName == "csgPrimitive") + { + return createCSGPrimitive(); + } + else if (elementName == "csgTranslation") + { + return createCSGTranslation(); + } + else if (elementName == "csgRotation") + { + return createCSGRotation(); + } + else if (elementName == "csgScale") + { + return createCSGScale(); + } + else if (elementName == "csgHomogeneousTransformation") + { + return createCSGHomogeneousTransformation(); + } + else if (elementName == "csgSetOperator") + { + return createCSGSetOperator(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this CSGTransformation. + */ +int +CSGTransformation::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "csgPrimitive" && element->getTypeCode() == + SBML_SPATIAL_CSGPRIMITIVE) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgTranslation" && element->getTypeCode() == + SBML_SPATIAL_CSGTRANSLATION) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgRotation" && element->getTypeCode() == + SBML_SPATIAL_CSGROTATION) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgScale" && element->getTypeCode() == + SBML_SPATIAL_CSGSCALE) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgHomogeneousTransformation" && + element->getTypeCode() == SBML_SPATIAL_CSGHOMOGENEOUSTRANSFORMATION) + { + return setCSGNode((const CSGNode*)(element)); + } + else if (elementName == "csgSetOperator" && element->getTypeCode() == + SBML_SPATIAL_CSGSETOPERATOR) + { + return setCSGNode((const CSGNode*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CSGTransformation. + */ +SBase* +CSGTransformation::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "csgPrimitive") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgTranslation") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgRotation") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgScale") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgHomogeneousTransformation") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + else if (elementName == "csgSetOperator") + { + CSGNode * obj = mCSGNode; + mCSGNode = NULL; + return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this CSGTransformation. + */ +unsigned int +CSGTransformation::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "csgNode") + { + if (isSetCSGNode()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this CSGTransformation. + */ +SBase* +CSGTransformation::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "csgNode") + { + return getCSGNode(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +CSGTransformation::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCSGNode != NULL) + { + if (mCSGNode->getId() == id) + { + return mCSGNode; + } + + obj = mCSGNode->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +CSGTransformation::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCSGNode != NULL) + { + if (mCSGNode->getMetaId() == metaid) + { + return mCSGNode; + } + + obj = mCSGNode->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +CSGTransformation::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mCSGNode, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +CSGTransformation::createObject(XMLInputStream& stream) +{ + SBase* obj = CSGNode::createObject(stream); + + const std::string& name = stream.peek().getName(); + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + + if (name == "csgPrimitive") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGPrimitive(spatialns); + obj = mCSGNode; + } + else if (name == "csgTranslation") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGTranslation(spatialns); + obj = mCSGNode; + } + else if (name == "csgRotation") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGRotation(spatialns); + obj = mCSGNode; + } + else if (name == "csgScale") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGScale(spatialns); + obj = mCSGNode; + } + else if (name == "csgHomogeneousTransformation") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGHomogeneousTransformation(spatialns); + obj = mCSGNode; + } + else if (name == "csgSetOperator") + { + if (getErrorLog() && isSetCSGNode()) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGTransformationAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mCSGNode; + mCSGNode = new CSGSetOperator(spatialns); + obj = mCSGNode; + } + + delete spatialns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CSGTransformation::addExpectedAttributes(ExpectedAttributes& attributes) +{ + CSGNode::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CSGTransformation::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + CSGNode::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialCSGTransformationAllowedAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialCSGTransformationAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +CSGTransformation::writeAttributes(XMLOutputStream& stream) const +{ + CSGNode::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CSGTransformation_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGTransformation_t * +CSGTransformation_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGTransformation(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this CSGTransformation_t object. + */ +LIBSBML_EXTERN +CSGTransformation_t* +CSGTransformation_clone(const CSGTransformation_t* csgt) +{ + if (csgt != NULL) + { + return static_cast(csgt->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CSGTransformation_t object. + */ +LIBSBML_EXTERN +void +CSGTransformation_free(CSGTransformation_t* csgt) +{ + if (csgt != NULL) + { + delete csgt; + } +} + + +/* + * Returns the value of the "csgNode" element of this CSGTransformation_t. + */ +LIBSBML_EXTERN +const CSGNode_t* +CSGTransformation_getCSGNode(const CSGTransformation_t * csgt) +{ + if (csgt == NULL) + { + return NULL; + } + + return (CSGNode_t*)(csgt->getCSGNode()); +} + + +/* + * Predicate returning @c 1 (true) if this CSGTransformation_t's "csgNode" + * element is set. + */ +LIBSBML_EXTERN +int +CSGTransformation_isSetCSGNode(const CSGTransformation_t * csgt) +{ + return (csgt != NULL) ? static_cast(csgt->isSetCSGNode()) : 0; +} + + +/* + * Sets the value of the "csgNode" element of this CSGTransformation_t. + */ +LIBSBML_EXTERN +int +CSGTransformation_setCSGNode(CSGTransformation_t * csgt, + const CSGNode_t* csgNode) +{ + return (csgt != NULL) ? csgt->setCSGNode(csgNode) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new CSGPrimitive_t object, adds it to this CSGTransformation_t + * object and returns the CSGPrimitive_t object created. + */ +LIBSBML_EXTERN +CSGPrimitive_t* +CSGTransformation_createCSGPrimitive(CSGTransformation_t* csgt) +{ + return (csgt != NULL) ? csgt->createCSGPrimitive() : NULL; +} + + +/* + * Creates a new CSGTranslation_t object, adds it to this CSGTransformation_t + * object and returns the CSGTranslation_t object created. + */ +LIBSBML_EXTERN +CSGTranslation_t* +CSGTransformation_createCSGTranslation(CSGTransformation_t* csgt) +{ + return (csgt != NULL) ? csgt->createCSGTranslation() : NULL; +} + + +/* + * Creates a new CSGRotation_t object, adds it to this CSGTransformation_t + * object and returns the CSGRotation_t object created. + */ +LIBSBML_EXTERN +CSGRotation_t* +CSGTransformation_createCSGRotation(CSGTransformation_t* csgt) +{ + return (csgt != NULL) ? csgt->createCSGRotation() : NULL; +} + + +/* + * Creates a new CSGScale_t object, adds it to this CSGTransformation_t object + * and returns the CSGScale_t object created. + */ +LIBSBML_EXTERN +CSGScale_t* +CSGTransformation_createCSGScale(CSGTransformation_t* csgt) +{ + return (csgt != NULL) ? csgt->createCSGScale() : NULL; +} + + +/* + * Creates a new CSGHomogeneousTransformation_t object, adds it to this + * CSGTransformation_t object and returns the CSGHomogeneousTransformation_t + * object created. + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t* +CSGTransformation_createCSGHomogeneousTransformation(CSGTransformation_t* csgt) +{ + return (csgt != NULL) ? csgt->createCSGHomogeneousTransformation() : NULL; +} + + +/* + * Creates a new CSGSetOperator_t object, adds it to this CSGTransformation_t + * object and returns the CSGSetOperator_t object created. + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGTransformation_createCSGSetOperator(CSGTransformation_t* csgt) +{ + return (csgt != NULL) ? csgt->createCSGSetOperator() : NULL; +} + + +/* + * Unsets the value of the "csgNode" element of this CSGTransformation_t. + */ +LIBSBML_EXTERN +int +CSGTransformation_unsetCSGNode(CSGTransformation_t * csgt) +{ + return (csgt != NULL) ? csgt->unsetCSGNode() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 if this CSGTransformation_t is of type + * CSGTranslation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGTranslation(const CSGTransformation_t * csgt) +{ + return (csgt != NULL) ? static_cast(csgt->isCSGTranslation()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGTransformation_t is of type + * CSGRotation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGRotation(const CSGTransformation_t * csgt) +{ + return (csgt != NULL) ? static_cast(csgt->isCSGRotation()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGTransformation_t is of type CSGScale_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGScale(const CSGTransformation_t * csgt) +{ + return (csgt != NULL) ? static_cast(csgt->isCSGScale()) : 0; +} + + +/* + * Predicate returning @c 1 if this CSGTransformation_t is of type + * CSGHomogeneousTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGHomogeneousTransformation(const CSGTransformation_t * + csgt) +{ + return (csgt != NULL) ? + static_cast(csgt->isCSGHomogeneousTransformation()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGTransformation_t object have been set. + */ +LIBSBML_EXTERN +int +CSGTransformation_hasRequiredAttributes(const CSGTransformation_t * csgt) +{ + return (csgt != NULL) ? static_cast(csgt->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * CSGTransformation_t object have been set. + */ +LIBSBML_EXTERN +int +CSGTransformation_hasRequiredElements(const CSGTransformation_t * csgt) +{ + return (csgt != NULL) ? static_cast(csgt->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/CSGTransformation.h b/generator/tests/test_cpp_code/test-code/CSGTransformation.h index 70d2de75..d5029236 100644 --- a/generator/tests/test_cpp_code/test-code/CSGTransformation.h +++ b/generator/tests/test_cpp_code/test-code/CSGTransformation.h @@ -1,1203 +1,1203 @@ -/** - * @file CSGTransformation.h - * @brief Definition of the CSGTransformation class. - * @author SBMLTeam - * - * - * - * @class CSGTransformation - * @sbmlbrief{spatial} TODO:Definition of the CSGTransformation class. - */ - - -#ifndef CSGTransformation_H__ -#define CSGTransformation_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class CSGTranslation; -class CSGRotation; -class CSGScale; -class CSGHomogeneousTransformation; - -class LIBSBML_EXTERN CSGTransformation : public CSGNode -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - CSGNode* mCSGNode; - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new CSGTransformation using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CSGTransformation. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGTransformation. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGTransformation. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGTransformation(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = - SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new CSGTransformation using the given SpatialPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGTransformation(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for CSGTransformation. - * - * @param orig the CSGTransformation instance to copy. - */ - CSGTransformation(const CSGTransformation& orig); - - - /** - * Assignment operator for CSGTransformation. - * - * @param rhs the CSGTransformation object whose values are to be used as the - * basis of the assignment. - */ - CSGTransformation& operator=(const CSGTransformation& rhs); - - - /** - * Creates and returns a deep copy of this CSGTransformation object. - * - * @return a (deep) copy of this CSGTransformation object. - */ - virtual CSGTransformation* clone() const; - - - /** - * Destructor for CSGTransformation. - */ - virtual ~CSGTransformation(); - - - /** - * Returns the value of the "csgNode" element of this CSGTransformation. - * - * @return the value of the "csgNode" element of this CSGTransformation as a - * CSGNode*. - */ - const CSGNode* getCSGNode() const; - - - /** - * Returns the value of the "csgNode" element of this CSGTransformation. - * - * @return the value of the "csgNode" element of this CSGTransformation as a - * CSGNode*. - */ - CSGNode* getCSGNode(); - - - /** - * Predicate returning @c true if this CSGTransformation's "csgNode" element - * is set. - * - * @return @c true if this CSGTransformation's "csgNode" element has been - * set, otherwise @c false is returned. - */ - bool isSetCSGNode() const; - - - /** - * Sets the value of the "csgNode" element of this CSGTransformation. - * - * @param csgNode CSGNode* value of the "csgNode" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setCSGNode(const CSGNode* csgNode); - - - /** - * Creates a new CSGPrimitive object, adds it to this CSGTransformation - * object and returns the CSGPrimitive object created. - * - * @return a new CSGPrimitive object instance. - */ - CSGPrimitive* createCSGPrimitive(); - - - /** - * Creates a new CSGTranslation object, adds it to this CSGTransformation - * object and returns the CSGTranslation object created. - * - * @return a new CSGTranslation object instance. - */ - CSGTranslation* createCSGTranslation(); - - - /** - * Creates a new CSGRotation object, adds it to this CSGTransformation object - * and returns the CSGRotation object created. - * - * @return a new CSGRotation object instance. - */ - CSGRotation* createCSGRotation(); - - - /** - * Creates a new CSGScale object, adds it to this CSGTransformation object - * and returns the CSGScale object created. - * - * @return a new CSGScale object instance. - */ - CSGScale* createCSGScale(); - - - /** - * Creates a new CSGHomogeneousTransformation object, adds it to this - * CSGTransformation object and returns the CSGHomogeneousTransformation - * object created. - * - * @return a new CSGHomogeneousTransformation object instance. - */ - CSGHomogeneousTransformation* createCSGHomogeneousTransformation(); - - - /** - * Creates a new CSGSetOperator object, adds it to this CSGTransformation - * object and returns the CSGSetOperator object created. - * - * @return a new CSGSetOperator object instance. - */ - CSGSetOperator* createCSGSetOperator(); - - - /** - * Unsets the value of the "csgNode" element of this CSGTransformation. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetCSGNode(); - - - /** - * Predicate returning @c true if this abstract "CSGTransformation" is of - * type CSGTranslation - * - * @return @c true if this abstract "CSGTransformation" is of type - * CSGTranslation, @c false otherwise - */ - virtual bool isCSGTranslation() const; - - - /** - * Predicate returning @c true if this abstract "CSGTransformation" is of - * type CSGRotation - * - * @return @c true if this abstract "CSGTransformation" is of type - * CSGRotation, @c false otherwise - */ - virtual bool isCSGRotation() const; - - - /** - * Predicate returning @c true if this abstract "CSGTransformation" is of - * type CSGScale - * - * @return @c true if this abstract "CSGTransformation" is of type CSGScale, - * @c false otherwise - */ - virtual bool isCSGScale() const; - - - /** - * Predicate returning @c true if this abstract "CSGTransformation" is of - * type CSGHomogeneousTransformation - * - * @return @c true if this abstract "CSGTransformation" is of type - * CSGHomogeneousTransformation, @c false otherwise - */ - virtual bool isCSGHomogeneousTransformation() const; - - - /** - * Returns the XML element name of this CSGTransformation object. - * - * For CSGTransformation, the XML element name is always - * @c "csgTransformation". - * - * @return the name of this element, i.e. @c "csgTransformation". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this CSGTransformation object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this CSGTransformation object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_CSGTRANSFORMATION, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * CSGTransformation object have been set. - * - * @return @c true to indicate that all the required attributes of this - * CSGTransformation have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * CSGTransformation object have been set. - * - * @return @c true to indicate that all the required elements of this - * CSGTransformation have been set, otherwise @c false is returned. - * - * - * @note The required elements for the CSGTransformation object are: - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this CSGTransformation's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this CSGTransformation's attribute "attributeName" has - * been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGTransformation. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * CSGTransformation. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this CSGTransformation. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this CSGTransformation. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * CSGTransformation. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this CSGTransformation. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this CSGTransformation. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new CSGTransformation_t using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CSGTransformation_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGTransformation_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGTransformation_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGTransformation_t * -CSGTransformation_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this CSGTransformation_t object. - * - * @param csgt the CSGTransformation_t structure. - * - * @return a (deep) copy of this CSGTransformation_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGTransformation_t* -CSGTransformation_clone(const CSGTransformation_t* csgt); - - -/** - * Frees this CSGTransformation_t object. - * - * @param csgt the CSGTransformation_t structure. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -void -CSGTransformation_free(CSGTransformation_t* csgt); - - -/** - * Returns the value of the "csgNode" element of this CSGTransformation_t. - * - * @param csgt the CSGTransformation_t structure whose csgNode is sought. - * - * @return the value of the "csgNode" element of this CSGTransformation_t as a - * CSGNode*. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -const CSGNode_t* -CSGTransformation_getCSGNode(const CSGTransformation_t * csgt); - - -/** - * Predicate returning @c 1 (true) if this CSGTransformation_t's "csgNode" - * element is set. - * - * @param csgt the CSGTransformation_t structure. - * - * @return @c 1 (true) if this CSGTransformation_t's "csgNode" element has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isSetCSGNode(const CSGTransformation_t * csgt); - - -/** - * Sets the value of the "csgNode" element of this CSGTransformation_t. - * - * @param csgt the CSGTransformation_t structure. - * - * @param csgNode CSGNode_t* value of the "csgNode" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_setCSGNode(CSGTransformation_t * csgt, - const CSGNode_t* csgNode); - - -/** - * Creates a new CSGPrimitive_t object, adds it to this CSGTransformation_t - * object and returns the CSGPrimitive_t object created. - * - * @param csgt the CSGTransformation_t structure to which the CSGPrimitive_t - * should be added. - * - * @return a new CSGPrimitive_t object instance. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGPrimitive_t* -CSGTransformation_createCSGPrimitive(CSGTransformation_t* csgt); - - -/** - * Creates a new CSGTranslation_t object, adds it to this CSGTransformation_t - * object and returns the CSGTranslation_t object created. - * - * @param csgt the CSGTransformation_t structure to which the CSGTranslation_t - * should be added. - * - * @return a new CSGTranslation_t object instance. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGTranslation_t* -CSGTransformation_createCSGTranslation(CSGTransformation_t* csgt); - - -/** - * Creates a new CSGRotation_t object, adds it to this CSGTransformation_t - * object and returns the CSGRotation_t object created. - * - * @param csgt the CSGTransformation_t structure to which the CSGRotation_t - * should be added. - * - * @return a new CSGRotation_t object instance. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGRotation_t* -CSGTransformation_createCSGRotation(CSGTransformation_t* csgt); - - -/** - * Creates a new CSGScale_t object, adds it to this CSGTransformation_t object - * and returns the CSGScale_t object created. - * - * @param csgt the CSGTransformation_t structure to which the CSGScale_t should - * be added. - * - * @return a new CSGScale_t object instance. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGScale_t* -CSGTransformation_createCSGScale(CSGTransformation_t* csgt); - - -/** - * Creates a new CSGHomogeneousTransformation_t object, adds it to this - * CSGTransformation_t object and returns the CSGHomogeneousTransformation_t - * object created. - * - * @param csgt the CSGTransformation_t structure to which the - * CSGHomogeneousTransformation_t should be added. - * - * @return a new CSGHomogeneousTransformation_t object instance. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGHomogeneousTransformation_t* -CSGTransformation_createCSGHomogeneousTransformation(CSGTransformation_t* - csgt); - - -/** - * Creates a new CSGSetOperator_t object, adds it to this CSGTransformation_t - * object and returns the CSGSetOperator_t object created. - * - * @param csgt the CSGTransformation_t structure to which the CSGSetOperator_t - * should be added. - * - * @return a new CSGSetOperator_t object instance. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -CSGSetOperator_t* -CSGTransformation_createCSGSetOperator(CSGTransformation_t* csgt); - - -/** - * Unsets the value of the "csgNode" element of this CSGTransformation_t. - * - * @param csgt the CSGTransformation_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_unsetCSGNode(CSGTransformation_t * csgt); - - -/** - * Predicate returning @c 1 if this CSGTransformation_t is of type - * CSGTranslation_t - * - * @param csgt the CSGTransformation_t structure. - * - * @return @c 1 if this CSGTransformation_t is of type CSGTranslation_t, @c 0 - * otherwise - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGTranslation(const CSGTransformation_t * csgt); - - -/** - * Predicate returning @c 1 if this CSGTransformation_t is of type - * CSGRotation_t - * - * @param csgt the CSGTransformation_t structure. - * - * @return @c 1 if this CSGTransformation_t is of type CSGRotation_t, @c 0 - * otherwise - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGRotation(const CSGTransformation_t * csgt); - - -/** - * Predicate returning @c 1 if this CSGTransformation_t is of type CSGScale_t - * - * @param csgt the CSGTransformation_t structure. - * - * @return @c 1 if this CSGTransformation_t is of type CSGScale_t, @c 0 - * otherwise - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGScale(const CSGTransformation_t * csgt); - - -/** - * Predicate returning @c 1 if this CSGTransformation_t is of type - * CSGHomogeneousTransformation_t - * - * @param csgt the CSGTransformation_t structure. - * - * @return @c 1 if this CSGTransformation_t is of type - * CSGHomogeneousTransformation_t, @c 0 otherwise - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_isCSGHomogeneousTransformation(const CSGTransformation_t * - csgt); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGTransformation_t object have been set. - * - * @param csgt the CSGTransformation_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * CSGTransformation_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_hasRequiredAttributes(const CSGTransformation_t * csgt); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * CSGTransformation_t object have been set. - * - * @param csgt the CSGTransformation_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * CSGTransformation_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the CSGTransformation_t object are: - * - * @memberof CSGTransformation_t - */ -LIBSBML_EXTERN -int -CSGTransformation_hasRequiredElements(const CSGTransformation_t * csgt); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !CSGTransformation_H__ */ - - +/** + * @file CSGTransformation.h + * @brief Definition of the CSGTransformation class. + * @author SBMLTeam + * + * + * + * @class CSGTransformation + * @sbmlbrief{spatial} TODO:Definition of the CSGTransformation class. + */ + + +#ifndef CSGTransformation_H__ +#define CSGTransformation_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class CSGTranslation; +class CSGRotation; +class CSGScale; +class CSGHomogeneousTransformation; + +class LIBSBML_EXTERN CSGTransformation : public CSGNode +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + CSGNode* mCSGNode; + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new CSGTransformation using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CSGTransformation. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGTransformation. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGTransformation. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGTransformation(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = + SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new CSGTransformation using the given SpatialPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGTransformation(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for CSGTransformation. + * + * @param orig the CSGTransformation instance to copy. + */ + CSGTransformation(const CSGTransformation& orig); + + + /** + * Assignment operator for CSGTransformation. + * + * @param rhs the CSGTransformation object whose values are to be used as the + * basis of the assignment. + */ + CSGTransformation& operator=(const CSGTransformation& rhs); + + + /** + * Creates and returns a deep copy of this CSGTransformation object. + * + * @return a (deep) copy of this CSGTransformation object. + */ + virtual CSGTransformation* clone() const; + + + /** + * Destructor for CSGTransformation. + */ + virtual ~CSGTransformation(); + + + /** + * Returns the value of the "csgNode" element of this CSGTransformation. + * + * @return the value of the "csgNode" element of this CSGTransformation as a + * CSGNode*. + */ + const CSGNode* getCSGNode() const; + + + /** + * Returns the value of the "csgNode" element of this CSGTransformation. + * + * @return the value of the "csgNode" element of this CSGTransformation as a + * CSGNode*. + */ + CSGNode* getCSGNode(); + + + /** + * Predicate returning @c true if this CSGTransformation's "csgNode" element + * is set. + * + * @return @c true if this CSGTransformation's "csgNode" element has been + * set, otherwise @c false is returned. + */ + bool isSetCSGNode() const; + + + /** + * Sets the value of the "csgNode" element of this CSGTransformation. + * + * @param csgNode CSGNode* value of the "csgNode" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setCSGNode(const CSGNode* csgNode); + + + /** + * Creates a new CSGPrimitive object, adds it to this CSGTransformation + * object and returns the CSGPrimitive object created. + * + * @return a new CSGPrimitive object instance. + */ + CSGPrimitive* createCSGPrimitive(); + + + /** + * Creates a new CSGTranslation object, adds it to this CSGTransformation + * object and returns the CSGTranslation object created. + * + * @return a new CSGTranslation object instance. + */ + CSGTranslation* createCSGTranslation(); + + + /** + * Creates a new CSGRotation object, adds it to this CSGTransformation object + * and returns the CSGRotation object created. + * + * @return a new CSGRotation object instance. + */ + CSGRotation* createCSGRotation(); + + + /** + * Creates a new CSGScale object, adds it to this CSGTransformation object + * and returns the CSGScale object created. + * + * @return a new CSGScale object instance. + */ + CSGScale* createCSGScale(); + + + /** + * Creates a new CSGHomogeneousTransformation object, adds it to this + * CSGTransformation object and returns the CSGHomogeneousTransformation + * object created. + * + * @return a new CSGHomogeneousTransformation object instance. + */ + CSGHomogeneousTransformation* createCSGHomogeneousTransformation(); + + + /** + * Creates a new CSGSetOperator object, adds it to this CSGTransformation + * object and returns the CSGSetOperator object created. + * + * @return a new CSGSetOperator object instance. + */ + CSGSetOperator* createCSGSetOperator(); + + + /** + * Unsets the value of the "csgNode" element of this CSGTransformation. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetCSGNode(); + + + /** + * Predicate returning @c true if this abstract "CSGTransformation" is of + * type CSGTranslation + * + * @return @c true if this abstract "CSGTransformation" is of type + * CSGTranslation, @c false otherwise + */ + virtual bool isCSGTranslation() const; + + + /** + * Predicate returning @c true if this abstract "CSGTransformation" is of + * type CSGRotation + * + * @return @c true if this abstract "CSGTransformation" is of type + * CSGRotation, @c false otherwise + */ + virtual bool isCSGRotation() const; + + + /** + * Predicate returning @c true if this abstract "CSGTransformation" is of + * type CSGScale + * + * @return @c true if this abstract "CSGTransformation" is of type CSGScale, + * @c false otherwise + */ + virtual bool isCSGScale() const; + + + /** + * Predicate returning @c true if this abstract "CSGTransformation" is of + * type CSGHomogeneousTransformation + * + * @return @c true if this abstract "CSGTransformation" is of type + * CSGHomogeneousTransformation, @c false otherwise + */ + virtual bool isCSGHomogeneousTransformation() const; + + + /** + * Returns the XML element name of this CSGTransformation object. + * + * For CSGTransformation, the XML element name is always + * @c "csgTransformation". + * + * @return the name of this element, i.e. @c "csgTransformation". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this CSGTransformation object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this CSGTransformation object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_CSGTRANSFORMATION, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CSGTransformation object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CSGTransformation have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * CSGTransformation object have been set. + * + * @return @c true to indicate that all the required elements of this + * CSGTransformation have been set, otherwise @c false is returned. + * + * + * @note The required elements for the CSGTransformation object are: + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this CSGTransformation's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CSGTransformation's attribute "attributeName" has + * been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGTransformation. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * CSGTransformation. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this CSGTransformation. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this CSGTransformation. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CSGTransformation. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this CSGTransformation. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this CSGTransformation. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CSGTransformation_t using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CSGTransformation_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGTransformation_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGTransformation_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGTransformation_t * +CSGTransformation_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this CSGTransformation_t object. + * + * @param csgt the CSGTransformation_t structure. + * + * @return a (deep) copy of this CSGTransformation_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGTransformation_t* +CSGTransformation_clone(const CSGTransformation_t* csgt); + + +/** + * Frees this CSGTransformation_t object. + * + * @param csgt the CSGTransformation_t structure. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +void +CSGTransformation_free(CSGTransformation_t* csgt); + + +/** + * Returns the value of the "csgNode" element of this CSGTransformation_t. + * + * @param csgt the CSGTransformation_t structure whose csgNode is sought. + * + * @return the value of the "csgNode" element of this CSGTransformation_t as a + * CSGNode*. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +const CSGNode_t* +CSGTransformation_getCSGNode(const CSGTransformation_t * csgt); + + +/** + * Predicate returning @c 1 (true) if this CSGTransformation_t's "csgNode" + * element is set. + * + * @param csgt the CSGTransformation_t structure. + * + * @return @c 1 (true) if this CSGTransformation_t's "csgNode" element has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isSetCSGNode(const CSGTransformation_t * csgt); + + +/** + * Sets the value of the "csgNode" element of this CSGTransformation_t. + * + * @param csgt the CSGTransformation_t structure. + * + * @param csgNode CSGNode_t* value of the "csgNode" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_setCSGNode(CSGTransformation_t * csgt, + const CSGNode_t* csgNode); + + +/** + * Creates a new CSGPrimitive_t object, adds it to this CSGTransformation_t + * object and returns the CSGPrimitive_t object created. + * + * @param csgt the CSGTransformation_t structure to which the CSGPrimitive_t + * should be added. + * + * @return a new CSGPrimitive_t object instance. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGPrimitive_t* +CSGTransformation_createCSGPrimitive(CSGTransformation_t* csgt); + + +/** + * Creates a new CSGTranslation_t object, adds it to this CSGTransformation_t + * object and returns the CSGTranslation_t object created. + * + * @param csgt the CSGTransformation_t structure to which the CSGTranslation_t + * should be added. + * + * @return a new CSGTranslation_t object instance. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGTranslation_t* +CSGTransformation_createCSGTranslation(CSGTransformation_t* csgt); + + +/** + * Creates a new CSGRotation_t object, adds it to this CSGTransformation_t + * object and returns the CSGRotation_t object created. + * + * @param csgt the CSGTransformation_t structure to which the CSGRotation_t + * should be added. + * + * @return a new CSGRotation_t object instance. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGRotation_t* +CSGTransformation_createCSGRotation(CSGTransformation_t* csgt); + + +/** + * Creates a new CSGScale_t object, adds it to this CSGTransformation_t object + * and returns the CSGScale_t object created. + * + * @param csgt the CSGTransformation_t structure to which the CSGScale_t should + * be added. + * + * @return a new CSGScale_t object instance. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGScale_t* +CSGTransformation_createCSGScale(CSGTransformation_t* csgt); + + +/** + * Creates a new CSGHomogeneousTransformation_t object, adds it to this + * CSGTransformation_t object and returns the CSGHomogeneousTransformation_t + * object created. + * + * @param csgt the CSGTransformation_t structure to which the + * CSGHomogeneousTransformation_t should be added. + * + * @return a new CSGHomogeneousTransformation_t object instance. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGHomogeneousTransformation_t* +CSGTransformation_createCSGHomogeneousTransformation(CSGTransformation_t* + csgt); + + +/** + * Creates a new CSGSetOperator_t object, adds it to this CSGTransformation_t + * object and returns the CSGSetOperator_t object created. + * + * @param csgt the CSGTransformation_t structure to which the CSGSetOperator_t + * should be added. + * + * @return a new CSGSetOperator_t object instance. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +CSGSetOperator_t* +CSGTransformation_createCSGSetOperator(CSGTransformation_t* csgt); + + +/** + * Unsets the value of the "csgNode" element of this CSGTransformation_t. + * + * @param csgt the CSGTransformation_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_unsetCSGNode(CSGTransformation_t * csgt); + + +/** + * Predicate returning @c 1 if this CSGTransformation_t is of type + * CSGTranslation_t + * + * @param csgt the CSGTransformation_t structure. + * + * @return @c 1 if this CSGTransformation_t is of type CSGTranslation_t, @c 0 + * otherwise + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGTranslation(const CSGTransformation_t * csgt); + + +/** + * Predicate returning @c 1 if this CSGTransformation_t is of type + * CSGRotation_t + * + * @param csgt the CSGTransformation_t structure. + * + * @return @c 1 if this CSGTransformation_t is of type CSGRotation_t, @c 0 + * otherwise + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGRotation(const CSGTransformation_t * csgt); + + +/** + * Predicate returning @c 1 if this CSGTransformation_t is of type CSGScale_t + * + * @param csgt the CSGTransformation_t structure. + * + * @return @c 1 if this CSGTransformation_t is of type CSGScale_t, @c 0 + * otherwise + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGScale(const CSGTransformation_t * csgt); + + +/** + * Predicate returning @c 1 if this CSGTransformation_t is of type + * CSGHomogeneousTransformation_t + * + * @param csgt the CSGTransformation_t structure. + * + * @return @c 1 if this CSGTransformation_t is of type + * CSGHomogeneousTransformation_t, @c 0 otherwise + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_isCSGHomogeneousTransformation(const CSGTransformation_t * + csgt); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGTransformation_t object have been set. + * + * @param csgt the CSGTransformation_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CSGTransformation_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_hasRequiredAttributes(const CSGTransformation_t * csgt); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * CSGTransformation_t object have been set. + * + * @param csgt the CSGTransformation_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * CSGTransformation_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the CSGTransformation_t object are: + * + * @memberof CSGTransformation_t + */ +LIBSBML_EXTERN +int +CSGTransformation_hasRequiredElements(const CSGTransformation_t * csgt); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CSGTransformation_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/CSGeometry.cpp b/generator/tests/test_cpp_code/test-code/CSGeometry.cpp index cf479a4c..20db2659 100644 --- a/generator/tests/test_cpp_code/test-code/CSGeometry.cpp +++ b/generator/tests/test_cpp_code/test-code/CSGeometry.cpp @@ -1,1160 +1,1160 @@ -/** - * @file CSGeometry.cpp - * @brief Implementation of the CSGeometry class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new CSGeometry using the given SBML Level, Version and - * “spatial” package version. - */ -CSGeometry::CSGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : GeometryDefinition(level, version, pkgVersion) - , mCSGObjects (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new CSGeometry using the given SpatialPkgNamespaces object. - */ -CSGeometry::CSGeometry(SpatialPkgNamespaces *spatialns) - : GeometryDefinition(spatialns) - , mCSGObjects (spatialns) -{ - setElementNamespace(spatialns->getURI()); - connectToChild(); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for CSGeometry. - */ -CSGeometry::CSGeometry(const CSGeometry& orig) - : GeometryDefinition( orig ) - , mCSGObjects ( orig.mCSGObjects ) -{ - connectToChild(); -} - - -/* - * Assignment operator for CSGeometry. - */ -CSGeometry& -CSGeometry::operator=(const CSGeometry& rhs) -{ - if (&rhs != this) - { - GeometryDefinition::operator=(rhs); - mCSGObjects = rhs.mCSGObjects; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this CSGeometry object. - */ -CSGeometry* -CSGeometry::clone() const -{ - return new CSGeometry(*this); -} - - -/* - * Destructor for CSGeometry. - */ -CSGeometry::~CSGeometry() -{ -} - - -/* - * Returns the ListOfCSGObjects from this CSGeometry. - */ -const ListOfCSGObjects* -CSGeometry::getListOfCSGObjects() const -{ - return &mCSGObjects; -} - - -/* - * Returns the ListOfCSGObjects from this CSGeometry. - */ -ListOfCSGObjects* -CSGeometry::getListOfCSGObjects() -{ - return &mCSGObjects; -} - - -/* - * Get a CSGObject from the CSGeometry. - */ -CSGObject* -CSGeometry::getCSGObject(unsigned int n) -{ - return mCSGObjects.get(n); -} - - -/* - * Get a CSGObject from the CSGeometry. - */ -const CSGObject* -CSGeometry::getCSGObject(unsigned int n) const -{ - return mCSGObjects.get(n); -} - - -/* - * Get a CSGObject from the CSGeometry based on its identifier. - */ -CSGObject* -CSGeometry::getCSGObject(const std::string& sid) -{ - return mCSGObjects.get(sid); -} - - -/* - * Get a CSGObject from the CSGeometry based on its identifier. - */ -const CSGObject* -CSGeometry::getCSGObject(const std::string& sid) const -{ - return mCSGObjects.get(sid); -} - - -/* - * Get a CSGObject from the CSGeometry based on the DomainType to which it - * refers. - */ -const CSGObject* -CSGeometry::getCSGObjectByDomainType(const std::string& sid) const -{ - return mCSGObjects.getByDomainType(sid); -} - - -/* - * Get a CSGObject from the CSGeometry based on the DomainType to which it - * refers. - */ -CSGObject* -CSGeometry::getCSGObjectByDomainType(const std::string& sid) -{ - return mCSGObjects.getByDomainType(sid); -} - - -/* - * Adds a copy of the given CSGObject to this CSGeometry. - */ -int -CSGeometry::addCSGObject(const CSGObject* csgo) -{ - if (csgo == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (csgo->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (csgo->hasRequiredElements() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != csgo->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != csgo->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(csgo)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (csgo->isSetId() && (mCSGObjects.get(csgo->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mCSGObjects.append(csgo); - } -} - - -/* - * Get the number of CSGObject objects in this CSGeometry. - */ -unsigned int -CSGeometry::getNumCSGObjects() const -{ - return mCSGObjects.size(); -} - - -/* - * Creates a new CSGObject object, adds it to this CSGeometry object and - * returns the CSGObject object created. - */ -CSGObject* -CSGeometry::createCSGObject() -{ - CSGObject* csgo = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csgo = new CSGObject(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csgo != NULL) - { - mCSGObjects.appendAndOwn(csgo); - } - - return csgo; -} - - -/* - * Removes the nth CSGObject from this CSGeometry and returns a pointer to it. - */ -CSGObject* -CSGeometry::removeCSGObject(unsigned int n) -{ - return mCSGObjects.remove(n); -} - - -/* - * Removes the CSGObject from this CSGeometry based on its identifier and - * returns a pointer to it. - */ -CSGObject* -CSGeometry::removeCSGObject(const std::string& sid) -{ - return mCSGObjects.remove(sid); -} - - -/* - * Returns the XML element name of this CSGeometry object. - */ -const std::string& -CSGeometry::getElementName() const -{ - static const string name = "csGeometry"; - return name; -} - - -/* - * Returns the libSBML type code for this CSGeometry object. - */ -int -CSGeometry::getTypeCode() const -{ - return SBML_SPATIAL_CSGEOMETRY; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * CSGeometry object have been set. - */ -bool -CSGeometry::hasRequiredAttributes() const -{ - bool allPresent = GeometryDefinition::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this CSGeometry - * object have been set. - */ -bool -CSGeometry::hasRequiredElements() const -{ - bool allPresent = GeometryDefinition::hasRequiredElements(); - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -CSGeometry::writeElements(XMLOutputStream& stream) const -{ - GeometryDefinition::writeElements(stream); - - if (getNumCSGObjects() > 0) - { - mCSGObjects.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -CSGeometry::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mCSGObjects.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -CSGeometry::setSBMLDocument(SBMLDocument* d) -{ - GeometryDefinition::setSBMLDocument(d); - - mCSGObjects.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -CSGeometry::connectToChild() -{ - GeometryDefinition::connectToChild(); - - mCSGObjects.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -CSGeometry::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - GeometryDefinition::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mCSGObjects.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -CSGeometry::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - GeometryDefinition::updateSBMLNamespace(package, level, version); - - mCSGObjects.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = GeometryDefinition::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = GeometryDefinition::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = GeometryDefinition::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = GeometryDefinition::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = GeometryDefinition::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this CSGeometry's attribute "attributeName" - * is set. - */ -bool -CSGeometry::isSetAttribute(const std::string& attributeName) const -{ - bool value = GeometryDefinition::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = GeometryDefinition::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::setAttribute(const std::string& attributeName, int value) -{ - int return_value = GeometryDefinition::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::setAttribute(const std::string& attributeName, double value) -{ - int return_value = GeometryDefinition::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = GeometryDefinition::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = GeometryDefinition::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this CSGeometry. - */ -int -CSGeometry::unsetAttribute(const std::string& attributeName) -{ - int value = GeometryDefinition::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this CSGeometry. - */ -SBase* -CSGeometry::createChildObject(const std::string& elementName) -{ - GeometryDefinition* obj = NULL; - - if (elementName == "csgObject") - { - return createCSGObject(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this CSGeometry. - */ -int -CSGeometry::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "csgObject" && element->getTypeCode() == - SBML_SPATIAL_CSGOBJECT) - { - return addCSGObject((const CSGObject*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * CSGeometry. - */ -SBase* -CSGeometry::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "csgObject") - { - return removeCSGObject(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this CSGeometry. - */ -unsigned int -CSGeometry::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "csgObject") - { - return getNumCSGObjects(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this CSGeometry. - */ -SBase* -CSGeometry::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "csgObject") - { - return getCSGObject(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -CSGeometry::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - obj = mCSGObjects.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -CSGeometry::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCSGObjects.getMetaId() == metaid) - { - return &mCSGObjects; - } - - obj = mCSGObjects.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -CSGeometry::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mCSGObjects, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -CSGeometry::createObject(XMLInputStream& stream) -{ - SBase* obj = GeometryDefinition::createObject(stream); - - const std::string& name = stream.peek().getName(); - - if (name == "listOfCSGObjects") - { - if (getErrorLog() && mCSGObjects.size() != 0) - { - getErrorLog()->logPackageError("spatial", - SpatialCSGeometryAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - obj = &mCSGObjects; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -CSGeometry::addExpectedAttributes(ExpectedAttributes& attributes) -{ - GeometryDefinition::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -CSGeometry::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - GeometryDefinition::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", SpatialCSGeometryAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", SpatialCSGeometryAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -CSGeometry::writeAttributes(XMLOutputStream& stream) const -{ - GeometryDefinition::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new CSGeometry_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGeometry_t * -CSGeometry_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGeometry(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this CSGeometry_t object. - */ -LIBSBML_EXTERN -CSGeometry_t* -CSGeometry_clone(const CSGeometry_t* csg) -{ - if (csg != NULL) - { - return static_cast(csg->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this CSGeometry_t object. - */ -LIBSBML_EXTERN -void -CSGeometry_free(CSGeometry_t* csg) -{ - if (csg != NULL) - { - delete csg; - } -} - - -/* - * Returns a ListOf_t * containing CSGObject_t objects from this CSGeometry_t. - */ -LIBSBML_EXTERN -ListOf_t* -CSGeometry_getListOfCSGObjects(CSGeometry_t* csg) -{ - return (csg != NULL) ? csg->getListOfCSGObjects() : NULL; -} - - -/* - * Get a CSGObject_t from the CSGeometry_t. - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_getCSGObject(CSGeometry_t* csg, unsigned int n) -{ - return (csg != NULL) ? csg->getCSGObject(n) : NULL; -} - - -/* - * Get a CSGObject_t from the CSGeometry_t based on its identifier. - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_getCSGObjectById(CSGeometry_t* csg, const char *sid) -{ - return (csg != NULL && sid != NULL) ? csg->getCSGObject(sid) : NULL; -} - - -/* - * Get a CSGObject_t from the CSGeometry_t based on the DomainType to which it - * refers. - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_getCSGObjectByDomainType(CSGeometry_t* csg, const char *sid) -{ - return (csg != NULL && sid != NULL) ? csg->getCSGObjectByDomainType(sid) : - NULL; -} - - -/* - * Adds a copy of the given CSGObject_t to this CSGeometry_t. - */ -LIBSBML_EXTERN -int -CSGeometry_addCSGObject(CSGeometry_t* csg, const CSGObject_t* csgo) -{ - return (csg != NULL) ? csg->addCSGObject(csgo) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of CSGObject_t objects in this CSGeometry_t. - */ -LIBSBML_EXTERN -unsigned int -CSGeometry_getNumCSGObjects(CSGeometry_t* csg) -{ - return (csg != NULL) ? csg->getNumCSGObjects() : SBML_INT_MAX; -} - - -/* - * Creates a new CSGObject_t object, adds it to this CSGeometry_t object and - * returns the CSGObject_t object created. - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_createCSGObject(CSGeometry_t* csg) -{ - return (csg != NULL) ? csg->createCSGObject() : NULL; -} - - -/* - * Removes the nth CSGObject_t from this CSGeometry_t and returns a pointer to - * it. - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_removeCSGObject(CSGeometry_t* csg, unsigned int n) -{ - return (csg != NULL) ? csg->removeCSGObject(n) : NULL; -} - - -/* - * Removes the CSGObject_t from this CSGeometry_t based on its identifier and - * returns a pointer to it. - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_removeCSGObjectById(CSGeometry_t* csg, const char* sid) -{ - return (csg != NULL && sid != NULL) ? csg->removeCSGObject(sid) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGeometry_t object have been set. - */ -LIBSBML_EXTERN -int -CSGeometry_hasRequiredAttributes(const CSGeometry_t * csg) -{ - return (csg != NULL) ? static_cast(csg->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * CSGeometry_t object have been set. - */ -LIBSBML_EXTERN -int -CSGeometry_hasRequiredElements(const CSGeometry_t * csg) -{ - return (csg != NULL) ? static_cast(csg->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file CSGeometry.cpp + * @brief Implementation of the CSGeometry class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CSGeometry using the given SBML Level, Version and + * “spatial” package version. + */ +CSGeometry::CSGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : GeometryDefinition(level, version, pkgVersion) + , mCSGObjects (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new CSGeometry using the given SpatialPkgNamespaces object. + */ +CSGeometry::CSGeometry(SpatialPkgNamespaces *spatialns) + : GeometryDefinition(spatialns) + , mCSGObjects (spatialns) +{ + setElementNamespace(spatialns->getURI()); + connectToChild(); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for CSGeometry. + */ +CSGeometry::CSGeometry(const CSGeometry& orig) + : GeometryDefinition( orig ) + , mCSGObjects ( orig.mCSGObjects ) +{ + connectToChild(); +} + + +/* + * Assignment operator for CSGeometry. + */ +CSGeometry& +CSGeometry::operator=(const CSGeometry& rhs) +{ + if (&rhs != this) + { + GeometryDefinition::operator=(rhs); + mCSGObjects = rhs.mCSGObjects; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CSGeometry object. + */ +CSGeometry* +CSGeometry::clone() const +{ + return new CSGeometry(*this); +} + + +/* + * Destructor for CSGeometry. + */ +CSGeometry::~CSGeometry() +{ +} + + +/* + * Returns the ListOfCSGObjects from this CSGeometry. + */ +const ListOfCSGObjects* +CSGeometry::getListOfCSGObjects() const +{ + return &mCSGObjects; +} + + +/* + * Returns the ListOfCSGObjects from this CSGeometry. + */ +ListOfCSGObjects* +CSGeometry::getListOfCSGObjects() +{ + return &mCSGObjects; +} + + +/* + * Get a CSGObject from the CSGeometry. + */ +CSGObject* +CSGeometry::getCSGObject(unsigned int n) +{ + return mCSGObjects.get(n); +} + + +/* + * Get a CSGObject from the CSGeometry. + */ +const CSGObject* +CSGeometry::getCSGObject(unsigned int n) const +{ + return mCSGObjects.get(n); +} + + +/* + * Get a CSGObject from the CSGeometry based on its identifier. + */ +CSGObject* +CSGeometry::getCSGObject(const std::string& sid) +{ + return mCSGObjects.get(sid); +} + + +/* + * Get a CSGObject from the CSGeometry based on its identifier. + */ +const CSGObject* +CSGeometry::getCSGObject(const std::string& sid) const +{ + return mCSGObjects.get(sid); +} + + +/* + * Get a CSGObject from the CSGeometry based on the DomainType to which it + * refers. + */ +const CSGObject* +CSGeometry::getCSGObjectByDomainType(const std::string& sid) const +{ + return mCSGObjects.getByDomainType(sid); +} + + +/* + * Get a CSGObject from the CSGeometry based on the DomainType to which it + * refers. + */ +CSGObject* +CSGeometry::getCSGObjectByDomainType(const std::string& sid) +{ + return mCSGObjects.getByDomainType(sid); +} + + +/* + * Adds a copy of the given CSGObject to this CSGeometry. + */ +int +CSGeometry::addCSGObject(const CSGObject* csgo) +{ + if (csgo == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (csgo->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (csgo->hasRequiredElements() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != csgo->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != csgo->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(csgo)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (csgo->isSetId() && (mCSGObjects.get(csgo->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mCSGObjects.append(csgo); + } +} + + +/* + * Get the number of CSGObject objects in this CSGeometry. + */ +unsigned int +CSGeometry::getNumCSGObjects() const +{ + return mCSGObjects.size(); +} + + +/* + * Creates a new CSGObject object, adds it to this CSGeometry object and + * returns the CSGObject object created. + */ +CSGObject* +CSGeometry::createCSGObject() +{ + CSGObject* csgo = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csgo = new CSGObject(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csgo != NULL) + { + mCSGObjects.appendAndOwn(csgo); + } + + return csgo; +} + + +/* + * Removes the nth CSGObject from this CSGeometry and returns a pointer to it. + */ +CSGObject* +CSGeometry::removeCSGObject(unsigned int n) +{ + return mCSGObjects.remove(n); +} + + +/* + * Removes the CSGObject from this CSGeometry based on its identifier and + * returns a pointer to it. + */ +CSGObject* +CSGeometry::removeCSGObject(const std::string& sid) +{ + return mCSGObjects.remove(sid); +} + + +/* + * Returns the XML element name of this CSGeometry object. + */ +const std::string& +CSGeometry::getElementName() const +{ + static const string name = "csGeometry"; + return name; +} + + +/* + * Returns the libSBML type code for this CSGeometry object. + */ +int +CSGeometry::getTypeCode() const +{ + return SBML_SPATIAL_CSGEOMETRY; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CSGeometry object have been set. + */ +bool +CSGeometry::hasRequiredAttributes() const +{ + bool allPresent = GeometryDefinition::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this CSGeometry + * object have been set. + */ +bool +CSGeometry::hasRequiredElements() const +{ + bool allPresent = GeometryDefinition::hasRequiredElements(); + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +CSGeometry::writeElements(XMLOutputStream& stream) const +{ + GeometryDefinition::writeElements(stream); + + if (getNumCSGObjects() > 0) + { + mCSGObjects.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +CSGeometry::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mCSGObjects.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +CSGeometry::setSBMLDocument(SBMLDocument* d) +{ + GeometryDefinition::setSBMLDocument(d); + + mCSGObjects.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +CSGeometry::connectToChild() +{ + GeometryDefinition::connectToChild(); + + mCSGObjects.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +CSGeometry::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + GeometryDefinition::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mCSGObjects.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +CSGeometry::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + GeometryDefinition::updateSBMLNamespace(package, level, version); + + mCSGObjects.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = GeometryDefinition::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = GeometryDefinition::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = GeometryDefinition::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = GeometryDefinition::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = GeometryDefinition::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this CSGeometry's attribute "attributeName" + * is set. + */ +bool +CSGeometry::isSetAttribute(const std::string& attributeName) const +{ + bool value = GeometryDefinition::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = GeometryDefinition::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::setAttribute(const std::string& attributeName, int value) +{ + int return_value = GeometryDefinition::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::setAttribute(const std::string& attributeName, double value) +{ + int return_value = GeometryDefinition::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = GeometryDefinition::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = GeometryDefinition::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CSGeometry. + */ +int +CSGeometry::unsetAttribute(const std::string& attributeName) +{ + int value = GeometryDefinition::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this CSGeometry. + */ +SBase* +CSGeometry::createChildObject(const std::string& elementName) +{ + GeometryDefinition* obj = NULL; + + if (elementName == "csgObject") + { + return createCSGObject(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this CSGeometry. + */ +int +CSGeometry::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "csgObject" && element->getTypeCode() == + SBML_SPATIAL_CSGOBJECT) + { + return addCSGObject((const CSGObject*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CSGeometry. + */ +SBase* +CSGeometry::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "csgObject") + { + return removeCSGObject(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this CSGeometry. + */ +unsigned int +CSGeometry::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "csgObject") + { + return getNumCSGObjects(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this CSGeometry. + */ +SBase* +CSGeometry::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "csgObject") + { + return getCSGObject(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +CSGeometry::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + obj = mCSGObjects.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +CSGeometry::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCSGObjects.getMetaId() == metaid) + { + return &mCSGObjects; + } + + obj = mCSGObjects.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +CSGeometry::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mCSGObjects, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +CSGeometry::createObject(XMLInputStream& stream) +{ + SBase* obj = GeometryDefinition::createObject(stream); + + const std::string& name = stream.peek().getName(); + + if (name == "listOfCSGObjects") + { + if (getErrorLog() && mCSGObjects.size() != 0) + { + getErrorLog()->logPackageError("spatial", + SpatialCSGeometryAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + obj = &mCSGObjects; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CSGeometry::addExpectedAttributes(ExpectedAttributes& attributes) +{ + GeometryDefinition::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CSGeometry::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + GeometryDefinition::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", SpatialCSGeometryAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", SpatialCSGeometryAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +CSGeometry::writeAttributes(XMLOutputStream& stream) const +{ + GeometryDefinition::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CSGeometry_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGeometry_t * +CSGeometry_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGeometry(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this CSGeometry_t object. + */ +LIBSBML_EXTERN +CSGeometry_t* +CSGeometry_clone(const CSGeometry_t* csg) +{ + if (csg != NULL) + { + return static_cast(csg->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CSGeometry_t object. + */ +LIBSBML_EXTERN +void +CSGeometry_free(CSGeometry_t* csg) +{ + if (csg != NULL) + { + delete csg; + } +} + + +/* + * Returns a ListOf_t * containing CSGObject_t objects from this CSGeometry_t. + */ +LIBSBML_EXTERN +ListOf_t* +CSGeometry_getListOfCSGObjects(CSGeometry_t* csg) +{ + return (csg != NULL) ? csg->getListOfCSGObjects() : NULL; +} + + +/* + * Get a CSGObject_t from the CSGeometry_t. + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_getCSGObject(CSGeometry_t* csg, unsigned int n) +{ + return (csg != NULL) ? csg->getCSGObject(n) : NULL; +} + + +/* + * Get a CSGObject_t from the CSGeometry_t based on its identifier. + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_getCSGObjectById(CSGeometry_t* csg, const char *sid) +{ + return (csg != NULL && sid != NULL) ? csg->getCSGObject(sid) : NULL; +} + + +/* + * Get a CSGObject_t from the CSGeometry_t based on the DomainType to which it + * refers. + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_getCSGObjectByDomainType(CSGeometry_t* csg, const char *sid) +{ + return (csg != NULL && sid != NULL) ? csg->getCSGObjectByDomainType(sid) : + NULL; +} + + +/* + * Adds a copy of the given CSGObject_t to this CSGeometry_t. + */ +LIBSBML_EXTERN +int +CSGeometry_addCSGObject(CSGeometry_t* csg, const CSGObject_t* csgo) +{ + return (csg != NULL) ? csg->addCSGObject(csgo) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of CSGObject_t objects in this CSGeometry_t. + */ +LIBSBML_EXTERN +unsigned int +CSGeometry_getNumCSGObjects(CSGeometry_t* csg) +{ + return (csg != NULL) ? csg->getNumCSGObjects() : SBML_INT_MAX; +} + + +/* + * Creates a new CSGObject_t object, adds it to this CSGeometry_t object and + * returns the CSGObject_t object created. + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_createCSGObject(CSGeometry_t* csg) +{ + return (csg != NULL) ? csg->createCSGObject() : NULL; +} + + +/* + * Removes the nth CSGObject_t from this CSGeometry_t and returns a pointer to + * it. + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_removeCSGObject(CSGeometry_t* csg, unsigned int n) +{ + return (csg != NULL) ? csg->removeCSGObject(n) : NULL; +} + + +/* + * Removes the CSGObject_t from this CSGeometry_t based on its identifier and + * returns a pointer to it. + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_removeCSGObjectById(CSGeometry_t* csg, const char* sid) +{ + return (csg != NULL && sid != NULL) ? csg->removeCSGObject(sid) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGeometry_t object have been set. + */ +LIBSBML_EXTERN +int +CSGeometry_hasRequiredAttributes(const CSGeometry_t * csg) +{ + return (csg != NULL) ? static_cast(csg->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * CSGeometry_t object have been set. + */ +LIBSBML_EXTERN +int +CSGeometry_hasRequiredElements(const CSGeometry_t * csg) +{ + return (csg != NULL) ? static_cast(csg->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/CSGeometry.h b/generator/tests/test_cpp_code/test-code/CSGeometry.h index 5984fdbb..dbc8d43c 100644 --- a/generator/tests/test_cpp_code/test-code/CSGeometry.h +++ b/generator/tests/test_cpp_code/test-code/CSGeometry.h @@ -1,1239 +1,1239 @@ -/** - * @file CSGeometry.h - * @brief Definition of the CSGeometry class. - * @author SBMLTeam - * - * - * - * @class CSGeometry - * @sbmlbrief{spatial} TODO:Definition of the CSGeometry class. - */ - - -#ifndef CSGeometry_H__ -#define CSGeometry_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN CSGeometry : public GeometryDefinition -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - ListOfCSGObjects mCSGObjects; - - /** @endcond */ - -public: - - /** - * Creates a new CSGeometry using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGeometry. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGeometry. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGeometry. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGeometry(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new CSGeometry using the given SpatialPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - CSGeometry(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for CSGeometry. - * - * @param orig the CSGeometry instance to copy. - */ - CSGeometry(const CSGeometry& orig); - - - /** - * Assignment operator for CSGeometry. - * - * @param rhs the CSGeometry object whose values are to be used as the basis - * of the assignment. - */ - CSGeometry& operator=(const CSGeometry& rhs); - - - /** - * Creates and returns a deep copy of this CSGeometry object. - * - * @return a (deep) copy of this CSGeometry object. - */ - virtual CSGeometry* clone() const; - - - /** - * Destructor for CSGeometry. - */ - virtual ~CSGeometry(); - - - /** - * Returns the ListOfCSGObjects from this CSGeometry. - * - * @return the ListOfCSGObjects from this CSGeometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - const ListOfCSGObjects* getListOfCSGObjects() const; - - - /** - * Returns the ListOfCSGObjects from this CSGeometry. - * - * @return the ListOfCSGObjects from this CSGeometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - ListOfCSGObjects* getListOfCSGObjects(); - - - /** - * Get a CSGObject from the CSGeometry. - * - * @param n an unsigned int representing the index of the CSGObject to - * retrieve. - * - * @return the nth CSGObject in the ListOfCSGObjects within this CSGeometry - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - CSGObject* getCSGObject(unsigned int n); - - - /** - * Get a CSGObject from the CSGeometry. - * - * @param n an unsigned int representing the index of the CSGObject to - * retrieve. - * - * @return the nth CSGObject in the ListOfCSGObjects within this CSGeometry - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - const CSGObject* getCSGObject(unsigned int n) const; - - - /** - * Get a CSGObject from the CSGeometry based on its identifier. - * - * @param sid a string representing the identifier of the CSGObject to - * retrieve. - * - * @return the CSGObject in the ListOfCSGObjects within this CSGeometry with - * the given @p sid or @c NULL if no such CSGObject exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - CSGObject* getCSGObject(const std::string& sid); - - - /** - * Get a CSGObject from the CSGeometry based on its identifier. - * - * @param sid a string representing the identifier of the CSGObject to - * retrieve. - * - * @return the CSGObject in the ListOfCSGObjects within this CSGeometry with - * the given @p sid or @c NULL if no such CSGObject exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - const CSGObject* getCSGObject(const std::string& sid) const; - - - /** - * Get a CSGObject from the CSGeometry based on the DomainType to which it - * refers. - * - * @param sid a string representing the "domainType" attribute of the - * CSGObject object to retrieve. - * - * @return the first CSGObject in this CSGeometry based on the given - * domainType attribute or NULL if no such CSGObject exists. - * - * @copydetails doc_returned_unowned_pointer - */ - const CSGObject* getCSGObjectByDomainType(const std::string& sid) const; - - - /** - * Get a CSGObject from the CSGeometry based on the DomainType to which it - * refers. - * - * @param sid a string representing the "domainType" attribute of the - * CSGObject object to retrieve. - * - * @return the first CSGObject in this CSGeometry based on the given - * domainType attribute or NULL if no such CSGObject exists. - * - * @copydetails doc_returned_unowned_pointer - */ - CSGObject* getCSGObjectByDomainType(const std::string& sid); - - - /** - * Adds a copy of the given CSGObject to this CSGeometry. - * - * @param csgo the CSGObject object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - int addCSGObject(const CSGObject* csgo); - - - /** - * Get the number of CSGObject objects in this CSGeometry. - * - * @return the number of CSGObject objects in this CSGeometry. - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getCSGObject(unsigned int n) - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - unsigned int getNumCSGObjects() const; - - - /** - * Creates a new CSGObject object, adds it to this CSGeometry object and - * returns the CSGObject object created. - * - * @return a new CSGObject object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see getCSGObject(const std::string& sid) - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - * @see removeCSGObject(unsigned int n) - */ - CSGObject* createCSGObject(); - - - /** - * Removes the nth CSGObject from this CSGeometry and returns a pointer to - * it. - * - * @param n an unsigned int representing the index of the CSGObject to - * remove. - * - * @return a pointer to the nth CSGObject in this CSGeometry. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(const std::string& sid) - */ - CSGObject* removeCSGObject(unsigned int n); - - - /** - * Removes the CSGObject from this CSGeometry based on its identifier and - * returns a pointer to it. - * - * @param sid a string representing the identifier of the CSGObject to - * remove. - * - * @return the CSGObject in this CSGeometry based on the identifier or NULL - * if no such CSGObject exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addCSGObject(const CSGObject* object) - * @see createCSGObject() - * @see getCSGObject(const std::string& sid) - * @see getCSGObject(unsigned int n) - * @see getNumCSGObjects() - * @see removeCSGObject(unsigned int n) - */ - CSGObject* removeCSGObject(const std::string& sid); - - - /** - * Returns the XML element name of this CSGeometry object. - * - * For CSGeometry, the XML element name is always @c "csGeometry". - * - * @return the name of this element, i.e. @c "csGeometry". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this CSGeometry object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_CSGEOMETRY, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * CSGeometry object have been set. - * - * @return @c true to indicate that all the required attributes of this - * CSGeometry have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * CSGeometry object have been set. - * - * @return @c true to indicate that all the required elements of this - * CSGeometry have been set, otherwise @c false is returned. - * - * - * @note The required elements for the CSGeometry object are: - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this CSGeometry's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this CSGeometry's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this CSGeometry. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this CSGeometry. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this CSGeometry. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * CSGeometry. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this CSGeometry. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this CSGeometry. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new CSGeometry_t using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this CSGeometry_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CSGeometry_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CSGeometry_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGeometry_t * -CSGeometry_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this CSGeometry_t object. - * - * @param csg the CSGeometry_t structure. - * - * @return a (deep) copy of this CSGeometry_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGeometry_t* -CSGeometry_clone(const CSGeometry_t* csg); - - -/** - * Frees this CSGeometry_t object. - * - * @param csg the CSGeometry_t structure. - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -void -CSGeometry_free(CSGeometry_t* csg); - - -/** - * Returns a ListOf_t * containing CSGObject_t objects from this CSGeometry_t. - * - * @param csg the CSGeometry_t structure whose ListOfCSGObjects is sought. - * - * @return the ListOfCSGObjects from this CSGeometry_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see CSGeometry_addCSGObject() - * @see CSGeometry_createCSGObject() - * @see CSGeometry_getCSGObjectById() - * @see CSGeometry_getCSGObject() - * @see CSGeometry_getNumCSGObjects() - * @see CSGeometry_removeCSGObjectById() - * @see CSGeometry_removeCSGObject() - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -ListOf_t* -CSGeometry_getListOfCSGObjects(CSGeometry_t* csg); - - -/** - * Get a CSGObject_t from the CSGeometry_t. - * - * @param csg the CSGeometry_t structure to search. - * - * @param n an unsigned int representing the index of the CSGObject_t to - * retrieve. - * - * @return the nth CSGObject_t in the ListOfCSGObjects within this CSGeometry - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_getCSGObject(CSGeometry_t* csg, unsigned int n); - - -/** - * Get a CSGObject_t from the CSGeometry_t based on its identifier. - * - * @param csg the CSGeometry_t structure to search. - * - * @param sid a string representing the identifier of the CSGObject_t to - * retrieve. - * - * @return the CSGObject_t in the ListOfCSGObjects within this CSGeometry with - * the given @p sid or @c NULL if no such CSGObject_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_getCSGObjectById(CSGeometry_t* csg, const char *sid); - - -/** - * Get a CSGObject_t from the CSGeometry_t based on the DomainType to which it - * refers. - * - * @param csg the CSGeometry_t structure to search. - * - * @param sid a string representing the "domainType" attribute of the - * CSGObject_t object to retrieve. - * - * @return the first CSGObject_t in this CSGeometry_t based on the given - * domainType attribute or NULL if no such CSGObject_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_getCSGObjectByDomainType(CSGeometry_t* csg, const char *sid); - - -/** - * Adds a copy of the given CSGObject_t to this CSGeometry_t. - * - * @param csg the CSGeometry_t structure to which the CSGObject_t should be - * added. - * - * @param csgo the CSGObject_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -int -CSGeometry_addCSGObject(CSGeometry_t* csg, const CSGObject_t* csgo); - - -/** - * Get the number of CSGObject_t objects in this CSGeometry_t. - * - * @param csg the CSGeometry_t structure to query. - * - * @return the number of CSGObject_t objects in this CSGeometry_t. - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -unsigned int -CSGeometry_getNumCSGObjects(CSGeometry_t* csg); - - -/** - * Creates a new CSGObject_t object, adds it to this CSGeometry_t object and - * returns the CSGObject_t object created. - * - * @param csg the CSGeometry_t structure to which the CSGObject_t should be - * added. - * - * @return a new CSGObject_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_createCSGObject(CSGeometry_t* csg); - - -/** - * Removes the nth CSGObject_t from this CSGeometry_t and returns a pointer to - * it. - * - * @param csg the CSGeometry_t structure to search. - * - * @param n an unsigned int representing the index of the CSGObject_t to - * remove. - * - * @return a pointer to the nth CSGObject_t in this CSGeometry_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_removeCSGObject(CSGeometry_t* csg, unsigned int n); - - -/** - * Removes the CSGObject_t from this CSGeometry_t based on its identifier and - * returns a pointer to it. - * - * @param csg the CSGeometry_t structure to search. - * - * @param sid a string representing the identifier of the CSGObject_t to - * remove. - * - * @return the CSGObject_t in this CSGeometry_t based on the identifier or NULL - * if no such CSGObject_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -CSGObject_t* -CSGeometry_removeCSGObjectById(CSGeometry_t* csg, const char* sid); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * CSGeometry_t object have been set. - * - * @param csg the CSGeometry_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * CSGeometry_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -int -CSGeometry_hasRequiredAttributes(const CSGeometry_t * csg); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * CSGeometry_t object have been set. - * - * @param csg the CSGeometry_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * CSGeometry_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the CSGeometry_t object are: - * - * @memberof CSGeometry_t - */ -LIBSBML_EXTERN -int -CSGeometry_hasRequiredElements(const CSGeometry_t * csg); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !CSGeometry_H__ */ - - +/** + * @file CSGeometry.h + * @brief Definition of the CSGeometry class. + * @author SBMLTeam + * + * + * + * @class CSGeometry + * @sbmlbrief{spatial} TODO:Definition of the CSGeometry class. + */ + + +#ifndef CSGeometry_H__ +#define CSGeometry_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN CSGeometry : public GeometryDefinition +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + ListOfCSGObjects mCSGObjects; + + /** @endcond */ + +public: + + /** + * Creates a new CSGeometry using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGeometry. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGeometry. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGeometry. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGeometry(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new CSGeometry using the given SpatialPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CSGeometry(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for CSGeometry. + * + * @param orig the CSGeometry instance to copy. + */ + CSGeometry(const CSGeometry& orig); + + + /** + * Assignment operator for CSGeometry. + * + * @param rhs the CSGeometry object whose values are to be used as the basis + * of the assignment. + */ + CSGeometry& operator=(const CSGeometry& rhs); + + + /** + * Creates and returns a deep copy of this CSGeometry object. + * + * @return a (deep) copy of this CSGeometry object. + */ + virtual CSGeometry* clone() const; + + + /** + * Destructor for CSGeometry. + */ + virtual ~CSGeometry(); + + + /** + * Returns the ListOfCSGObjects from this CSGeometry. + * + * @return the ListOfCSGObjects from this CSGeometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + const ListOfCSGObjects* getListOfCSGObjects() const; + + + /** + * Returns the ListOfCSGObjects from this CSGeometry. + * + * @return the ListOfCSGObjects from this CSGeometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + ListOfCSGObjects* getListOfCSGObjects(); + + + /** + * Get a CSGObject from the CSGeometry. + * + * @param n an unsigned int representing the index of the CSGObject to + * retrieve. + * + * @return the nth CSGObject in the ListOfCSGObjects within this CSGeometry + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + CSGObject* getCSGObject(unsigned int n); + + + /** + * Get a CSGObject from the CSGeometry. + * + * @param n an unsigned int representing the index of the CSGObject to + * retrieve. + * + * @return the nth CSGObject in the ListOfCSGObjects within this CSGeometry + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + const CSGObject* getCSGObject(unsigned int n) const; + + + /** + * Get a CSGObject from the CSGeometry based on its identifier. + * + * @param sid a string representing the identifier of the CSGObject to + * retrieve. + * + * @return the CSGObject in the ListOfCSGObjects within this CSGeometry with + * the given @p sid or @c NULL if no such CSGObject exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + CSGObject* getCSGObject(const std::string& sid); + + + /** + * Get a CSGObject from the CSGeometry based on its identifier. + * + * @param sid a string representing the identifier of the CSGObject to + * retrieve. + * + * @return the CSGObject in the ListOfCSGObjects within this CSGeometry with + * the given @p sid or @c NULL if no such CSGObject exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + const CSGObject* getCSGObject(const std::string& sid) const; + + + /** + * Get a CSGObject from the CSGeometry based on the DomainType to which it + * refers. + * + * @param sid a string representing the "domainType" attribute of the + * CSGObject object to retrieve. + * + * @return the first CSGObject in this CSGeometry based on the given + * domainType attribute or NULL if no such CSGObject exists. + * + * @copydetails doc_returned_unowned_pointer + */ + const CSGObject* getCSGObjectByDomainType(const std::string& sid) const; + + + /** + * Get a CSGObject from the CSGeometry based on the DomainType to which it + * refers. + * + * @param sid a string representing the "domainType" attribute of the + * CSGObject object to retrieve. + * + * @return the first CSGObject in this CSGeometry based on the given + * domainType attribute or NULL if no such CSGObject exists. + * + * @copydetails doc_returned_unowned_pointer + */ + CSGObject* getCSGObjectByDomainType(const std::string& sid); + + + /** + * Adds a copy of the given CSGObject to this CSGeometry. + * + * @param csgo the CSGObject object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + int addCSGObject(const CSGObject* csgo); + + + /** + * Get the number of CSGObject objects in this CSGeometry. + * + * @return the number of CSGObject objects in this CSGeometry. + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getCSGObject(unsigned int n) + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + unsigned int getNumCSGObjects() const; + + + /** + * Creates a new CSGObject object, adds it to this CSGeometry object and + * returns the CSGObject object created. + * + * @return a new CSGObject object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see getCSGObject(const std::string& sid) + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + * @see removeCSGObject(unsigned int n) + */ + CSGObject* createCSGObject(); + + + /** + * Removes the nth CSGObject from this CSGeometry and returns a pointer to + * it. + * + * @param n an unsigned int representing the index of the CSGObject to + * remove. + * + * @return a pointer to the nth CSGObject in this CSGeometry. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(const std::string& sid) + */ + CSGObject* removeCSGObject(unsigned int n); + + + /** + * Removes the CSGObject from this CSGeometry based on its identifier and + * returns a pointer to it. + * + * @param sid a string representing the identifier of the CSGObject to + * remove. + * + * @return the CSGObject in this CSGeometry based on the identifier or NULL + * if no such CSGObject exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addCSGObject(const CSGObject* object) + * @see createCSGObject() + * @see getCSGObject(const std::string& sid) + * @see getCSGObject(unsigned int n) + * @see getNumCSGObjects() + * @see removeCSGObject(unsigned int n) + */ + CSGObject* removeCSGObject(const std::string& sid); + + + /** + * Returns the XML element name of this CSGeometry object. + * + * For CSGeometry, the XML element name is always @c "csGeometry". + * + * @return the name of this element, i.e. @c "csGeometry". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this CSGeometry object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_CSGEOMETRY, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CSGeometry object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CSGeometry have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * CSGeometry object have been set. + * + * @return @c true to indicate that all the required elements of this + * CSGeometry have been set, otherwise @c false is returned. + * + * + * @note The required elements for the CSGeometry object are: + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this CSGeometry's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CSGeometry's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CSGeometry. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this CSGeometry. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this CSGeometry. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CSGeometry. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this CSGeometry. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this CSGeometry. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CSGeometry_t using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this CSGeometry_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CSGeometry_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CSGeometry_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGeometry_t * +CSGeometry_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this CSGeometry_t object. + * + * @param csg the CSGeometry_t structure. + * + * @return a (deep) copy of this CSGeometry_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGeometry_t* +CSGeometry_clone(const CSGeometry_t* csg); + + +/** + * Frees this CSGeometry_t object. + * + * @param csg the CSGeometry_t structure. + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +void +CSGeometry_free(CSGeometry_t* csg); + + +/** + * Returns a ListOf_t * containing CSGObject_t objects from this CSGeometry_t. + * + * @param csg the CSGeometry_t structure whose ListOfCSGObjects is sought. + * + * @return the ListOfCSGObjects from this CSGeometry_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see CSGeometry_addCSGObject() + * @see CSGeometry_createCSGObject() + * @see CSGeometry_getCSGObjectById() + * @see CSGeometry_getCSGObject() + * @see CSGeometry_getNumCSGObjects() + * @see CSGeometry_removeCSGObjectById() + * @see CSGeometry_removeCSGObject() + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +ListOf_t* +CSGeometry_getListOfCSGObjects(CSGeometry_t* csg); + + +/** + * Get a CSGObject_t from the CSGeometry_t. + * + * @param csg the CSGeometry_t structure to search. + * + * @param n an unsigned int representing the index of the CSGObject_t to + * retrieve. + * + * @return the nth CSGObject_t in the ListOfCSGObjects within this CSGeometry + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_getCSGObject(CSGeometry_t* csg, unsigned int n); + + +/** + * Get a CSGObject_t from the CSGeometry_t based on its identifier. + * + * @param csg the CSGeometry_t structure to search. + * + * @param sid a string representing the identifier of the CSGObject_t to + * retrieve. + * + * @return the CSGObject_t in the ListOfCSGObjects within this CSGeometry with + * the given @p sid or @c NULL if no such CSGObject_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_getCSGObjectById(CSGeometry_t* csg, const char *sid); + + +/** + * Get a CSGObject_t from the CSGeometry_t based on the DomainType to which it + * refers. + * + * @param csg the CSGeometry_t structure to search. + * + * @param sid a string representing the "domainType" attribute of the + * CSGObject_t object to retrieve. + * + * @return the first CSGObject_t in this CSGeometry_t based on the given + * domainType attribute or NULL if no such CSGObject_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_getCSGObjectByDomainType(CSGeometry_t* csg, const char *sid); + + +/** + * Adds a copy of the given CSGObject_t to this CSGeometry_t. + * + * @param csg the CSGeometry_t structure to which the CSGObject_t should be + * added. + * + * @param csgo the CSGObject_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +int +CSGeometry_addCSGObject(CSGeometry_t* csg, const CSGObject_t* csgo); + + +/** + * Get the number of CSGObject_t objects in this CSGeometry_t. + * + * @param csg the CSGeometry_t structure to query. + * + * @return the number of CSGObject_t objects in this CSGeometry_t. + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +unsigned int +CSGeometry_getNumCSGObjects(CSGeometry_t* csg); + + +/** + * Creates a new CSGObject_t object, adds it to this CSGeometry_t object and + * returns the CSGObject_t object created. + * + * @param csg the CSGeometry_t structure to which the CSGObject_t should be + * added. + * + * @return a new CSGObject_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_createCSGObject(CSGeometry_t* csg); + + +/** + * Removes the nth CSGObject_t from this CSGeometry_t and returns a pointer to + * it. + * + * @param csg the CSGeometry_t structure to search. + * + * @param n an unsigned int representing the index of the CSGObject_t to + * remove. + * + * @return a pointer to the nth CSGObject_t in this CSGeometry_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_removeCSGObject(CSGeometry_t* csg, unsigned int n); + + +/** + * Removes the CSGObject_t from this CSGeometry_t based on its identifier and + * returns a pointer to it. + * + * @param csg the CSGeometry_t structure to search. + * + * @param sid a string representing the identifier of the CSGObject_t to + * remove. + * + * @return the CSGObject_t in this CSGeometry_t based on the identifier or NULL + * if no such CSGObject_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +CSGObject_t* +CSGeometry_removeCSGObjectById(CSGeometry_t* csg, const char* sid); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CSGeometry_t object have been set. + * + * @param csg the CSGeometry_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CSGeometry_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +int +CSGeometry_hasRequiredAttributes(const CSGeometry_t * csg); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * CSGeometry_t object have been set. + * + * @param csg the CSGeometry_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * CSGeometry_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the CSGeometry_t object are: + * + * @memberof CSGeometry_t + */ +LIBSBML_EXTERN +int +CSGeometry_hasRequiredElements(const CSGeometry_t * csg); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CSGeometry_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/CategoricalDistribution.cpp b/generator/tests/test_cpp_code/test-code/CategoricalDistribution.cpp index b6dc4ace..1be13a21 100644 --- a/generator/tests/test_cpp_code/test-code/CategoricalDistribution.cpp +++ b/generator/tests/test_cpp_code/test-code/CategoricalDistribution.cpp @@ -1,1125 +1,1125 @@ -/** - * @file CategoricalDistribution.cpp - * @brief Implementation of the CategoricalDistribution class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new CategoricalDistribution using the given SBML Level, Version - * and “distrib” package version. - */ -CategoricalDistribution::CategoricalDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : CategoricalUnivariateDistribution(level, version, pkgVersion) - , mCategories (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new CategoricalDistribution using the given DistribPkgNamespaces - * object. - */ -CategoricalDistribution::CategoricalDistribution(DistribPkgNamespaces - *distribns) - : CategoricalUnivariateDistribution(distribns) - , mCategories (distribns) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for CategoricalDistribution. - */ -CategoricalDistribution::CategoricalDistribution(const CategoricalDistribution& - orig) - : CategoricalUnivariateDistribution( orig ) - , mCategories ( orig.mCategories ) -{ - connectToChild(); -} - - -/* - * Assignment operator for CategoricalDistribution. - */ -CategoricalDistribution& -CategoricalDistribution::operator=(const CategoricalDistribution& rhs) -{ - if (&rhs != this) - { - CategoricalUnivariateDistribution::operator=(rhs); - mCategories = rhs.mCategories; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this CategoricalDistribution object. - */ -CategoricalDistribution* -CategoricalDistribution::clone() const -{ - return new CategoricalDistribution(*this); -} - - -/* - * Destructor for CategoricalDistribution. - */ -CategoricalDistribution::~CategoricalDistribution() -{ -} - - -/* - * Returns the ListOfCategories from this CategoricalDistribution. - */ -const ListOfCategories* -CategoricalDistribution::getListOfCategories() const -{ - return &mCategories; -} - - -/* - * Returns the ListOfCategories from this CategoricalDistribution. - */ -ListOfCategories* -CategoricalDistribution::getListOfCategories() -{ - return &mCategories; -} - - -/* - * Get a Category from the CategoricalDistribution. - */ -Category* -CategoricalDistribution::getCategory(unsigned int n) -{ - return mCategories.get(n); -} - - -/* - * Get a Category from the CategoricalDistribution. - */ -const Category* -CategoricalDistribution::getCategory(unsigned int n) const -{ - return mCategories.get(n); -} - - -/* - * Adds a copy of the given Category to this CategoricalDistribution. - */ -int -CategoricalDistribution::addCategory(const Category* c) -{ - if (c == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (c->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != c->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != c->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(c)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else - { - return mCategories.append(c); - } -} - - -/* - * Get the number of Category objects in this CategoricalDistribution. - */ -unsigned int -CategoricalDistribution::getNumCategories() const -{ - return mCategories.size(); -} - - -/* - * Creates a new Category object, adds it to this CategoricalDistribution - * object and returns the Category object created. - */ -Category* -CategoricalDistribution::createCategory() -{ - Category* c = NULL; - - try - { - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - c = new Category(distribns); - delete distribns; - } - catch (...) - { - } - - if (c != NULL) - { - mCategories.appendAndOwn(c); - } - - return c; -} - - -/* - * Removes the nth Category from this CategoricalDistribution and returns a - * pointer to it. - */ -Category* -CategoricalDistribution::removeCategory(unsigned int n) -{ - return mCategories.remove(n); -} - - -/* - * Returns the XML element name of this CategoricalDistribution object. - */ -const std::string& -CategoricalDistribution::getElementName() const -{ - static const string name = "categoricalDistribution"; - return name; -} - - -/* - * Returns the libSBML type code for this CategoricalDistribution object. - */ -int -CategoricalDistribution::getTypeCode() const -{ - return SBML_DISTRIB_CATEGORICALDISTRIBUTION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * CategoricalDistribution object have been set. - */ -bool -CategoricalDistribution::hasRequiredAttributes() const -{ - bool allPresent = CategoricalUnivariateDistribution::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * CategoricalDistribution object have been set. - */ -bool -CategoricalDistribution::hasRequiredElements() const -{ - bool allPresent = CategoricalUnivariateDistribution::hasRequiredElements(); - - if (getNumCategories() == 0) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -CategoricalDistribution::writeElements(XMLOutputStream& stream) const -{ - CategoricalUnivariateDistribution::writeElements(stream); - - if (getNumCategories() > 0) - { - mCategories.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -CategoricalDistribution::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mCategories.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -CategoricalDistribution::setSBMLDocument(SBMLDocument* d) -{ - CategoricalUnivariateDistribution::setSBMLDocument(d); - - mCategories.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -CategoricalDistribution::connectToChild() -{ - CategoricalUnivariateDistribution::connectToChild(); - - mCategories.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -CategoricalDistribution::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - CategoricalUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, - flag); - - mCategories.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -CategoricalDistribution::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - CategoricalUnivariateDistribution::updateSBMLNamespace(package, level, - version); - - mCategories.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = - CategoricalUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this CategoricalDistribution's attribute - * "attributeName" is set. - */ -bool -CategoricalDistribution::isSetAttribute(const std::string& attributeName) const -{ - bool value = - CategoricalUnivariateDistribution::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::setAttribute(const std::string& attributeName, - int value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = - CategoricalUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * CategoricalDistribution. - */ -int -CategoricalDistribution::unsetAttribute(const std::string& attributeName) -{ - int value = CategoricalUnivariateDistribution::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this - * CategoricalDistribution. - */ -SBase* -CategoricalDistribution::createChildObject(const std::string& elementName) -{ - CategoricalUnivariateDistribution* obj = NULL; - - if (elementName == "category") - { - return createCategory(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this CategoricalDistribution. - */ -int -CategoricalDistribution::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "category" && element->getTypeCode() == - SBML_DISTRIB_CATEGORY) - { - return addCategory((const Category*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * CategoricalDistribution. - */ -SBase* -CategoricalDistribution::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "category") - { - for (unsigned int i = 0; i < getNumCategories(); i++) - { - if (getCategory(i)->getId() == id) - { - return removeCategory(i); - } - } - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this CategoricalDistribution. - */ -unsigned int -CategoricalDistribution::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "category") - { - return getNumCategories(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this CategoricalDistribution. - */ -SBase* -CategoricalDistribution::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "category") - { - return getCategory(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -CategoricalDistribution::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCategories.getId() == id) - { - return &mCategories; - } - - obj = mCategories.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -CategoricalDistribution::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCategories.getMetaId() == metaid) - { - return &mCategories; - } - - obj = mCategories.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -CategoricalDistribution::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mCategories, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -CategoricalDistribution::createObject(XMLInputStream& stream) -{ - SBase* obj = CategoricalUnivariateDistribution::createObject(stream); - - const std::string& name = stream.peek().getName(); - - if (name == "listOfCategories") - { - if (getErrorLog() && mCategories.size() != 0) - { - getErrorLog()->logPackageError("distrib", - DistribCategoricalDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - obj = &mCategories; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -CategoricalDistribution::addExpectedAttributes(ExpectedAttributes& attributes) -{ - CategoricalUnivariateDistribution::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -CategoricalDistribution::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - CategoricalUnivariateDistribution::readAttributes(attributes, - expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribCategoricalDistributionAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribCategoricalDistributionAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -CategoricalDistribution::writeAttributes(XMLOutputStream& stream) const -{ - CategoricalUnivariateDistribution::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new CategoricalDistribution_t using the given SBML Level, Version - * and “distrib” package version. - */ -LIBSBML_EXTERN -CategoricalDistribution_t * -CategoricalDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CategoricalDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this CategoricalDistribution_t object. - */ -LIBSBML_EXTERN -CategoricalDistribution_t* -CategoricalDistribution_clone(const CategoricalDistribution_t* cd) -{ - if (cd != NULL) - { - return static_cast(cd->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this CategoricalDistribution_t object. - */ -LIBSBML_EXTERN -void -CategoricalDistribution_free(CategoricalDistribution_t* cd) -{ - if (cd != NULL) - { - delete cd; - } -} - - -/* - * Returns a ListOf_t * containing Category_t objects from this - * CategoricalDistribution_t. - */ -LIBSBML_EXTERN -ListOf_t* -CategoricalDistribution_getListOfCategories(CategoricalDistribution_t* cd) -{ - return (cd != NULL) ? cd->getListOfCategories() : NULL; -} - - -/* - * Get a Category_t from the CategoricalDistribution_t. - */ -LIBSBML_EXTERN -Category_t* -CategoricalDistribution_getCategory(CategoricalDistribution_t* cd, - unsigned int n) -{ - return (cd != NULL) ? cd->getCategory(n) : NULL; -} - - -/* - * Adds a copy of the given Category_t to this CategoricalDistribution_t. - */ -LIBSBML_EXTERN -int -CategoricalDistribution_addCategory(CategoricalDistribution_t* cd, - const Category_t* c) -{ - return (cd != NULL) ? cd->addCategory(c) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of Category_t objects in this CategoricalDistribution_t. - */ -LIBSBML_EXTERN -unsigned int -CategoricalDistribution_getNumCategories(CategoricalDistribution_t* cd) -{ - return (cd != NULL) ? cd->getNumCategories() : SBML_INT_MAX; -} - - -/* - * Creates a new Category_t object, adds it to this CategoricalDistribution_t - * object and returns the Category_t object created. - */ -LIBSBML_EXTERN -Category_t* -CategoricalDistribution_createCategory(CategoricalDistribution_t* cd) -{ - return (cd != NULL) ? cd->createCategory() : NULL; -} - - -/* - * Removes the nth Category_t from this CategoricalDistribution_t and returns a - * pointer to it. - */ -LIBSBML_EXTERN -Category_t* -CategoricalDistribution_removeCategory(CategoricalDistribution_t* cd, - unsigned int n) -{ - return (cd != NULL) ? cd->removeCategory(n) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * CategoricalDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -CategoricalDistribution_hasRequiredAttributes(const CategoricalDistribution_t * - cd) -{ - return (cd != NULL) ? static_cast(cd->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * CategoricalDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -CategoricalDistribution_hasRequiredElements(const CategoricalDistribution_t * - cd) -{ - return (cd != NULL) ? static_cast(cd->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file CategoricalDistribution.cpp + * @brief Implementation of the CategoricalDistribution class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CategoricalDistribution using the given SBML Level, Version + * and “distrib” package version. + */ +CategoricalDistribution::CategoricalDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : CategoricalUnivariateDistribution(level, version, pkgVersion) + , mCategories (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new CategoricalDistribution using the given DistribPkgNamespaces + * object. + */ +CategoricalDistribution::CategoricalDistribution(DistribPkgNamespaces + *distribns) + : CategoricalUnivariateDistribution(distribns) + , mCategories (distribns) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for CategoricalDistribution. + */ +CategoricalDistribution::CategoricalDistribution(const CategoricalDistribution& + orig) + : CategoricalUnivariateDistribution( orig ) + , mCategories ( orig.mCategories ) +{ + connectToChild(); +} + + +/* + * Assignment operator for CategoricalDistribution. + */ +CategoricalDistribution& +CategoricalDistribution::operator=(const CategoricalDistribution& rhs) +{ + if (&rhs != this) + { + CategoricalUnivariateDistribution::operator=(rhs); + mCategories = rhs.mCategories; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CategoricalDistribution object. + */ +CategoricalDistribution* +CategoricalDistribution::clone() const +{ + return new CategoricalDistribution(*this); +} + + +/* + * Destructor for CategoricalDistribution. + */ +CategoricalDistribution::~CategoricalDistribution() +{ +} + + +/* + * Returns the ListOfCategories from this CategoricalDistribution. + */ +const ListOfCategories* +CategoricalDistribution::getListOfCategories() const +{ + return &mCategories; +} + + +/* + * Returns the ListOfCategories from this CategoricalDistribution. + */ +ListOfCategories* +CategoricalDistribution::getListOfCategories() +{ + return &mCategories; +} + + +/* + * Get a Category from the CategoricalDistribution. + */ +Category* +CategoricalDistribution::getCategory(unsigned int n) +{ + return mCategories.get(n); +} + + +/* + * Get a Category from the CategoricalDistribution. + */ +const Category* +CategoricalDistribution::getCategory(unsigned int n) const +{ + return mCategories.get(n); +} + + +/* + * Adds a copy of the given Category to this CategoricalDistribution. + */ +int +CategoricalDistribution::addCategory(const Category* c) +{ + if (c == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (c->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != c->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != c->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(c)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else + { + return mCategories.append(c); + } +} + + +/* + * Get the number of Category objects in this CategoricalDistribution. + */ +unsigned int +CategoricalDistribution::getNumCategories() const +{ + return mCategories.size(); +} + + +/* + * Creates a new Category object, adds it to this CategoricalDistribution + * object and returns the Category object created. + */ +Category* +CategoricalDistribution::createCategory() +{ + Category* c = NULL; + + try + { + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + c = new Category(distribns); + delete distribns; + } + catch (...) + { + } + + if (c != NULL) + { + mCategories.appendAndOwn(c); + } + + return c; +} + + +/* + * Removes the nth Category from this CategoricalDistribution and returns a + * pointer to it. + */ +Category* +CategoricalDistribution::removeCategory(unsigned int n) +{ + return mCategories.remove(n); +} + + +/* + * Returns the XML element name of this CategoricalDistribution object. + */ +const std::string& +CategoricalDistribution::getElementName() const +{ + static const string name = "categoricalDistribution"; + return name; +} + + +/* + * Returns the libSBML type code for this CategoricalDistribution object. + */ +int +CategoricalDistribution::getTypeCode() const +{ + return SBML_DISTRIB_CATEGORICALDISTRIBUTION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CategoricalDistribution object have been set. + */ +bool +CategoricalDistribution::hasRequiredAttributes() const +{ + bool allPresent = CategoricalUnivariateDistribution::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * CategoricalDistribution object have been set. + */ +bool +CategoricalDistribution::hasRequiredElements() const +{ + bool allPresent = CategoricalUnivariateDistribution::hasRequiredElements(); + + if (getNumCategories() == 0) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +CategoricalDistribution::writeElements(XMLOutputStream& stream) const +{ + CategoricalUnivariateDistribution::writeElements(stream); + + if (getNumCategories() > 0) + { + mCategories.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +CategoricalDistribution::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mCategories.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +CategoricalDistribution::setSBMLDocument(SBMLDocument* d) +{ + CategoricalUnivariateDistribution::setSBMLDocument(d); + + mCategories.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +CategoricalDistribution::connectToChild() +{ + CategoricalUnivariateDistribution::connectToChild(); + + mCategories.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +CategoricalDistribution::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + CategoricalUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, + flag); + + mCategories.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +CategoricalDistribution::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + CategoricalUnivariateDistribution::updateSBMLNamespace(package, level, + version); + + mCategories.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = + CategoricalUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this CategoricalDistribution's attribute + * "attributeName" is set. + */ +bool +CategoricalDistribution::isSetAttribute(const std::string& attributeName) const +{ + bool value = + CategoricalUnivariateDistribution::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::setAttribute(const std::string& attributeName, + int value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = + CategoricalUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * CategoricalDistribution. + */ +int +CategoricalDistribution::unsetAttribute(const std::string& attributeName) +{ + int value = CategoricalUnivariateDistribution::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this + * CategoricalDistribution. + */ +SBase* +CategoricalDistribution::createChildObject(const std::string& elementName) +{ + CategoricalUnivariateDistribution* obj = NULL; + + if (elementName == "category") + { + return createCategory(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this CategoricalDistribution. + */ +int +CategoricalDistribution::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "category" && element->getTypeCode() == + SBML_DISTRIB_CATEGORY) + { + return addCategory((const Category*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CategoricalDistribution. + */ +SBase* +CategoricalDistribution::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "category") + { + for (unsigned int i = 0; i < getNumCategories(); i++) + { + if (getCategory(i)->getId() == id) + { + return removeCategory(i); + } + } + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this CategoricalDistribution. + */ +unsigned int +CategoricalDistribution::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "category") + { + return getNumCategories(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this CategoricalDistribution. + */ +SBase* +CategoricalDistribution::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "category") + { + return getCategory(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +CategoricalDistribution::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCategories.getId() == id) + { + return &mCategories; + } + + obj = mCategories.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +CategoricalDistribution::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCategories.getMetaId() == metaid) + { + return &mCategories; + } + + obj = mCategories.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +CategoricalDistribution::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mCategories, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +CategoricalDistribution::createObject(XMLInputStream& stream) +{ + SBase* obj = CategoricalUnivariateDistribution::createObject(stream); + + const std::string& name = stream.peek().getName(); + + if (name == "listOfCategories") + { + if (getErrorLog() && mCategories.size() != 0) + { + getErrorLog()->logPackageError("distrib", + DistribCategoricalDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + obj = &mCategories; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CategoricalDistribution::addExpectedAttributes(ExpectedAttributes& attributes) +{ + CategoricalUnivariateDistribution::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CategoricalDistribution::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + CategoricalUnivariateDistribution::readAttributes(attributes, + expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribCategoricalDistributionAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribCategoricalDistributionAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +CategoricalDistribution::writeAttributes(XMLOutputStream& stream) const +{ + CategoricalUnivariateDistribution::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CategoricalDistribution_t using the given SBML Level, Version + * and “distrib” package version. + */ +LIBSBML_EXTERN +CategoricalDistribution_t * +CategoricalDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CategoricalDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this CategoricalDistribution_t object. + */ +LIBSBML_EXTERN +CategoricalDistribution_t* +CategoricalDistribution_clone(const CategoricalDistribution_t* cd) +{ + if (cd != NULL) + { + return static_cast(cd->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CategoricalDistribution_t object. + */ +LIBSBML_EXTERN +void +CategoricalDistribution_free(CategoricalDistribution_t* cd) +{ + if (cd != NULL) + { + delete cd; + } +} + + +/* + * Returns a ListOf_t * containing Category_t objects from this + * CategoricalDistribution_t. + */ +LIBSBML_EXTERN +ListOf_t* +CategoricalDistribution_getListOfCategories(CategoricalDistribution_t* cd) +{ + return (cd != NULL) ? cd->getListOfCategories() : NULL; +} + + +/* + * Get a Category_t from the CategoricalDistribution_t. + */ +LIBSBML_EXTERN +Category_t* +CategoricalDistribution_getCategory(CategoricalDistribution_t* cd, + unsigned int n) +{ + return (cd != NULL) ? cd->getCategory(n) : NULL; +} + + +/* + * Adds a copy of the given Category_t to this CategoricalDistribution_t. + */ +LIBSBML_EXTERN +int +CategoricalDistribution_addCategory(CategoricalDistribution_t* cd, + const Category_t* c) +{ + return (cd != NULL) ? cd->addCategory(c) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of Category_t objects in this CategoricalDistribution_t. + */ +LIBSBML_EXTERN +unsigned int +CategoricalDistribution_getNumCategories(CategoricalDistribution_t* cd) +{ + return (cd != NULL) ? cd->getNumCategories() : SBML_INT_MAX; +} + + +/* + * Creates a new Category_t object, adds it to this CategoricalDistribution_t + * object and returns the Category_t object created. + */ +LIBSBML_EXTERN +Category_t* +CategoricalDistribution_createCategory(CategoricalDistribution_t* cd) +{ + return (cd != NULL) ? cd->createCategory() : NULL; +} + + +/* + * Removes the nth Category_t from this CategoricalDistribution_t and returns a + * pointer to it. + */ +LIBSBML_EXTERN +Category_t* +CategoricalDistribution_removeCategory(CategoricalDistribution_t* cd, + unsigned int n) +{ + return (cd != NULL) ? cd->removeCategory(n) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CategoricalDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +CategoricalDistribution_hasRequiredAttributes(const CategoricalDistribution_t * + cd) +{ + return (cd != NULL) ? static_cast(cd->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * CategoricalDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +CategoricalDistribution_hasRequiredElements(const CategoricalDistribution_t * + cd) +{ + return (cd != NULL) ? static_cast(cd->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/CategoricalDistribution.h b/generator/tests/test_cpp_code/test-code/CategoricalDistribution.h index 91cc9820..7a85207b 100644 --- a/generator/tests/test_cpp_code/test-code/CategoricalDistribution.h +++ b/generator/tests/test_cpp_code/test-code/CategoricalDistribution.h @@ -1,1112 +1,1112 @@ -/** - * @file CategoricalDistribution.h - * @brief Definition of the CategoricalDistribution class. - * @author SBMLTeam - * - * - * - * @class CategoricalDistribution - * @sbmlbrief{distrib} TODO:Definition of the CategoricalDistribution class. - */ - - -#ifndef CategoricalDistribution_H__ -#define CategoricalDistribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN CategoricalDistribution : public - CategoricalUnivariateDistribution -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - ListOfCategories mCategories; - - /** @endcond */ - -public: - - /** - * Creates a new CategoricalDistribution using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CategoricalDistribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * CategoricalDistribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this CategoricalDistribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - CategoricalDistribution( - unsigned int level = - DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new CategoricalDistribution using the given DistribPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - CategoricalDistribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for CategoricalDistribution. - * - * @param orig the CategoricalDistribution instance to copy. - */ - CategoricalDistribution(const CategoricalDistribution& orig); - - - /** - * Assignment operator for CategoricalDistribution. - * - * @param rhs the CategoricalDistribution object whose values are to be used - * as the basis of the assignment. - */ - CategoricalDistribution& operator=(const CategoricalDistribution& rhs); - - - /** - * Creates and returns a deep copy of this CategoricalDistribution object. - * - * @return a (deep) copy of this CategoricalDistribution object. - */ - virtual CategoricalDistribution* clone() const; - - - /** - * Destructor for CategoricalDistribution. - */ - virtual ~CategoricalDistribution(); - - - /** - * Returns the ListOfCategories from this CategoricalDistribution. - * - * @return the ListOfCategories from this CategoricalDistribution. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCategory(const Category* object) - * @see createCategory() - * @see getCategory(const std::string& sid) - * @see getCategory(unsigned int n) - * @see getNumCategories() - * @see removeCategory(const std::string& sid) - * @see removeCategory(unsigned int n) - */ - const ListOfCategories* getListOfCategories() const; - - - /** - * Returns the ListOfCategories from this CategoricalDistribution. - * - * @return the ListOfCategories from this CategoricalDistribution. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCategory(const Category* object) - * @see createCategory() - * @see getCategory(const std::string& sid) - * @see getCategory(unsigned int n) - * @see getNumCategories() - * @see removeCategory(const std::string& sid) - * @see removeCategory(unsigned int n) - */ - ListOfCategories* getListOfCategories(); - - - /** - * Get a Category from the CategoricalDistribution. - * - * @param n an unsigned int representing the index of the Category to - * retrieve. - * - * @return the nth Category in the ListOfCategories within this - * CategoricalDistribution or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCategory(const Category* object) - * @see createCategory() - * @see getCategory(const std::string& sid) - * @see getNumCategories() - * @see removeCategory(const std::string& sid) - * @see removeCategory(unsigned int n) - */ - Category* getCategory(unsigned int n); - - - /** - * Get a Category from the CategoricalDistribution. - * - * @param n an unsigned int representing the index of the Category to - * retrieve. - * - * @return the nth Category in the ListOfCategories within this - * CategoricalDistribution or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCategory(const Category* object) - * @see createCategory() - * @see getCategory(const std::string& sid) - * @see getNumCategories() - * @see removeCategory(const std::string& sid) - * @see removeCategory(unsigned int n) - */ - const Category* getCategory(unsigned int n) const; - - - /** - * Adds a copy of the given Category to this CategoricalDistribution. - * - * @param c the Category object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createCategory() - * @see getCategory(const std::string& sid) - * @see getCategory(unsigned int n) - * @see getNumCategories() - * @see removeCategory(const std::string& sid) - * @see removeCategory(unsigned int n) - */ - int addCategory(const Category* c); - - - /** - * Get the number of Category objects in this CategoricalDistribution. - * - * @return the number of Category objects in this CategoricalDistribution. - * - * @see addCategory(const Category* object) - * @see createCategory() - * @see getCategory(const std::string& sid) - * @see getCategory(unsigned int n) - * @see removeCategory(const std::string& sid) - * @see removeCategory(unsigned int n) - */ - unsigned int getNumCategories() const; - - - /** - * Creates a new Category object, adds it to this CategoricalDistribution - * object and returns the Category object created. - * - * @return a new Category object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCategory(const Category* object) - * @see getCategory(const std::string& sid) - * @see getCategory(unsigned int n) - * @see getNumCategories() - * @see removeCategory(const std::string& sid) - * @see removeCategory(unsigned int n) - */ - Category* createCategory(); - - - /** - * Removes the nth Category from this CategoricalDistribution and returns a - * pointer to it. - * - * @param n an unsigned int representing the index of the Category to remove. - * - * @return a pointer to the nth Category in this CategoricalDistribution. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addCategory(const Category* object) - * @see createCategory() - * @see getCategory(const std::string& sid) - * @see getCategory(unsigned int n) - * @see getNumCategories() - * @see removeCategory(const std::string& sid) - */ - Category* removeCategory(unsigned int n); - - - /** - * Returns the XML element name of this CategoricalDistribution object. - * - * For CategoricalDistribution, the XML element name is always - * @c "categoricalDistribution". - * - * @return the name of this element, i.e. @c "categoricalDistribution". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this CategoricalDistribution object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_CATEGORICALDISTRIBUTION, - * SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * CategoricalDistribution object have been set. - * - * @return @c true to indicate that all the required attributes of this - * CategoricalDistribution have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * CategoricalDistribution object have been set. - * - * @return @c true to indicate that all the required elements of this - * CategoricalDistribution have been set, otherwise @c false is returned. - * - * - * @note The required elements for the CategoricalDistribution object are: - * @li "category" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this CategoricalDistribution's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this CategoricalDistribution's attribute - * "attributeName" has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * CategoricalDistribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this - * CategoricalDistribution. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this CategoricalDistribution. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * CategoricalDistribution. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this CategoricalDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this CategoricalDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new CategoricalDistribution_t using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CategoricalDistribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CategoricalDistribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this CategoricalDistribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -CategoricalDistribution_t * -CategoricalDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this CategoricalDistribution_t object. - * - * @param cd the CategoricalDistribution_t structure. - * - * @return a (deep) copy of this CategoricalDistribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -CategoricalDistribution_t* -CategoricalDistribution_clone(const CategoricalDistribution_t* cd); - - -/** - * Frees this CategoricalDistribution_t object. - * - * @param cd the CategoricalDistribution_t structure. - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -void -CategoricalDistribution_free(CategoricalDistribution_t* cd); - - -/** - * Returns a ListOf_t * containing Category_t objects from this - * CategoricalDistribution_t. - * - * @param cd the CategoricalDistribution_t structure whose ListOfCategories is - * sought. - * - * @return the ListOfCategories from this CategoricalDistribution_t as a - * ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see CategoricalDistribution_addCategory() - * @see CategoricalDistribution_createCategory() - * @see CategoricalDistribution_getCategoryById() - * @see CategoricalDistribution_getCategory() - * @see CategoricalDistribution_getNumCategories() - * @see CategoricalDistribution_removeCategoryById() - * @see CategoricalDistribution_removeCategory() - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -ListOf_t* -CategoricalDistribution_getListOfCategories(CategoricalDistribution_t* cd); - - -/** - * Get a Category_t from the CategoricalDistribution_t. - * - * @param cd the CategoricalDistribution_t structure to search. - * - * @param n an unsigned int representing the index of the Category_t to - * retrieve. - * - * @return the nth Category_t in the ListOfCategories within this - * CategoricalDistribution or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -Category_t* -CategoricalDistribution_getCategory(CategoricalDistribution_t* cd, - unsigned int n); - - -/** - * Adds a copy of the given Category_t to this CategoricalDistribution_t. - * - * @param cd the CategoricalDistribution_t structure to which the Category_t - * should be added. - * - * @param c the Category_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -int -CategoricalDistribution_addCategory(CategoricalDistribution_t* cd, - const Category_t* c); - - -/** - * Get the number of Category_t objects in this CategoricalDistribution_t. - * - * @param cd the CategoricalDistribution_t structure to query. - * - * @return the number of Category_t objects in this CategoricalDistribution_t. - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -unsigned int -CategoricalDistribution_getNumCategories(CategoricalDistribution_t* cd); - - -/** - * Creates a new Category_t object, adds it to this CategoricalDistribution_t - * object and returns the Category_t object created. - * - * @param cd the CategoricalDistribution_t structure to which the Category_t - * should be added. - * - * @return a new Category_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -Category_t* -CategoricalDistribution_createCategory(CategoricalDistribution_t* cd); - - -/** - * Removes the nth Category_t from this CategoricalDistribution_t and returns a - * pointer to it. - * - * @param cd the CategoricalDistribution_t structure to search. - * - * @param n an unsigned int representing the index of the Category_t to remove. - * - * @return a pointer to the nth Category_t in this CategoricalDistribution_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -Category_t* -CategoricalDistribution_removeCategory(CategoricalDistribution_t* cd, - unsigned int n); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * CategoricalDistribution_t object have been set. - * - * @param cd the CategoricalDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * CategoricalDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -int -CategoricalDistribution_hasRequiredAttributes(const CategoricalDistribution_t * - cd); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * CategoricalDistribution_t object have been set. - * - * @param cd the CategoricalDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * CategoricalDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the CategoricalDistribution_t object are: - * @li "category" - * - * @memberof CategoricalDistribution_t - */ -LIBSBML_EXTERN -int -CategoricalDistribution_hasRequiredElements(const CategoricalDistribution_t * - cd); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !CategoricalDistribution_H__ */ - - +/** + * @file CategoricalDistribution.h + * @brief Definition of the CategoricalDistribution class. + * @author SBMLTeam + * + * + * + * @class CategoricalDistribution + * @sbmlbrief{distrib} TODO:Definition of the CategoricalDistribution class. + */ + + +#ifndef CategoricalDistribution_H__ +#define CategoricalDistribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN CategoricalDistribution : public + CategoricalUnivariateDistribution +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + ListOfCategories mCategories; + + /** @endcond */ + +public: + + /** + * Creates a new CategoricalDistribution using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CategoricalDistribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * CategoricalDistribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this CategoricalDistribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + CategoricalDistribution( + unsigned int level = + DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new CategoricalDistribution using the given DistribPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CategoricalDistribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for CategoricalDistribution. + * + * @param orig the CategoricalDistribution instance to copy. + */ + CategoricalDistribution(const CategoricalDistribution& orig); + + + /** + * Assignment operator for CategoricalDistribution. + * + * @param rhs the CategoricalDistribution object whose values are to be used + * as the basis of the assignment. + */ + CategoricalDistribution& operator=(const CategoricalDistribution& rhs); + + + /** + * Creates and returns a deep copy of this CategoricalDistribution object. + * + * @return a (deep) copy of this CategoricalDistribution object. + */ + virtual CategoricalDistribution* clone() const; + + + /** + * Destructor for CategoricalDistribution. + */ + virtual ~CategoricalDistribution(); + + + /** + * Returns the ListOfCategories from this CategoricalDistribution. + * + * @return the ListOfCategories from this CategoricalDistribution. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCategory(const Category* object) + * @see createCategory() + * @see getCategory(const std::string& sid) + * @see getCategory(unsigned int n) + * @see getNumCategories() + * @see removeCategory(const std::string& sid) + * @see removeCategory(unsigned int n) + */ + const ListOfCategories* getListOfCategories() const; + + + /** + * Returns the ListOfCategories from this CategoricalDistribution. + * + * @return the ListOfCategories from this CategoricalDistribution. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCategory(const Category* object) + * @see createCategory() + * @see getCategory(const std::string& sid) + * @see getCategory(unsigned int n) + * @see getNumCategories() + * @see removeCategory(const std::string& sid) + * @see removeCategory(unsigned int n) + */ + ListOfCategories* getListOfCategories(); + + + /** + * Get a Category from the CategoricalDistribution. + * + * @param n an unsigned int representing the index of the Category to + * retrieve. + * + * @return the nth Category in the ListOfCategories within this + * CategoricalDistribution or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCategory(const Category* object) + * @see createCategory() + * @see getCategory(const std::string& sid) + * @see getNumCategories() + * @see removeCategory(const std::string& sid) + * @see removeCategory(unsigned int n) + */ + Category* getCategory(unsigned int n); + + + /** + * Get a Category from the CategoricalDistribution. + * + * @param n an unsigned int representing the index of the Category to + * retrieve. + * + * @return the nth Category in the ListOfCategories within this + * CategoricalDistribution or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCategory(const Category* object) + * @see createCategory() + * @see getCategory(const std::string& sid) + * @see getNumCategories() + * @see removeCategory(const std::string& sid) + * @see removeCategory(unsigned int n) + */ + const Category* getCategory(unsigned int n) const; + + + /** + * Adds a copy of the given Category to this CategoricalDistribution. + * + * @param c the Category object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCategory() + * @see getCategory(const std::string& sid) + * @see getCategory(unsigned int n) + * @see getNumCategories() + * @see removeCategory(const std::string& sid) + * @see removeCategory(unsigned int n) + */ + int addCategory(const Category* c); + + + /** + * Get the number of Category objects in this CategoricalDistribution. + * + * @return the number of Category objects in this CategoricalDistribution. + * + * @see addCategory(const Category* object) + * @see createCategory() + * @see getCategory(const std::string& sid) + * @see getCategory(unsigned int n) + * @see removeCategory(const std::string& sid) + * @see removeCategory(unsigned int n) + */ + unsigned int getNumCategories() const; + + + /** + * Creates a new Category object, adds it to this CategoricalDistribution + * object and returns the Category object created. + * + * @return a new Category object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCategory(const Category* object) + * @see getCategory(const std::string& sid) + * @see getCategory(unsigned int n) + * @see getNumCategories() + * @see removeCategory(const std::string& sid) + * @see removeCategory(unsigned int n) + */ + Category* createCategory(); + + + /** + * Removes the nth Category from this CategoricalDistribution and returns a + * pointer to it. + * + * @param n an unsigned int representing the index of the Category to remove. + * + * @return a pointer to the nth Category in this CategoricalDistribution. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addCategory(const Category* object) + * @see createCategory() + * @see getCategory(const std::string& sid) + * @see getCategory(unsigned int n) + * @see getNumCategories() + * @see removeCategory(const std::string& sid) + */ + Category* removeCategory(unsigned int n); + + + /** + * Returns the XML element name of this CategoricalDistribution object. + * + * For CategoricalDistribution, the XML element name is always + * @c "categoricalDistribution". + * + * @return the name of this element, i.e. @c "categoricalDistribution". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this CategoricalDistribution object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_CATEGORICALDISTRIBUTION, + * SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CategoricalDistribution object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CategoricalDistribution have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * CategoricalDistribution object have been set. + * + * @return @c true to indicate that all the required elements of this + * CategoricalDistribution have been set, otherwise @c false is returned. + * + * + * @note The required elements for the CategoricalDistribution object are: + * @li "category" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this CategoricalDistribution's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CategoricalDistribution's attribute + * "attributeName" has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * CategoricalDistribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this + * CategoricalDistribution. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this CategoricalDistribution. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CategoricalDistribution. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this CategoricalDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this CategoricalDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CategoricalDistribution_t using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CategoricalDistribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CategoricalDistribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this CategoricalDistribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +CategoricalDistribution_t * +CategoricalDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this CategoricalDistribution_t object. + * + * @param cd the CategoricalDistribution_t structure. + * + * @return a (deep) copy of this CategoricalDistribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +CategoricalDistribution_t* +CategoricalDistribution_clone(const CategoricalDistribution_t* cd); + + +/** + * Frees this CategoricalDistribution_t object. + * + * @param cd the CategoricalDistribution_t structure. + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +void +CategoricalDistribution_free(CategoricalDistribution_t* cd); + + +/** + * Returns a ListOf_t * containing Category_t objects from this + * CategoricalDistribution_t. + * + * @param cd the CategoricalDistribution_t structure whose ListOfCategories is + * sought. + * + * @return the ListOfCategories from this CategoricalDistribution_t as a + * ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see CategoricalDistribution_addCategory() + * @see CategoricalDistribution_createCategory() + * @see CategoricalDistribution_getCategoryById() + * @see CategoricalDistribution_getCategory() + * @see CategoricalDistribution_getNumCategories() + * @see CategoricalDistribution_removeCategoryById() + * @see CategoricalDistribution_removeCategory() + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +ListOf_t* +CategoricalDistribution_getListOfCategories(CategoricalDistribution_t* cd); + + +/** + * Get a Category_t from the CategoricalDistribution_t. + * + * @param cd the CategoricalDistribution_t structure to search. + * + * @param n an unsigned int representing the index of the Category_t to + * retrieve. + * + * @return the nth Category_t in the ListOfCategories within this + * CategoricalDistribution or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +Category_t* +CategoricalDistribution_getCategory(CategoricalDistribution_t* cd, + unsigned int n); + + +/** + * Adds a copy of the given Category_t to this CategoricalDistribution_t. + * + * @param cd the CategoricalDistribution_t structure to which the Category_t + * should be added. + * + * @param c the Category_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +int +CategoricalDistribution_addCategory(CategoricalDistribution_t* cd, + const Category_t* c); + + +/** + * Get the number of Category_t objects in this CategoricalDistribution_t. + * + * @param cd the CategoricalDistribution_t structure to query. + * + * @return the number of Category_t objects in this CategoricalDistribution_t. + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +unsigned int +CategoricalDistribution_getNumCategories(CategoricalDistribution_t* cd); + + +/** + * Creates a new Category_t object, adds it to this CategoricalDistribution_t + * object and returns the Category_t object created. + * + * @param cd the CategoricalDistribution_t structure to which the Category_t + * should be added. + * + * @return a new Category_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +Category_t* +CategoricalDistribution_createCategory(CategoricalDistribution_t* cd); + + +/** + * Removes the nth Category_t from this CategoricalDistribution_t and returns a + * pointer to it. + * + * @param cd the CategoricalDistribution_t structure to search. + * + * @param n an unsigned int representing the index of the Category_t to remove. + * + * @return a pointer to the nth Category_t in this CategoricalDistribution_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +Category_t* +CategoricalDistribution_removeCategory(CategoricalDistribution_t* cd, + unsigned int n); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CategoricalDistribution_t object have been set. + * + * @param cd the CategoricalDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CategoricalDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +int +CategoricalDistribution_hasRequiredAttributes(const CategoricalDistribution_t * + cd); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * CategoricalDistribution_t object have been set. + * + * @param cd the CategoricalDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * CategoricalDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the CategoricalDistribution_t object are: + * @li "category" + * + * @memberof CategoricalDistribution_t + */ +LIBSBML_EXTERN +int +CategoricalDistribution_hasRequiredElements(const CategoricalDistribution_t * + cd); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CategoricalDistribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Category.cpp b/generator/tests/test_cpp_code/test-code/Category.cpp index 1a272e07..97cb28f1 100644 --- a/generator/tests/test_cpp_code/test-code/Category.cpp +++ b/generator/tests/test_cpp_code/test-code/Category.cpp @@ -1,1559 +1,1559 @@ -/** - * @file Category.cpp - * @brief Implementation of the Category class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Category using the given SBML Level, Version and - * “distrib” package version. - */ -Category::Category(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mRank (SBML_INT_MAX) - , mIsSetRank (false) - , mProbability (NULL) - , mValue (NULL) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new Category using the given DistribPkgNamespaces object. - */ -Category::Category(DistribPkgNamespaces *distribns) - : SBase(distribns) - , mRank (SBML_INT_MAX) - , mIsSetRank (false) - , mProbability (NULL) - , mValue (NULL) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for Category. - */ -Category::Category(const Category& orig) - : SBase( orig ) - , mRank ( orig.mRank ) - , mIsSetRank ( orig.mIsSetRank ) - , mProbability ( NULL ) - , mValue ( NULL ) -{ - if (orig.mProbability != NULL) - { - mProbability = orig.mProbability->clone(); - } - - if (orig.mValue != NULL) - { - mValue = orig.mValue->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for Category. - */ -Category& -Category::operator=(const Category& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mRank = rhs.mRank; - mIsSetRank = rhs.mIsSetRank; - delete mProbability; - if (rhs.mProbability != NULL) - { - mProbability = rhs.mProbability->clone(); - } - else - { - mProbability = NULL; - } - - delete mValue; - if (rhs.mValue != NULL) - { - mValue = rhs.mValue->clone(); - } - else - { - mValue = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Category object. - */ -Category* -Category::clone() const -{ - return new Category(*this); -} - - -/* - * Destructor for Category. - */ -Category::~Category() -{ - delete mProbability; - mProbability = NULL; - delete mValue; - mValue = NULL; -} - - -/* - * Returns the value of the "rank" attribute of this Category. - */ -unsigned int -Category::getRank() const -{ - return mRank; -} - - -/* - * Predicate returning @c true if this Category's "rank" attribute is set. - */ -bool -Category::isSetRank() const -{ - return mIsSetRank; -} - - -/* - * Sets the value of the "rank" attribute of this Category. - */ -int -Category::setRank(unsigned int rank) -{ - mRank = rank; - mIsSetRank = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "rank" attribute of this Category. - */ -int -Category::unsetRank() -{ - mRank = SBML_INT_MAX; - mIsSetRank = false; - - if (isSetRank() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "probability" element of this Category. - */ -const UncertValue* -Category::getProbability() const -{ - return mProbability; -} - - -/* - * Returns the value of the "probability" element of this Category. - */ -UncertValue* -Category::getProbability() -{ - return mProbability; -} - - -/* - * Returns the value of the "value" element of this Category. - */ -const UncertValue* -Category::getValue() const -{ - return mValue; -} - - -/* - * Returns the value of the "value" element of this Category. - */ -UncertValue* -Category::getValue() -{ - return mValue; -} - - -/* - * Predicate returning @c true if this Category's "probability" element is set. - */ -bool -Category::isSetProbability() const -{ - return (mProbability != NULL); -} - - -/* - * Predicate returning @c true if this Category's "value" element is set. - */ -bool -Category::isSetValue() const -{ - return (mValue != NULL); -} - - -/* - * Sets the value of the "probability" element of this Category. - */ -int -Category::setProbability(const UncertValue* probability) -{ - if (mProbability == probability) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (probability == NULL) - { - delete mProbability; - mProbability = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mProbability; - mProbability = (probability != NULL) ? probability->clone() : NULL; - if (mProbability != NULL) - { - mProbability->setElementName("probability"); - mProbability->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "value" element of this Category. - */ -int -Category::setValue(const UncertValue* value) -{ - if (mValue == value) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (value == NULL) - { - delete mValue; - mValue = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mValue; - mValue = (value != NULL) ? value->clone() : NULL; - if (mValue != NULL) - { - mValue->setElementName("value"); - mValue->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new UncertValue object, adds it to this Category object and - * returns the UncertValue object created. - */ -UncertValue* -Category::createProbability() -{ - if (mProbability != NULL) - { - delete mProbability; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mProbability = new UncertValue(distribns); - - mProbability->setElementName("probability"); - - delete distribns; - - connectToChild(); - - return mProbability; -} - - -/* - * Creates a new UncertValue object, adds it to this Category object and - * returns the UncertValue object created. - */ -UncertValue* -Category::createValue() -{ - if (mValue != NULL) - { - delete mValue; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mValue = new UncertValue(distribns); - - mValue->setElementName("value"); - - delete distribns; - - connectToChild(); - - return mValue; -} - - -/* - * Unsets the value of the "probability" element of this Category. - */ -int -Category::unsetProbability() -{ - delete mProbability; - mProbability = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "value" element of this Category. - */ -int -Category::unsetValue() -{ - delete mValue; - mValue = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this Category object. - */ -const std::string& -Category::getElementName() const -{ - static const string name = "category"; - return name; -} - - -/* - * Returns the libSBML type code for this Category object. - */ -int -Category::getTypeCode() const -{ - return SBML_DISTRIB_CATEGORY; -} - - -/* - * Predicate returning @c true if all the required attributes for this Category - * object have been set. - */ -bool -Category::hasRequiredAttributes() const -{ - bool allPresent = true; - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this Category - * object have been set. - */ -bool -Category::hasRequiredElements() const -{ - bool allPresent = true; - - if (isSetValue() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Category::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetProbability() == true) - { - mProbability->write(stream); - } - - if (isSetValue() == true) - { - mValue->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Category::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mProbability != NULL) - { - mProbability->accept(v); - } - - if (mValue != NULL) - { - mValue->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Category::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mProbability != NULL) - { - mProbability->setSBMLDocument(d); - } - - if (mValue != NULL) - { - mValue->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Category::connectToChild() -{ - SBase::connectToChild(); - - if (mProbability != NULL) - { - mProbability->connectToParent(this); - } - - if (mValue != NULL) - { - mValue->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Category::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetProbability()) - { - mProbability->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - if (isSetValue()) - { - mValue->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -Category::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mProbability != NULL) - { - mProbability->updateSBMLNamespace(package, level, version); - } - - if (mValue != NULL) - { - mValue->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Category. - */ -int -Category::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Category. - */ -int -Category::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Category. - */ -int -Category::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Category. - */ -int -Category::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "rank") - { - value = getRank(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Category. - */ -int -Category::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Category's attribute "attributeName" is - * set. - */ -bool -Category::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "rank") - { - value = isSetRank(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Category. - */ -int -Category::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Category. - */ -int -Category::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Category. - */ -int -Category::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Category. - */ -int -Category::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "rank") - { - return_value = setRank(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Category. - */ -int -Category::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Category. - */ -int -Category::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "rank") - { - value = unsetRank(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this Category. - */ -SBase* -Category::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "probability") - { - return createProbability(); - } - else if (elementName == "value") - { - return createValue(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this Category. - */ -int -Category::addChildObject(const std::string& elementName, const SBase* element) -{ - if (elementName == "probability" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setProbability((const UncertValue*)(element)); - } - else if (elementName == "value" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setValue((const UncertValue*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Category. - */ -SBase* -Category::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "probability") - { - UncertValue * obj = mProbability; - mProbability = NULL; return obj; - } - else if (elementName == "value") - { - UncertValue * obj = mValue; - mValue = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this Category. - */ -unsigned int -Category::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "probability") - { - if (isSetProbability()) - { - return 1; - } - } - else if (elementName == "value") - { - if (isSetValue()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this Category. - */ -SBase* -Category::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "probability") - { - return getProbability(); - } - else if (elementName == "value") - { - return getValue(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -Category::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mProbability != NULL) - { - if (mProbability->getId() == id) - { - return mProbability; - } - - obj = mProbability->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mValue != NULL) - { - if (mValue->getId() == id) - { - return mValue; - } - - obj = mValue->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -Category::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mProbability != NULL) - { - if (mProbability->getMetaId() == metaid) - { - return mProbability; - } - - obj = mProbability->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mValue != NULL) - { - if (mValue->getMetaId() == metaid) - { - return mValue; - } - - obj = mValue->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -Category::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mProbability, filter); - ADD_FILTERED_POINTER(ret, sublist, mValue, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -Category::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - - if (name == "probability") - { - if (getErrorLog() && isSetProbability()) - { - getErrorLog()->logPackageError("distrib", DistribCategoryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mProbability; - mProbability = new UncertValue(distribns); - mProbability->setElementName(name); - obj = mProbability; - } - else if (name == "value") - { - if (getErrorLog() && isSetValue()) - { - getErrorLog()->logPackageError("distrib", DistribCategoryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mValue; - mValue = new UncertValue(distribns); - mValue->setElementName(name); - obj = mValue; - } - - delete distribns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Category::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("rank"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Category::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribCategoricalDistributionLOCategoriesAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribCategoricalDistributionLOCategoriesAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", DistribCategoryAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", DistribCategoryAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // rank uint (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetRank = attributes.readInto("rank", mRank); - - if ( mIsSetRank == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Distrib attribute 'rank' from the " - "element must be an integer."; - log->logPackageError("distrib", - DistribCategoryRankMustBeNonNegativeInteger, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Category::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetRank() == true) - { - stream.writeAttribute("rank", getPrefix(), mRank); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Category_t using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -Category_t * -Category_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new Category(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Category_t object. - */ -LIBSBML_EXTERN -Category_t* -Category_clone(const Category_t* c) -{ - if (c != NULL) - { - return static_cast(c->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Category_t object. - */ -LIBSBML_EXTERN -void -Category_free(Category_t* c) -{ - if (c != NULL) - { - delete c; - } -} - - -/* - * Returns the value of the "rank" attribute of this Category_t. - */ -LIBSBML_EXTERN -unsigned int -Category_getRank(const Category_t * c) -{ - return (c != NULL) ? c->getRank() : SBML_INT_MAX; -} - - -/* - * Predicate returning @c 1 (true) if this Category_t's "rank" attribute is - * set. - */ -LIBSBML_EXTERN -int -Category_isSetRank(const Category_t * c) -{ - return (c != NULL) ? static_cast(c->isSetRank()) : 0; -} - - -/* - * Sets the value of the "rank" attribute of this Category_t. - */ -LIBSBML_EXTERN -int -Category_setRank(Category_t * c, unsigned int rank) -{ - return (c != NULL) ? c->setRank(rank) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "rank" attribute of this Category_t. - */ -LIBSBML_EXTERN -int -Category_unsetRank(Category_t * c) -{ - return (c != NULL) ? c->unsetRank() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "probability" element of this Category_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -Category_getProbability(const Category_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return (UncertValue_t*)(c->getProbability()); -} - - -/* - * Returns the value of the "value" element of this Category_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -Category_getValue(const Category_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return (UncertValue_t*)(c->getValue()); -} - - -/* - * Predicate returning @c 1 (true) if this Category_t's "probability" element - * is set. - */ -LIBSBML_EXTERN -int -Category_isSetProbability(const Category_t * c) -{ - return (c != NULL) ? static_cast(c->isSetProbability()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Category_t's "value" element is set. - */ -LIBSBML_EXTERN -int -Category_isSetValue(const Category_t * c) -{ - return (c != NULL) ? static_cast(c->isSetValue()) : 0; -} - - -/* - * Sets the value of the "probability" element of this Category_t. - */ -LIBSBML_EXTERN -int -Category_setProbability(Category_t * c, const UncertValue_t* probability) -{ - return (c != NULL) ? c->setProbability(probability) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "value" element of this Category_t. - */ -LIBSBML_EXTERN -int -Category_setValue(Category_t * c, const UncertValue_t* value) -{ - return (c != NULL) ? c->setValue(value) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new UncertValue_t object, adds it to this Category_t object and - * returns the UncertValue_t object created. - */ -LIBSBML_EXTERN -UncertValue_t* -Category_createProbability(Category_t* c) -{ - if (c == NULL) - { - return NULL; - } - - return (UncertValue_t*)(c->createProbability()); -} - - -/* - * Creates a new UncertValue_t object, adds it to this Category_t object and - * returns the UncertValue_t object created. - */ -LIBSBML_EXTERN -UncertValue_t* -Category_createValue(Category_t* c) -{ - if (c == NULL) - { - return NULL; - } - - return (UncertValue_t*)(c->createValue()); -} - - -/* - * Unsets the value of the "probability" element of this Category_t. - */ -LIBSBML_EXTERN -int -Category_unsetProbability(Category_t * c) -{ - return (c != NULL) ? c->unsetProbability() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "value" element of this Category_t. - */ -LIBSBML_EXTERN -int -Category_unsetValue(Category_t * c) -{ - return (c != NULL) ? c->unsetValue() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Category_t object have been set. - */ -LIBSBML_EXTERN -int -Category_hasRequiredAttributes(const Category_t * c) -{ - return (c != NULL) ? static_cast(c->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * Category_t object have been set. - */ -LIBSBML_EXTERN -int -Category_hasRequiredElements(const Category_t * c) -{ - return (c != NULL) ? static_cast(c->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Category.cpp + * @brief Implementation of the Category class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Category using the given SBML Level, Version and + * “distrib” package version. + */ +Category::Category(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mRank (SBML_INT_MAX) + , mIsSetRank (false) + , mProbability (NULL) + , mValue (NULL) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new Category using the given DistribPkgNamespaces object. + */ +Category::Category(DistribPkgNamespaces *distribns) + : SBase(distribns) + , mRank (SBML_INT_MAX) + , mIsSetRank (false) + , mProbability (NULL) + , mValue (NULL) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for Category. + */ +Category::Category(const Category& orig) + : SBase( orig ) + , mRank ( orig.mRank ) + , mIsSetRank ( orig.mIsSetRank ) + , mProbability ( NULL ) + , mValue ( NULL ) +{ + if (orig.mProbability != NULL) + { + mProbability = orig.mProbability->clone(); + } + + if (orig.mValue != NULL) + { + mValue = orig.mValue->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for Category. + */ +Category& +Category::operator=(const Category& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mRank = rhs.mRank; + mIsSetRank = rhs.mIsSetRank; + delete mProbability; + if (rhs.mProbability != NULL) + { + mProbability = rhs.mProbability->clone(); + } + else + { + mProbability = NULL; + } + + delete mValue; + if (rhs.mValue != NULL) + { + mValue = rhs.mValue->clone(); + } + else + { + mValue = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Category object. + */ +Category* +Category::clone() const +{ + return new Category(*this); +} + + +/* + * Destructor for Category. + */ +Category::~Category() +{ + delete mProbability; + mProbability = NULL; + delete mValue; + mValue = NULL; +} + + +/* + * Returns the value of the "rank" attribute of this Category. + */ +unsigned int +Category::getRank() const +{ + return mRank; +} + + +/* + * Predicate returning @c true if this Category's "rank" attribute is set. + */ +bool +Category::isSetRank() const +{ + return mIsSetRank; +} + + +/* + * Sets the value of the "rank" attribute of this Category. + */ +int +Category::setRank(unsigned int rank) +{ + mRank = rank; + mIsSetRank = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "rank" attribute of this Category. + */ +int +Category::unsetRank() +{ + mRank = SBML_INT_MAX; + mIsSetRank = false; + + if (isSetRank() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "probability" element of this Category. + */ +const UncertValue* +Category::getProbability() const +{ + return mProbability; +} + + +/* + * Returns the value of the "probability" element of this Category. + */ +UncertValue* +Category::getProbability() +{ + return mProbability; +} + + +/* + * Returns the value of the "value" element of this Category. + */ +const UncertValue* +Category::getValue() const +{ + return mValue; +} + + +/* + * Returns the value of the "value" element of this Category. + */ +UncertValue* +Category::getValue() +{ + return mValue; +} + + +/* + * Predicate returning @c true if this Category's "probability" element is set. + */ +bool +Category::isSetProbability() const +{ + return (mProbability != NULL); +} + + +/* + * Predicate returning @c true if this Category's "value" element is set. + */ +bool +Category::isSetValue() const +{ + return (mValue != NULL); +} + + +/* + * Sets the value of the "probability" element of this Category. + */ +int +Category::setProbability(const UncertValue* probability) +{ + if (mProbability == probability) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (probability == NULL) + { + delete mProbability; + mProbability = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mProbability; + mProbability = (probability != NULL) ? probability->clone() : NULL; + if (mProbability != NULL) + { + mProbability->setElementName("probability"); + mProbability->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "value" element of this Category. + */ +int +Category::setValue(const UncertValue* value) +{ + if (mValue == value) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (value == NULL) + { + delete mValue; + mValue = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mValue; + mValue = (value != NULL) ? value->clone() : NULL; + if (mValue != NULL) + { + mValue->setElementName("value"); + mValue->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new UncertValue object, adds it to this Category object and + * returns the UncertValue object created. + */ +UncertValue* +Category::createProbability() +{ + if (mProbability != NULL) + { + delete mProbability; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mProbability = new UncertValue(distribns); + + mProbability->setElementName("probability"); + + delete distribns; + + connectToChild(); + + return mProbability; +} + + +/* + * Creates a new UncertValue object, adds it to this Category object and + * returns the UncertValue object created. + */ +UncertValue* +Category::createValue() +{ + if (mValue != NULL) + { + delete mValue; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mValue = new UncertValue(distribns); + + mValue->setElementName("value"); + + delete distribns; + + connectToChild(); + + return mValue; +} + + +/* + * Unsets the value of the "probability" element of this Category. + */ +int +Category::unsetProbability() +{ + delete mProbability; + mProbability = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "value" element of this Category. + */ +int +Category::unsetValue() +{ + delete mValue; + mValue = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this Category object. + */ +const std::string& +Category::getElementName() const +{ + static const string name = "category"; + return name; +} + + +/* + * Returns the libSBML type code for this Category object. + */ +int +Category::getTypeCode() const +{ + return SBML_DISTRIB_CATEGORY; +} + + +/* + * Predicate returning @c true if all the required attributes for this Category + * object have been set. + */ +bool +Category::hasRequiredAttributes() const +{ + bool allPresent = true; + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this Category + * object have been set. + */ +bool +Category::hasRequiredElements() const +{ + bool allPresent = true; + + if (isSetValue() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Category::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetProbability() == true) + { + mProbability->write(stream); + } + + if (isSetValue() == true) + { + mValue->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Category::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mProbability != NULL) + { + mProbability->accept(v); + } + + if (mValue != NULL) + { + mValue->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Category::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mProbability != NULL) + { + mProbability->setSBMLDocument(d); + } + + if (mValue != NULL) + { + mValue->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Category::connectToChild() +{ + SBase::connectToChild(); + + if (mProbability != NULL) + { + mProbability->connectToParent(this); + } + + if (mValue != NULL) + { + mValue->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Category::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetProbability()) + { + mProbability->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + if (isSetValue()) + { + mValue->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +Category::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mProbability != NULL) + { + mProbability->updateSBMLNamespace(package, level, version); + } + + if (mValue != NULL) + { + mValue->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Category. + */ +int +Category::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Category. + */ +int +Category::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Category. + */ +int +Category::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Category. + */ +int +Category::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "rank") + { + value = getRank(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Category. + */ +int +Category::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Category's attribute "attributeName" is + * set. + */ +bool +Category::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "rank") + { + value = isSetRank(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Category. + */ +int +Category::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Category. + */ +int +Category::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Category. + */ +int +Category::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Category. + */ +int +Category::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "rank") + { + return_value = setRank(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Category. + */ +int +Category::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Category. + */ +int +Category::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "rank") + { + value = unsetRank(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this Category. + */ +SBase* +Category::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "probability") + { + return createProbability(); + } + else if (elementName == "value") + { + return createValue(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this Category. + */ +int +Category::addChildObject(const std::string& elementName, const SBase* element) +{ + if (elementName == "probability" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setProbability((const UncertValue*)(element)); + } + else if (elementName == "value" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setValue((const UncertValue*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * Category. + */ +SBase* +Category::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "probability") + { + UncertValue * obj = mProbability; + mProbability = NULL; return obj; + } + else if (elementName == "value") + { + UncertValue * obj = mValue; + mValue = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this Category. + */ +unsigned int +Category::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "probability") + { + if (isSetProbability()) + { + return 1; + } + } + else if (elementName == "value") + { + if (isSetValue()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this Category. + */ +SBase* +Category::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "probability") + { + return getProbability(); + } + else if (elementName == "value") + { + return getValue(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +Category::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mProbability != NULL) + { + if (mProbability->getId() == id) + { + return mProbability; + } + + obj = mProbability->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mValue != NULL) + { + if (mValue->getId() == id) + { + return mValue; + } + + obj = mValue->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +Category::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mProbability != NULL) + { + if (mProbability->getMetaId() == metaid) + { + return mProbability; + } + + obj = mProbability->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mValue != NULL) + { + if (mValue->getMetaId() == metaid) + { + return mValue; + } + + obj = mValue->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +Category::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mProbability, filter); + ADD_FILTERED_POINTER(ret, sublist, mValue, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +Category::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + + if (name == "probability") + { + if (getErrorLog() && isSetProbability()) + { + getErrorLog()->logPackageError("distrib", DistribCategoryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mProbability; + mProbability = new UncertValue(distribns); + mProbability->setElementName(name); + obj = mProbability; + } + else if (name == "value") + { + if (getErrorLog() && isSetValue()) + { + getErrorLog()->logPackageError("distrib", DistribCategoryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mValue; + mValue = new UncertValue(distribns); + mValue->setElementName(name); + obj = mValue; + } + + delete distribns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Category::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("rank"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Category::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribCategoricalDistributionLOCategoriesAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribCategoricalDistributionLOCategoriesAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", DistribCategoryAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", DistribCategoryAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // rank uint (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetRank = attributes.readInto("rank", mRank); + + if ( mIsSetRank == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Distrib attribute 'rank' from the " + "element must be an integer."; + log->logPackageError("distrib", + DistribCategoryRankMustBeNonNegativeInteger, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Category::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetRank() == true) + { + stream.writeAttribute("rank", getPrefix(), mRank); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Category_t using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +Category_t * +Category_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new Category(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Category_t object. + */ +LIBSBML_EXTERN +Category_t* +Category_clone(const Category_t* c) +{ + if (c != NULL) + { + return static_cast(c->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Category_t object. + */ +LIBSBML_EXTERN +void +Category_free(Category_t* c) +{ + if (c != NULL) + { + delete c; + } +} + + +/* + * Returns the value of the "rank" attribute of this Category_t. + */ +LIBSBML_EXTERN +unsigned int +Category_getRank(const Category_t * c) +{ + return (c != NULL) ? c->getRank() : SBML_INT_MAX; +} + + +/* + * Predicate returning @c 1 (true) if this Category_t's "rank" attribute is + * set. + */ +LIBSBML_EXTERN +int +Category_isSetRank(const Category_t * c) +{ + return (c != NULL) ? static_cast(c->isSetRank()) : 0; +} + + +/* + * Sets the value of the "rank" attribute of this Category_t. + */ +LIBSBML_EXTERN +int +Category_setRank(Category_t * c, unsigned int rank) +{ + return (c != NULL) ? c->setRank(rank) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "rank" attribute of this Category_t. + */ +LIBSBML_EXTERN +int +Category_unsetRank(Category_t * c) +{ + return (c != NULL) ? c->unsetRank() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "probability" element of this Category_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +Category_getProbability(const Category_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return (UncertValue_t*)(c->getProbability()); +} + + +/* + * Returns the value of the "value" element of this Category_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +Category_getValue(const Category_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return (UncertValue_t*)(c->getValue()); +} + + +/* + * Predicate returning @c 1 (true) if this Category_t's "probability" element + * is set. + */ +LIBSBML_EXTERN +int +Category_isSetProbability(const Category_t * c) +{ + return (c != NULL) ? static_cast(c->isSetProbability()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Category_t's "value" element is set. + */ +LIBSBML_EXTERN +int +Category_isSetValue(const Category_t * c) +{ + return (c != NULL) ? static_cast(c->isSetValue()) : 0; +} + + +/* + * Sets the value of the "probability" element of this Category_t. + */ +LIBSBML_EXTERN +int +Category_setProbability(Category_t * c, const UncertValue_t* probability) +{ + return (c != NULL) ? c->setProbability(probability) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "value" element of this Category_t. + */ +LIBSBML_EXTERN +int +Category_setValue(Category_t * c, const UncertValue_t* value) +{ + return (c != NULL) ? c->setValue(value) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new UncertValue_t object, adds it to this Category_t object and + * returns the UncertValue_t object created. + */ +LIBSBML_EXTERN +UncertValue_t* +Category_createProbability(Category_t* c) +{ + if (c == NULL) + { + return NULL; + } + + return (UncertValue_t*)(c->createProbability()); +} + + +/* + * Creates a new UncertValue_t object, adds it to this Category_t object and + * returns the UncertValue_t object created. + */ +LIBSBML_EXTERN +UncertValue_t* +Category_createValue(Category_t* c) +{ + if (c == NULL) + { + return NULL; + } + + return (UncertValue_t*)(c->createValue()); +} + + +/* + * Unsets the value of the "probability" element of this Category_t. + */ +LIBSBML_EXTERN +int +Category_unsetProbability(Category_t * c) +{ + return (c != NULL) ? c->unsetProbability() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "value" element of this Category_t. + */ +LIBSBML_EXTERN +int +Category_unsetValue(Category_t * c) +{ + return (c != NULL) ? c->unsetValue() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Category_t object have been set. + */ +LIBSBML_EXTERN +int +Category_hasRequiredAttributes(const Category_t * c) +{ + return (c != NULL) ? static_cast(c->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * Category_t object have been set. + */ +LIBSBML_EXTERN +int +Category_hasRequiredElements(const Category_t * c) +{ + return (c != NULL) ? static_cast(c->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Category.h b/generator/tests/test_cpp_code/test-code/Category.h index 2ea26013..3171c172 100644 --- a/generator/tests/test_cpp_code/test-code/Category.h +++ b/generator/tests/test_cpp_code/test-code/Category.h @@ -1,1204 +1,1204 @@ -/** - * @file Category.h - * @brief Definition of the Category class. - * @author SBMLTeam - * - * - * - * @class Category - * @sbmlbrief{distrib} TODO:Definition of the Category class. - */ - - -#ifndef Category_H__ -#define Category_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Category : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - unsigned int mRank; - bool mIsSetRank; - UncertValue* mProbability; - UncertValue* mValue; - - /** @endcond */ - -public: - - /** - * Creates a new Category using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Category. - * - * @param version an unsigned int, the SBML Version to assign to this - * Category. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Category. - * - * @copydetails doc_note_setting_lv_pkg - */ - Category(unsigned int level = DistribExtension::getDefaultLevel(), - unsigned int version = DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Category using the given DistribPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Category(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for Category. - * - * @param orig the Category instance to copy. - */ - Category(const Category& orig); - - - /** - * Assignment operator for Category. - * - * @param rhs the Category object whose values are to be used as the basis of - * the assignment. - */ - Category& operator=(const Category& rhs); - - - /** - * Creates and returns a deep copy of this Category object. - * - * @return a (deep) copy of this Category object. - */ - virtual Category* clone() const; - - - /** - * Destructor for Category. - */ - virtual ~Category(); - - - /** - * Returns the value of the "rank" attribute of this Category. - * - * @return the value of the "rank" attribute of this Category as a unsigned - * integer. - */ - unsigned int getRank() const; - - - /** - * Predicate returning @c true if this Category's "rank" attribute is set. - * - * @return @c true if this Category's "rank" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetRank() const; - - - /** - * Sets the value of the "rank" attribute of this Category. - * - * @param rank unsigned int value of the "rank" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setRank(unsigned int rank); - - - /** - * Unsets the value of the "rank" attribute of this Category. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetRank(); - - - /** - * Returns the value of the "probability" element of this Category. - * - * @return the value of the "probability" element of this Category as a - * UncertValue*. - */ - const UncertValue* getProbability() const; - - - /** - * Returns the value of the "probability" element of this Category. - * - * @return the value of the "probability" element of this Category as a - * UncertValue*. - */ - UncertValue* getProbability(); - - - /** - * Returns the value of the "value" element of this Category. - * - * @return the value of the "value" element of this Category as a - * UncertValue*. - */ - const UncertValue* getValue() const; - - - /** - * Returns the value of the "value" element of this Category. - * - * @return the value of the "value" element of this Category as a - * UncertValue*. - */ - UncertValue* getValue(); - - - /** - * Predicate returning @c true if this Category's "probability" element is - * set. - * - * @return @c true if this Category's "probability" element has been set, - * otherwise @c false is returned. - */ - bool isSetProbability() const; - - - /** - * Predicate returning @c true if this Category's "value" element is set. - * - * @return @c true if this Category's "value" element has been set, otherwise - * @c false is returned. - */ - bool isSetValue() const; - - - /** - * Sets the value of the "probability" element of this Category. - * - * @param probability UncertValue* value of the "probability" element to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setProbability(const UncertValue* probability); - - - /** - * Sets the value of the "value" element of this Category. - * - * @param value UncertValue* value of the "value" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setValue(const UncertValue* value); - - - /** - * Creates a new UncertValue object, adds it to this Category object and - * returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createProbability(); - - - /** - * Creates a new UncertValue object, adds it to this Category object and - * returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createValue(); - - - /** - * Unsets the value of the "probability" element of this Category. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetProbability(); - - - /** - * Unsets the value of the "value" element of this Category. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetValue(); - - - /** - * Returns the XML element name of this Category object. - * - * For Category, the XML element name is always @c "category". - * - * @return the name of this element, i.e. @c "category". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Category object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_CATEGORY, SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * Category object have been set. - * - * @return @c true to indicate that all the required attributes of this - * Category have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this Category - * object have been set. - * - * @return @c true to indicate that all the required elements of this - * Category have been set, otherwise @c false is returned. - * - * - * @note The required elements for the Category object are: - * @li "value" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Category's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Category's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Category. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this Category. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this Category. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * Category. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this Category. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this Category. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Category_t using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Category_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Category_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Category_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Category_t - */ -LIBSBML_EXTERN -Category_t * -Category_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Category_t object. - * - * @param c the Category_t structure. - * - * @return a (deep) copy of this Category_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Category_t - */ -LIBSBML_EXTERN -Category_t* -Category_clone(const Category_t* c); - - -/** - * Frees this Category_t object. - * - * @param c the Category_t structure. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -void -Category_free(Category_t* c); - - -/** - * Returns the value of the "rank" attribute of this Category_t. - * - * @param c the Category_t structure whose rank is sought. - * - * @return the value of the "rank" attribute of this Category_t as a unsigned - * integer. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -unsigned int -Category_getRank(const Category_t * c); - - -/** - * Predicate returning @c 1 (true) if this Category_t's "rank" attribute is - * set. - * - * @param c the Category_t structure. - * - * @return @c 1 (true) if this Category_t's "rank" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_isSetRank(const Category_t * c); - - -/** - * Sets the value of the "rank" attribute of this Category_t. - * - * @param c the Category_t structure. - * - * @param rank unsigned int value of the "rank" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_setRank(Category_t * c, unsigned int rank); - - -/** - * Unsets the value of the "rank" attribute of this Category_t. - * - * @param c the Category_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_unsetRank(Category_t * c); - - -/** - * Returns the value of the "probability" element of this Category_t. - * - * @param c the Category_t structure whose probability is sought. - * - * @return the value of the "probability" element of this Category_t as a - * UncertValue*. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -const UncertValue_t* -Category_getProbability(const Category_t * c); - - -/** - * Returns the value of the "value" element of this Category_t. - * - * @param c the Category_t structure whose value is sought. - * - * @return the value of the "value" element of this Category_t as a - * UncertValue*. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -const UncertValue_t* -Category_getValue(const Category_t * c); - - -/** - * Predicate returning @c 1 (true) if this Category_t's "probability" element - * is set. - * - * @param c the Category_t structure. - * - * @return @c 1 (true) if this Category_t's "probability" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_isSetProbability(const Category_t * c); - - -/** - * Predicate returning @c 1 (true) if this Category_t's "value" element is set. - * - * @param c the Category_t structure. - * - * @return @c 1 (true) if this Category_t's "value" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_isSetValue(const Category_t * c); - - -/** - * Sets the value of the "probability" element of this Category_t. - * - * @param c the Category_t structure. - * - * @param probability UncertValue_t* value of the "probability" element to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_setProbability(Category_t * c, const UncertValue_t* probability); - - -/** - * Sets the value of the "value" element of this Category_t. - * - * @param c the Category_t structure. - * - * @param value UncertValue_t* value of the "value" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_setValue(Category_t * c, const UncertValue_t* value); - - -/** - * Creates a new UncertValue_t object, adds it to this Category_t object and - * returns the UncertValue_t object created. - * - * @param c the Category_t structure to which the UncertValue_t should be - * added. - * - * @return a new UncertValue_t object instance. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -UncertValue_t* -Category_createProbability(Category_t* c); - - -/** - * Creates a new UncertValue_t object, adds it to this Category_t object and - * returns the UncertValue_t object created. - * - * @param c the Category_t structure to which the UncertValue_t should be - * added. - * - * @return a new UncertValue_t object instance. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -UncertValue_t* -Category_createValue(Category_t* c); - - -/** - * Unsets the value of the "probability" element of this Category_t. - * - * @param c the Category_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_unsetProbability(Category_t * c); - - -/** - * Unsets the value of the "value" element of this Category_t. - * - * @param c the Category_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_unsetValue(Category_t * c); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Category_t object have been set. - * - * @param c the Category_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Category_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_hasRequiredAttributes(const Category_t * c); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * Category_t object have been set. - * - * @param c the Category_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * Category_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the Category_t object are: - * @li "value" - * - * @memberof Category_t - */ -LIBSBML_EXTERN -int -Category_hasRequiredElements(const Category_t * c); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Category_H__ */ - - +/** + * @file Category.h + * @brief Definition of the Category class. + * @author SBMLTeam + * + * + * + * @class Category + * @sbmlbrief{distrib} TODO:Definition of the Category class. + */ + + +#ifndef Category_H__ +#define Category_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Category : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + unsigned int mRank; + bool mIsSetRank; + UncertValue* mProbability; + UncertValue* mValue; + + /** @endcond */ + +public: + + /** + * Creates a new Category using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Category. + * + * @param version an unsigned int, the SBML Version to assign to this + * Category. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Category. + * + * @copydetails doc_note_setting_lv_pkg + */ + Category(unsigned int level = DistribExtension::getDefaultLevel(), + unsigned int version = DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Category using the given DistribPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Category(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for Category. + * + * @param orig the Category instance to copy. + */ + Category(const Category& orig); + + + /** + * Assignment operator for Category. + * + * @param rhs the Category object whose values are to be used as the basis of + * the assignment. + */ + Category& operator=(const Category& rhs); + + + /** + * Creates and returns a deep copy of this Category object. + * + * @return a (deep) copy of this Category object. + */ + virtual Category* clone() const; + + + /** + * Destructor for Category. + */ + virtual ~Category(); + + + /** + * Returns the value of the "rank" attribute of this Category. + * + * @return the value of the "rank" attribute of this Category as a unsigned + * integer. + */ + unsigned int getRank() const; + + + /** + * Predicate returning @c true if this Category's "rank" attribute is set. + * + * @return @c true if this Category's "rank" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetRank() const; + + + /** + * Sets the value of the "rank" attribute of this Category. + * + * @param rank unsigned int value of the "rank" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setRank(unsigned int rank); + + + /** + * Unsets the value of the "rank" attribute of this Category. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetRank(); + + + /** + * Returns the value of the "probability" element of this Category. + * + * @return the value of the "probability" element of this Category as a + * UncertValue*. + */ + const UncertValue* getProbability() const; + + + /** + * Returns the value of the "probability" element of this Category. + * + * @return the value of the "probability" element of this Category as a + * UncertValue*. + */ + UncertValue* getProbability(); + + + /** + * Returns the value of the "value" element of this Category. + * + * @return the value of the "value" element of this Category as a + * UncertValue*. + */ + const UncertValue* getValue() const; + + + /** + * Returns the value of the "value" element of this Category. + * + * @return the value of the "value" element of this Category as a + * UncertValue*. + */ + UncertValue* getValue(); + + + /** + * Predicate returning @c true if this Category's "probability" element is + * set. + * + * @return @c true if this Category's "probability" element has been set, + * otherwise @c false is returned. + */ + bool isSetProbability() const; + + + /** + * Predicate returning @c true if this Category's "value" element is set. + * + * @return @c true if this Category's "value" element has been set, otherwise + * @c false is returned. + */ + bool isSetValue() const; + + + /** + * Sets the value of the "probability" element of this Category. + * + * @param probability UncertValue* value of the "probability" element to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setProbability(const UncertValue* probability); + + + /** + * Sets the value of the "value" element of this Category. + * + * @param value UncertValue* value of the "value" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setValue(const UncertValue* value); + + + /** + * Creates a new UncertValue object, adds it to this Category object and + * returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createProbability(); + + + /** + * Creates a new UncertValue object, adds it to this Category object and + * returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createValue(); + + + /** + * Unsets the value of the "probability" element of this Category. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetProbability(); + + + /** + * Unsets the value of the "value" element of this Category. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetValue(); + + + /** + * Returns the XML element name of this Category object. + * + * For Category, the XML element name is always @c "category". + * + * @return the name of this element, i.e. @c "category". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Category object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_CATEGORY, SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * Category object have been set. + * + * @return @c true to indicate that all the required attributes of this + * Category have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this Category + * object have been set. + * + * @return @c true to indicate that all the required elements of this + * Category have been set, otherwise @c false is returned. + * + * + * @note The required elements for the Category object are: + * @li "value" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Category's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Category's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Category. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this Category. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this Category. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * Category. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this Category. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this Category. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Category_t using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Category_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Category_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Category_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Category_t + */ +LIBSBML_EXTERN +Category_t * +Category_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Category_t object. + * + * @param c the Category_t structure. + * + * @return a (deep) copy of this Category_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Category_t + */ +LIBSBML_EXTERN +Category_t* +Category_clone(const Category_t* c); + + +/** + * Frees this Category_t object. + * + * @param c the Category_t structure. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +void +Category_free(Category_t* c); + + +/** + * Returns the value of the "rank" attribute of this Category_t. + * + * @param c the Category_t structure whose rank is sought. + * + * @return the value of the "rank" attribute of this Category_t as a unsigned + * integer. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +unsigned int +Category_getRank(const Category_t * c); + + +/** + * Predicate returning @c 1 (true) if this Category_t's "rank" attribute is + * set. + * + * @param c the Category_t structure. + * + * @return @c 1 (true) if this Category_t's "rank" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_isSetRank(const Category_t * c); + + +/** + * Sets the value of the "rank" attribute of this Category_t. + * + * @param c the Category_t structure. + * + * @param rank unsigned int value of the "rank" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_setRank(Category_t * c, unsigned int rank); + + +/** + * Unsets the value of the "rank" attribute of this Category_t. + * + * @param c the Category_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_unsetRank(Category_t * c); + + +/** + * Returns the value of the "probability" element of this Category_t. + * + * @param c the Category_t structure whose probability is sought. + * + * @return the value of the "probability" element of this Category_t as a + * UncertValue*. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +const UncertValue_t* +Category_getProbability(const Category_t * c); + + +/** + * Returns the value of the "value" element of this Category_t. + * + * @param c the Category_t structure whose value is sought. + * + * @return the value of the "value" element of this Category_t as a + * UncertValue*. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +const UncertValue_t* +Category_getValue(const Category_t * c); + + +/** + * Predicate returning @c 1 (true) if this Category_t's "probability" element + * is set. + * + * @param c the Category_t structure. + * + * @return @c 1 (true) if this Category_t's "probability" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_isSetProbability(const Category_t * c); + + +/** + * Predicate returning @c 1 (true) if this Category_t's "value" element is set. + * + * @param c the Category_t structure. + * + * @return @c 1 (true) if this Category_t's "value" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_isSetValue(const Category_t * c); + + +/** + * Sets the value of the "probability" element of this Category_t. + * + * @param c the Category_t structure. + * + * @param probability UncertValue_t* value of the "probability" element to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_setProbability(Category_t * c, const UncertValue_t* probability); + + +/** + * Sets the value of the "value" element of this Category_t. + * + * @param c the Category_t structure. + * + * @param value UncertValue_t* value of the "value" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_setValue(Category_t * c, const UncertValue_t* value); + + +/** + * Creates a new UncertValue_t object, adds it to this Category_t object and + * returns the UncertValue_t object created. + * + * @param c the Category_t structure to which the UncertValue_t should be + * added. + * + * @return a new UncertValue_t object instance. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +UncertValue_t* +Category_createProbability(Category_t* c); + + +/** + * Creates a new UncertValue_t object, adds it to this Category_t object and + * returns the UncertValue_t object created. + * + * @param c the Category_t structure to which the UncertValue_t should be + * added. + * + * @return a new UncertValue_t object instance. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +UncertValue_t* +Category_createValue(Category_t* c); + + +/** + * Unsets the value of the "probability" element of this Category_t. + * + * @param c the Category_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_unsetProbability(Category_t * c); + + +/** + * Unsets the value of the "value" element of this Category_t. + * + * @param c the Category_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_unsetValue(Category_t * c); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Category_t object have been set. + * + * @param c the Category_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Category_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_hasRequiredAttributes(const Category_t * c); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * Category_t object have been set. + * + * @param c the Category_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * Category_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the Category_t object are: + * @li "value" + * + * @memberof Category_t + */ +LIBSBML_EXTERN +int +Category_hasRequiredElements(const Category_t * c); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Category_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Child.cpp b/generator/tests/test_cpp_code/test-code/Child.cpp index 83cd6c58..09a3077c 100644 --- a/generator/tests/test_cpp_code/test-code/Child.cpp +++ b/generator/tests/test_cpp_code/test-code/Child.cpp @@ -1,468 +1,468 @@ -/** - * @file Child.cpp - * @brief Implementation of the Child class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Child using the given SBML Level, Version and - * “nasty” package version. - */ -Child::Child(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) -{ - setSBMLNamespacesAndOwn(new NastyPkgNamespaces(level, version, pkgVersion)); -} - - -/* - * Creates a new Child using the given NastyPkgNamespaces object. - */ -Child::Child(NastyPkgNamespaces *nastyns) - : SBase(nastyns) -{ - setElementNamespace(nastyns->getURI()); - loadPlugins(nastyns); -} - - -/* - * Copy constructor for Child. - */ -Child::Child(const Child& orig) - : SBase( orig ) -{ -} - - -/* - * Assignment operator for Child. - */ -Child& -Child::operator=(const Child& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Child object. - */ -Child* -Child::clone() const -{ - return new Child(*this); -} - - -/* - * Destructor for Child. - */ -Child::~Child() -{ -} - - -/* - * Returns the XML element name of this Child object. - */ -const std::string& -Child::getElementName() const -{ - static const string name = "child"; - return name; -} - - -/* - * Returns the libSBML type code for this Child object. - */ -int -Child::getTypeCode() const -{ - return SBML_NASTY_CHILD; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Child::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Child::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Child::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Child::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Child. - */ -int -Child::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Child. - */ -int -Child::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Child. - */ -int -Child::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Child. - */ -int -Child::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Child. - */ -int -Child::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Child's attribute "attributeName" is - * set. - */ -bool -Child::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Child. - */ -int -Child::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Child. - */ -int -Child::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Child. - */ -int -Child::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Child. - */ -int -Child::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Child. - */ -int -Child::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Child. - */ -int -Child::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Child_t using the given SBML Level, Version and - * “nasty” package version. - */ -LIBSBML_EXTERN -Child_t * -Child_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new Child(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Child_t object. - */ -LIBSBML_EXTERN -Child_t* -Child_clone(const Child_t* c) -{ - if (c != NULL) - { - return static_cast(c->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Child_t object. - */ -LIBSBML_EXTERN -void -Child_free(Child_t* c) -{ - if (c != NULL) - { - delete c; - } -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Child.cpp + * @brief Implementation of the Child class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Child using the given SBML Level, Version and + * “nasty” package version. + */ +Child::Child(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) +{ + setSBMLNamespacesAndOwn(new NastyPkgNamespaces(level, version, pkgVersion)); +} + + +/* + * Creates a new Child using the given NastyPkgNamespaces object. + */ +Child::Child(NastyPkgNamespaces *nastyns) + : SBase(nastyns) +{ + setElementNamespace(nastyns->getURI()); + loadPlugins(nastyns); +} + + +/* + * Copy constructor for Child. + */ +Child::Child(const Child& orig) + : SBase( orig ) +{ +} + + +/* + * Assignment operator for Child. + */ +Child& +Child::operator=(const Child& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Child object. + */ +Child* +Child::clone() const +{ + return new Child(*this); +} + + +/* + * Destructor for Child. + */ +Child::~Child() +{ +} + + +/* + * Returns the XML element name of this Child object. + */ +const std::string& +Child::getElementName() const +{ + static const string name = "child"; + return name; +} + + +/* + * Returns the libSBML type code for this Child object. + */ +int +Child::getTypeCode() const +{ + return SBML_NASTY_CHILD; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Child::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Child::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Child::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Child::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Child. + */ +int +Child::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Child. + */ +int +Child::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Child. + */ +int +Child::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Child. + */ +int +Child::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Child. + */ +int +Child::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Child's attribute "attributeName" is + * set. + */ +bool +Child::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Child. + */ +int +Child::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Child. + */ +int +Child::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Child. + */ +int +Child::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Child. + */ +int +Child::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Child. + */ +int +Child::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Child. + */ +int +Child::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Child_t using the given SBML Level, Version and + * “nasty” package version. + */ +LIBSBML_EXTERN +Child_t * +Child_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new Child(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Child_t object. + */ +LIBSBML_EXTERN +Child_t* +Child_clone(const Child_t* c) +{ + if (c != NULL) + { + return static_cast(c->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Child_t object. + */ +LIBSBML_EXTERN +void +Child_free(Child_t* c) +{ + if (c != NULL) + { + delete c; + } +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Child.h b/generator/tests/test_cpp_code/test-code/Child.h index 2e35e058..9e94d22f 100644 --- a/generator/tests/test_cpp_code/test-code/Child.h +++ b/generator/tests/test_cpp_code/test-code/Child.h @@ -1,542 +1,542 @@ -/** - * @file Child.h - * @brief Definition of the Child class. - * @author SBMLTeam - * - * - * - * @class Child - * @sbmlbrief{nasty} TODO:Definition of the Child class. - */ - - -#ifndef Child_H__ -#define Child_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Child : public SBase -{ - -public: - - /** - * Creates a new Child using the given SBML Level, Version and - * “nasty” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Child. - * - * @param version an unsigned int, the SBML Version to assign to this Child. - * - * @param pkgVersion an unsigned int, the SBML Nasty Version to assign to - * this Child. - * - * @copydetails doc_note_setting_lv_pkg - */ - Child(unsigned int level = NastyExtension::getDefaultLevel(), - unsigned int version = NastyExtension::getDefaultVersion(), - unsigned int pkgVersion = NastyExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Child using the given NastyPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param nastyns the NastyPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Child(NastyPkgNamespaces *nastyns); - - - /** - * Copy constructor for Child. - * - * @param orig the Child instance to copy. - */ - Child(const Child& orig); - - - /** - * Assignment operator for Child. - * - * @param rhs the Child object whose values are to be used as the basis of - * the assignment. - */ - Child& operator=(const Child& rhs); - - - /** - * Creates and returns a deep copy of this Child object. - * - * @return a (deep) copy of this Child object. - */ - virtual Child* clone() const; - - - /** - * Destructor for Child. - */ - virtual ~Child(); - - - /** - * Returns the XML element name of this Child object. - * - * For Child, the XML element name is always @c "child". - * - * @return the name of this element, i.e. @c "child". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Child object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_NASTY_CHILD, SBMLNastyTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Child's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Child's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Child. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Child_t using the given SBML Level, Version and - * “nasty” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Child_t. - * - * @param version an unsigned int, the SBML Version to assign to this Child_t. - * - * @param pkgVersion an unsigned int, the SBML Nasty Version to assign to this - * Child_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Child_t - */ -LIBSBML_EXTERN -Child_t * -Child_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Child_t object. - * - * @param c the Child_t structure. - * - * @return a (deep) copy of this Child_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Child_t - */ -LIBSBML_EXTERN -Child_t* -Child_clone(const Child_t* c); - - -/** - * Frees this Child_t object. - * - * @param c the Child_t structure. - * - * @memberof Child_t - */ -LIBSBML_EXTERN -void -Child_free(Child_t* c); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Child_H__ */ - - +/** + * @file Child.h + * @brief Definition of the Child class. + * @author SBMLTeam + * + * + * + * @class Child + * @sbmlbrief{nasty} TODO:Definition of the Child class. + */ + + +#ifndef Child_H__ +#define Child_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Child : public SBase +{ + +public: + + /** + * Creates a new Child using the given SBML Level, Version and + * “nasty” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Child. + * + * @param version an unsigned int, the SBML Version to assign to this Child. + * + * @param pkgVersion an unsigned int, the SBML Nasty Version to assign to + * this Child. + * + * @copydetails doc_note_setting_lv_pkg + */ + Child(unsigned int level = NastyExtension::getDefaultLevel(), + unsigned int version = NastyExtension::getDefaultVersion(), + unsigned int pkgVersion = NastyExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Child using the given NastyPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param nastyns the NastyPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Child(NastyPkgNamespaces *nastyns); + + + /** + * Copy constructor for Child. + * + * @param orig the Child instance to copy. + */ + Child(const Child& orig); + + + /** + * Assignment operator for Child. + * + * @param rhs the Child object whose values are to be used as the basis of + * the assignment. + */ + Child& operator=(const Child& rhs); + + + /** + * Creates and returns a deep copy of this Child object. + * + * @return a (deep) copy of this Child object. + */ + virtual Child* clone() const; + + + /** + * Destructor for Child. + */ + virtual ~Child(); + + + /** + * Returns the XML element name of this Child object. + * + * For Child, the XML element name is always @c "child". + * + * @return the name of this element, i.e. @c "child". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Child object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_NASTY_CHILD, SBMLNastyTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Child's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Child's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Child. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Child_t using the given SBML Level, Version and + * “nasty” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Child_t. + * + * @param version an unsigned int, the SBML Version to assign to this Child_t. + * + * @param pkgVersion an unsigned int, the SBML Nasty Version to assign to this + * Child_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Child_t + */ +LIBSBML_EXTERN +Child_t * +Child_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Child_t object. + * + * @param c the Child_t structure. + * + * @return a (deep) copy of this Child_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Child_t + */ +LIBSBML_EXTERN +Child_t* +Child_clone(const Child_t* c); + + +/** + * Frees this Child_t object. + * + * @param c the Child_t structure. + * + * @memberof Child_t + */ +LIBSBML_EXTERN +void +Child_free(Child_t* c); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Child_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ClassOne.cpp b/generator/tests/test_cpp_code/test-code/ClassOne.cpp index 17811ff2..44a81359 100644 --- a/generator/tests/test_cpp_code/test-code/ClassOne.cpp +++ b/generator/tests/test_cpp_code/test-code/ClassOne.cpp @@ -1,1200 +1,1200 @@ -/** - * @file ClassOne.cpp - * @brief Implementation of the ClassOne class. - * @author SBMLTeam - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ClassOne using the given SBML Level, Version and - * “vers” package version. - */ -ClassOne::ClassOne(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mAtt1 (false) - , mIsSetAtt1 (false) - , mAtt2 (false) - , mIsSetAtt2 (false) -{ - setSBMLNamespacesAndOwn(new VersPkgNamespaces(level, version, pkgVersion)); -} - - -/* - * Creates a new ClassOne using the given VersPkgNamespaces object. - */ -ClassOne::ClassOne(VersPkgNamespaces *versns) - : SBase(versns) - , mAtt1 (false) - , mIsSetAtt1 (false) - , mAtt2 (false) - , mIsSetAtt2 (false) -{ - setElementNamespace(versns->getURI()); - loadPlugins(versns); -} - - -/* - * Copy constructor for ClassOne. - */ -ClassOne::ClassOne(const ClassOne& orig) - : SBase( orig ) - , mAtt1 ( orig.mAtt1 ) - , mIsSetAtt1 ( orig.mIsSetAtt1 ) - , mAtt2 ( orig.mAtt2 ) - , mIsSetAtt2 ( orig.mIsSetAtt2 ) -{ -} - - -/* - * Assignment operator for ClassOne. - */ -ClassOne& -ClassOne::operator=(const ClassOne& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mAtt1 = rhs.mAtt1; - mIsSetAtt1 = rhs.mIsSetAtt1; - mAtt2 = rhs.mAtt2; - mIsSetAtt2 = rhs.mIsSetAtt2; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ClassOne object. - */ -ClassOne* -ClassOne::clone() const -{ - return new ClassOne(*this); -} - - -/* - * Destructor for ClassOne. - */ -ClassOne::~ClassOne() -{ -} - - -/* - * Returns the value of the "id" attribute of this ClassOne. - */ -const std::string& -ClassOne::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "att1" attribute of this ClassOne. - */ -bool -ClassOne::getAtt1() const -{ - return mAtt1; -} - - -/* - * Returns the value of the "att2" attribute of this ClassOne. - */ -bool -ClassOne::getAtt2() const -{ - return mAtt2; -} - - -/* - * Predicate returning @c true if this ClassOne's "id" attribute is set. - */ -bool -ClassOne::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this ClassOne's "att1" attribute is set. - */ -bool -ClassOne::isSetAtt1() const -{ - return mIsSetAtt1; -} - - -/* - * Predicate returning @c true if this ClassOne's "att2" attribute is set. - */ -bool -ClassOne::isSetAtt2() const -{ - return mIsSetAtt2; -} - - -/* - * Sets the value of the "id" attribute of this ClassOne. - */ -int -ClassOne::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "att1" attribute of this ClassOne. - */ -int -ClassOne::setAtt1(bool att1) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (coreLevel == 3 && coreVersion == 1 && pkgVersion == 1) - { - mAtt1 = att1; - mIsSetAtt1 = true; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - mAtt1 = att1; - mIsSetAtt1 = false; - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "att2" attribute of this ClassOne. - */ -int -ClassOne::setAtt2(bool att2) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) - { - mAtt2 = att2; - mIsSetAtt2 = true; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - mAtt2 = att2; - mIsSetAtt2 = false; - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Unsets the value of the "id" attribute of this ClassOne. - */ -int -ClassOne::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "att1" attribute of this ClassOne. - */ -int -ClassOne::unsetAtt1() -{ - mAtt1 = false; - mIsSetAtt1 = false; - - if (isSetAtt1() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "att2" attribute of this ClassOne. - */ -int -ClassOne::unsetAtt2() -{ - mAtt2 = false; - mIsSetAtt2 = false; - - if (isSetAtt2() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the XML element name of this ClassOne object. - */ -const std::string& -ClassOne::getElementName() const -{ - static const string name = "classOne"; - return name; -} - - -/* - * Returns the libSBML type code for this ClassOne object. - */ -int -ClassOne::getTypeCode() const -{ - return CLASS_ONE; -} - - -/* - * Predicate returning @c true if all the required attributes for this ClassOne - * object have been set. - */ -bool -ClassOne::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ClassOne::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ClassOne::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ClassOne::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ClassOne::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "att1") - { - value = getAtt1(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "att2") - { - value = getAtt2(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ClassOne's attribute "attributeName" is - * set. - */ -bool -ClassOne::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "att1") - { - value = isSetAtt1(); - } - else if (attributeName == "att2") - { - value = isSetAtt2(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "att1") - { - return_value = setAtt1(value); - } - else if (attributeName == "att2") - { - return_value = setAtt2(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this ClassOne. - */ -int -ClassOne::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "att1") - { - value = unsetAtt1(); - } - else if (attributeName == "att2") - { - value = unsetAtt2(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -ClassOne::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - unsigned int level = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && coreVersion == 1 && pkgVersion == 1) - { - attributes.add("id"); - attributes.add("att1"); - } - - if (level == 3 && coreVersion == 1 && pkgVersion == 2) - { - attributes.add("id"); - attributes.add("att2"); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOne::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("vers", VersClassOneAllowedAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("vers", VersClassOneAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - if (level == 3 && version == 1 && pkgVersion == 1) - { - readL3V1V1Attributes(attributes); - } - - if (level == 3 && version == 1 && pkgVersion == 2) - { - readL3V1V2Attributes(attributes); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOne::readL3V1V1Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - unsigned int numErrs; - - // - // id SId (use = "required" ) - // - - XMLTriple tripleID("id", mURI, getPrefix()); - assigned = attributes.readInto(tripleID, mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Vers attribute 'id' is missing from the " - "element."; - log->logPackageError("vers", VersClassOneAllowedAttributes, pkgVersion, - level, version, message, getLine(), getColumn()); - } - } - - // - // att1 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt1 = attributes.readInto("att1", mAtt1); - - if (mIsSetAtt1 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("vers", VersClassOneAtt1MustBeBoolean, pkgVersion, - level, version); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOne::readL3V1V2Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - unsigned int numErrs; - - // - // id SId (use = "required" ) - // - - XMLTriple tripleID("id", mURI, getPrefix()); - assigned = attributes.readInto(tripleID, mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Vers attribute 'id' is missing from the " - "element."; - log->logPackageError("vers", VersClassOneAllowedAttributes, pkgVersion, - level, version, message, getLine(), getColumn()); - } - } - - // - // att2 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt2 = attributes.readInto("att2", mAtt2); - - if (mIsSetAtt2 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("vers", VersClassOneAtt2MustBeBoolean, pkgVersion, - level, version); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOne::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && version == 1 && pkgVersion == 1) - { - writeL3V1V1Attributes(stream); - } - - if (level == 3 && version == 1 && pkgVersion == 2) - { - writeL3V1V2Attributes(stream); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOne::writeL3V1V1Attributes(XMLOutputStream& stream) const -{ - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetAtt1() == true) - { - stream.writeAttribute("att1", getPrefix(), mAtt1); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOne::writeL3V1V2Attributes(XMLOutputStream& stream) const -{ - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetAtt2() == true) - { - stream.writeAttribute("att2", getPrefix(), mAtt2); - } -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ClassOne_t using the given SBML Level, Version and - * “vers” package version. - */ -LIBSBML_EXTERN -ClassOne_t * -ClassOne_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ClassOne(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ClassOne_t object. - */ -LIBSBML_EXTERN -ClassOne_t* -ClassOne_clone(const ClassOne_t* co) -{ - if (co != NULL) - { - return static_cast(co->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ClassOne_t object. - */ -LIBSBML_EXTERN -void -ClassOne_free(ClassOne_t* co) -{ - if (co != NULL) - { - delete co; - } -} - - -/* - * Returns the value of the "id" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -char * -ClassOne_getId(const ClassOne_t * co) -{ - if (co == NULL) - { - return NULL; - } - - return co->getId().empty() ? NULL : safe_strdup(co->getId().c_str()); -} - - -/* - * Returns the value of the "att1" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_getAtt1(const ClassOne_t * co) -{ - return (co != NULL) ? static_cast(co->getAtt1()) : 0; -} - - -/* - * Returns the value of the "att2" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_getAtt2(const ClassOne_t * co) -{ - return (co != NULL) ? static_cast(co->getAtt2()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOne_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -ClassOne_isSetId(const ClassOne_t * co) -{ - return (co != NULL) ? static_cast(co->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOne_t's "att1" attribute is - * set. - */ -LIBSBML_EXTERN -int -ClassOne_isSetAtt1(const ClassOne_t * co) -{ - return (co != NULL) ? static_cast(co->isSetAtt1()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOne_t's "att2" attribute is - * set. - */ -LIBSBML_EXTERN -int -ClassOne_isSetAtt2(const ClassOne_t * co) -{ - return (co != NULL) ? static_cast(co->isSetAtt2()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_setId(ClassOne_t * co, const char * id) -{ - return (co != NULL) ? co->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "att1" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_setAtt1(ClassOne_t * co, int att1) -{ - return (co != NULL) ? co->setAtt1(att1) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "att2" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_setAtt2(ClassOne_t * co, int att2) -{ - return (co != NULL) ? co->setAtt2(att2) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_unsetId(ClassOne_t * co) -{ - return (co != NULL) ? co->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "att1" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_unsetAtt1(ClassOne_t * co) -{ - return (co != NULL) ? co->unsetAtt1() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "att2" attribute of this ClassOne_t. - */ -LIBSBML_EXTERN -int -ClassOne_unsetAtt2(ClassOne_t * co) -{ - return (co != NULL) ? co->unsetAtt2() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassOne_t object have been set. - */ -LIBSBML_EXTERN -int -ClassOne_hasRequiredAttributes(const ClassOne_t * co) -{ - return (co != NULL) ? static_cast(co->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ClassOne.cpp + * @brief Implementation of the ClassOne class. + * @author SBMLTeam + * + * + */ +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ClassOne using the given SBML Level, Version and + * “vers” package version. + */ +ClassOne::ClassOne(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mAtt1 (false) + , mIsSetAtt1 (false) + , mAtt2 (false) + , mIsSetAtt2 (false) +{ + setSBMLNamespacesAndOwn(new VersPkgNamespaces(level, version, pkgVersion)); +} + + +/* + * Creates a new ClassOne using the given VersPkgNamespaces object. + */ +ClassOne::ClassOne(VersPkgNamespaces *versns) + : SBase(versns) + , mAtt1 (false) + , mIsSetAtt1 (false) + , mAtt2 (false) + , mIsSetAtt2 (false) +{ + setElementNamespace(versns->getURI()); + loadPlugins(versns); +} + + +/* + * Copy constructor for ClassOne. + */ +ClassOne::ClassOne(const ClassOne& orig) + : SBase( orig ) + , mAtt1 ( orig.mAtt1 ) + , mIsSetAtt1 ( orig.mIsSetAtt1 ) + , mAtt2 ( orig.mAtt2 ) + , mIsSetAtt2 ( orig.mIsSetAtt2 ) +{ +} + + +/* + * Assignment operator for ClassOne. + */ +ClassOne& +ClassOne::operator=(const ClassOne& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mAtt1 = rhs.mAtt1; + mIsSetAtt1 = rhs.mIsSetAtt1; + mAtt2 = rhs.mAtt2; + mIsSetAtt2 = rhs.mIsSetAtt2; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ClassOne object. + */ +ClassOne* +ClassOne::clone() const +{ + return new ClassOne(*this); +} + + +/* + * Destructor for ClassOne. + */ +ClassOne::~ClassOne() +{ +} + + +/* + * Returns the value of the "id" attribute of this ClassOne. + */ +const std::string& +ClassOne::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "att1" attribute of this ClassOne. + */ +bool +ClassOne::getAtt1() const +{ + return mAtt1; +} + + +/* + * Returns the value of the "att2" attribute of this ClassOne. + */ +bool +ClassOne::getAtt2() const +{ + return mAtt2; +} + + +/* + * Predicate returning @c true if this ClassOne's "id" attribute is set. + */ +bool +ClassOne::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this ClassOne's "att1" attribute is set. + */ +bool +ClassOne::isSetAtt1() const +{ + return mIsSetAtt1; +} + + +/* + * Predicate returning @c true if this ClassOne's "att2" attribute is set. + */ +bool +ClassOne::isSetAtt2() const +{ + return mIsSetAtt2; +} + + +/* + * Sets the value of the "id" attribute of this ClassOne. + */ +int +ClassOne::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "att1" attribute of this ClassOne. + */ +int +ClassOne::setAtt1(bool att1) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (coreLevel == 3 && coreVersion == 1 && pkgVersion == 1) + { + mAtt1 = att1; + mIsSetAtt1 = true; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + mAtt1 = att1; + mIsSetAtt1 = false; + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "att2" attribute of this ClassOne. + */ +int +ClassOne::setAtt2(bool att2) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) + { + mAtt2 = att2; + mIsSetAtt2 = true; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + mAtt2 = att2; + mIsSetAtt2 = false; + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Unsets the value of the "id" attribute of this ClassOne. + */ +int +ClassOne::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "att1" attribute of this ClassOne. + */ +int +ClassOne::unsetAtt1() +{ + mAtt1 = false; + mIsSetAtt1 = false; + + if (isSetAtt1() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "att2" attribute of this ClassOne. + */ +int +ClassOne::unsetAtt2() +{ + mAtt2 = false; + mIsSetAtt2 = false; + + if (isSetAtt2() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the XML element name of this ClassOne object. + */ +const std::string& +ClassOne::getElementName() const +{ + static const string name = "classOne"; + return name; +} + + +/* + * Returns the libSBML type code for this ClassOne object. + */ +int +ClassOne::getTypeCode() const +{ + return CLASS_ONE; +} + + +/* + * Predicate returning @c true if all the required attributes for this ClassOne + * object have been set. + */ +bool +ClassOne::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ClassOne::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ClassOne::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ClassOne::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ClassOne::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "att1") + { + value = getAtt1(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "att2") + { + value = getAtt2(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ClassOne's attribute "attributeName" is + * set. + */ +bool +ClassOne::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "att1") + { + value = isSetAtt1(); + } + else if (attributeName == "att2") + { + value = isSetAtt2(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "att1") + { + return_value = setAtt1(value); + } + else if (attributeName == "att2") + { + return_value = setAtt2(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this ClassOne. + */ +int +ClassOne::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "att1") + { + value = unsetAtt1(); + } + else if (attributeName == "att2") + { + value = unsetAtt2(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +ClassOne::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + unsigned int level = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && coreVersion == 1 && pkgVersion == 1) + { + attributes.add("id"); + attributes.add("att1"); + } + + if (level == 3 && coreVersion == 1 && pkgVersion == 2) + { + attributes.add("id"); + attributes.add("att2"); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOne::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("vers", VersClassOneAllowedAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("vers", VersClassOneAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + if (level == 3 && version == 1 && pkgVersion == 1) + { + readL3V1V1Attributes(attributes); + } + + if (level == 3 && version == 1 && pkgVersion == 2) + { + readL3V1V2Attributes(attributes); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOne::readL3V1V1Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + unsigned int numErrs; + + // + // id SId (use = "required" ) + // + + XMLTriple tripleID("id", mURI, getPrefix()); + assigned = attributes.readInto(tripleID, mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Vers attribute 'id' is missing from the " + "element."; + log->logPackageError("vers", VersClassOneAllowedAttributes, pkgVersion, + level, version, message, getLine(), getColumn()); + } + } + + // + // att1 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt1 = attributes.readInto("att1", mAtt1); + + if (mIsSetAtt1 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("vers", VersClassOneAtt1MustBeBoolean, pkgVersion, + level, version); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOne::readL3V1V2Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + unsigned int numErrs; + + // + // id SId (use = "required" ) + // + + XMLTriple tripleID("id", mURI, getPrefix()); + assigned = attributes.readInto(tripleID, mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("vers", VersIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Vers attribute 'id' is missing from the " + "element."; + log->logPackageError("vers", VersClassOneAllowedAttributes, pkgVersion, + level, version, message, getLine(), getColumn()); + } + } + + // + // att2 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt2 = attributes.readInto("att2", mAtt2); + + if (mIsSetAtt2 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("vers", VersClassOneAtt2MustBeBoolean, pkgVersion, + level, version); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOne::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && version == 1 && pkgVersion == 1) + { + writeL3V1V1Attributes(stream); + } + + if (level == 3 && version == 1 && pkgVersion == 2) + { + writeL3V1V2Attributes(stream); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOne::writeL3V1V1Attributes(XMLOutputStream& stream) const +{ + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetAtt1() == true) + { + stream.writeAttribute("att1", getPrefix(), mAtt1); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOne::writeL3V1V2Attributes(XMLOutputStream& stream) const +{ + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetAtt2() == true) + { + stream.writeAttribute("att2", getPrefix(), mAtt2); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ClassOne_t using the given SBML Level, Version and + * “vers” package version. + */ +LIBSBML_EXTERN +ClassOne_t * +ClassOne_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ClassOne(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ClassOne_t object. + */ +LIBSBML_EXTERN +ClassOne_t* +ClassOne_clone(const ClassOne_t* co) +{ + if (co != NULL) + { + return static_cast(co->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ClassOne_t object. + */ +LIBSBML_EXTERN +void +ClassOne_free(ClassOne_t* co) +{ + if (co != NULL) + { + delete co; + } +} + + +/* + * Returns the value of the "id" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +char * +ClassOne_getId(const ClassOne_t * co) +{ + if (co == NULL) + { + return NULL; + } + + return co->getId().empty() ? NULL : safe_strdup(co->getId().c_str()); +} + + +/* + * Returns the value of the "att1" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_getAtt1(const ClassOne_t * co) +{ + return (co != NULL) ? static_cast(co->getAtt1()) : 0; +} + + +/* + * Returns the value of the "att2" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_getAtt2(const ClassOne_t * co) +{ + return (co != NULL) ? static_cast(co->getAtt2()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOne_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +ClassOne_isSetId(const ClassOne_t * co) +{ + return (co != NULL) ? static_cast(co->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOne_t's "att1" attribute is + * set. + */ +LIBSBML_EXTERN +int +ClassOne_isSetAtt1(const ClassOne_t * co) +{ + return (co != NULL) ? static_cast(co->isSetAtt1()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOne_t's "att2" attribute is + * set. + */ +LIBSBML_EXTERN +int +ClassOne_isSetAtt2(const ClassOne_t * co) +{ + return (co != NULL) ? static_cast(co->isSetAtt2()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_setId(ClassOne_t * co, const char * id) +{ + return (co != NULL) ? co->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "att1" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_setAtt1(ClassOne_t * co, int att1) +{ + return (co != NULL) ? co->setAtt1(att1) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "att2" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_setAtt2(ClassOne_t * co, int att2) +{ + return (co != NULL) ? co->setAtt2(att2) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_unsetId(ClassOne_t * co) +{ + return (co != NULL) ? co->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "att1" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_unsetAtt1(ClassOne_t * co) +{ + return (co != NULL) ? co->unsetAtt1() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "att2" attribute of this ClassOne_t. + */ +LIBSBML_EXTERN +int +ClassOne_unsetAtt2(ClassOne_t * co) +{ + return (co != NULL) ? co->unsetAtt2() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassOne_t object have been set. + */ +LIBSBML_EXTERN +int +ClassOne_hasRequiredAttributes(const ClassOne_t * co) +{ + return (co != NULL) ? static_cast(co->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ClassOne.h b/generator/tests/test_cpp_code/test-code/ClassOne.h index 111aef47..dd662a1c 100644 --- a/generator/tests/test_cpp_code/test-code/ClassOne.h +++ b/generator/tests/test_cpp_code/test-code/ClassOne.h @@ -1,993 +1,993 @@ -/** - * @file ClassOne.h - * @brief Definition of the ClassOne class. - * @author SBMLTeam - * - * - * - * @class ClassOne - * @sbmlbrief{vers} TODO:Definition of the ClassOne class. - */ - - -#ifndef ClassOne_H__ -#define ClassOne_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ClassOne : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - bool mAtt1; - bool mIsSetAtt1; - bool mAtt2; - bool mIsSetAtt2; - - /** @endcond */ - -public: - - /** - * Creates a new ClassOne using the given SBML Level, Version and - * “vers” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ClassOne. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassOne. - * - * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this - * ClassOne. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassOne(unsigned int level = VersExtension::getDefaultLevel(), - unsigned int version = VersExtension::getDefaultVersion(), - unsigned int pkgVersion = - VersExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ClassOne using the given VersPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param versns the VersPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassOne(VersPkgNamespaces *versns); - - - /** - * Copy constructor for ClassOne. - * - * @param orig the ClassOne instance to copy. - */ - ClassOne(const ClassOne& orig); - - - /** - * Assignment operator for ClassOne. - * - * @param rhs the ClassOne object whose values are to be used as the basis of - * the assignment. - */ - ClassOne& operator=(const ClassOne& rhs); - - - /** - * Creates and returns a deep copy of this ClassOne object. - * - * @return a (deep) copy of this ClassOne object. - */ - virtual ClassOne* clone() const; - - - /** - * Destructor for ClassOne. - */ - virtual ~ClassOne(); - - - /** - * Returns the value of the "id" attribute of this ClassOne. - * - * @return the value of the "id" attribute of this ClassOne as a string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "att1" attribute of this ClassOne. - * - * @return the value of the "att1" attribute of this ClassOne as a boolean. - */ - bool getAtt1() const; - - - /** - * Returns the value of the "att2" attribute of this ClassOne. - * - * @return the value of the "att2" attribute of this ClassOne as a boolean. - */ - bool getAtt2() const; - - - /** - * Predicate returning @c true if this ClassOne's "id" attribute is set. - * - * @return @c true if this ClassOne's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this ClassOne's "att1" attribute is set. - * - * @return @c true if this ClassOne's "att1" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAtt1() const; - - - /** - * Predicate returning @c true if this ClassOne's "att2" attribute is set. - * - * @return @c true if this ClassOne's "att2" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAtt2() const; - - - /** - * Sets the value of the "id" attribute of this ClassOne. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "att1" attribute of this ClassOne. - * - * @param att1 bool value of the "att1" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAtt1(bool att1); - - - /** - * Sets the value of the "att2" attribute of this ClassOne. - * - * @param att2 bool value of the "att2" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAtt2(bool att2); - - - /** - * Unsets the value of the "id" attribute of this ClassOne. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "att1" attribute of this ClassOne. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAtt1(); - - - /** - * Unsets the value of the "att2" attribute of this ClassOne. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAtt2(); - - - /** - * Returns the XML element name of this ClassOne object. - * - * For ClassOne, the XML element name is always @c "classOne". - * - * @return the name of this element, i.e. @c "classOne". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ClassOne object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{CLASS_ONE, SBMLVersTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * ClassOne object have been set. - * - * @return @c true to indicate that all the required attributes of this - * ClassOne have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the ClassOne object are: - * @li "id" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ClassOne's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ClassOne's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this ClassOne. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V1V1Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V1V2Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V1V1Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V1V2Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ClassOne_t using the given SBML Level, Version and - * “vers” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ClassOne_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassOne_t. - * - * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this - * ClassOne_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -ClassOne_t * -ClassOne_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ClassOne_t object. - * - * @param co the ClassOne_t structure. - * - * @return a (deep) copy of this ClassOne_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -ClassOne_t* -ClassOne_clone(const ClassOne_t* co); - - -/** - * Frees this ClassOne_t object. - * - * @param co the ClassOne_t structure. - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -void -ClassOne_free(ClassOne_t* co); - - -/** - * Returns the value of the "id" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure whose id is sought. - * - * @return the value of the "id" attribute of this ClassOne_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -char * -ClassOne_getId(const ClassOne_t * co); - - -/** - * Returns the value of the "att1" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure whose att1 is sought. - * - * @return the value of the "att1" attribute of this ClassOne_t as a boolean. - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_getAtt1(const ClassOne_t * co); - - -/** - * Returns the value of the "att2" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure whose att2 is sought. - * - * @return the value of the "att2" attribute of this ClassOne_t as a boolean. - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_getAtt2(const ClassOne_t * co); - - -/** - * Predicate returning @c 1 (true) if this ClassOne_t's "id" attribute is set. - * - * @param co the ClassOne_t structure. - * - * @return @c 1 (true) if this ClassOne_t's "id" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_isSetId(const ClassOne_t * co); - - -/** - * Predicate returning @c 1 (true) if this ClassOne_t's "att1" attribute is - * set. - * - * @param co the ClassOne_t structure. - * - * @return @c 1 (true) if this ClassOne_t's "att1" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_isSetAtt1(const ClassOne_t * co); - - -/** - * Predicate returning @c 1 (true) if this ClassOne_t's "att2" attribute is - * set. - * - * @param co the ClassOne_t structure. - * - * @return @c 1 (true) if this ClassOne_t's "att2" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_isSetAtt2(const ClassOne_t * co); - - -/** - * Sets the value of the "id" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling ClassOne_unsetId(). - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_setId(ClassOne_t * co, const char * id); - - -/** - * Sets the value of the "att1" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure. - * - * @param att1 int value of the "att1" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_setAtt1(ClassOne_t * co, int att1); - - -/** - * Sets the value of the "att2" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure. - * - * @param att2 int value of the "att2" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_setAtt2(ClassOne_t * co, int att2); - - -/** - * Unsets the value of the "id" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_unsetId(ClassOne_t * co); - - -/** - * Unsets the value of the "att1" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_unsetAtt1(ClassOne_t * co); - - -/** - * Unsets the value of the "att2" attribute of this ClassOne_t. - * - * @param co the ClassOne_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_unsetAtt2(ClassOne_t * co); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassOne_t object have been set. - * - * @param co the ClassOne_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * ClassOne_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the ClassOne_t object are: - * @li "id" - * - * @memberof ClassOne_t - */ -LIBSBML_EXTERN -int -ClassOne_hasRequiredAttributes(const ClassOne_t * co); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ClassOne_H__ */ - - +/** + * @file ClassOne.h + * @brief Definition of the ClassOne class. + * @author SBMLTeam + * + * + * + * @class ClassOne + * @sbmlbrief{vers} TODO:Definition of the ClassOne class. + */ + + +#ifndef ClassOne_H__ +#define ClassOne_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ClassOne : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + bool mAtt1; + bool mIsSetAtt1; + bool mAtt2; + bool mIsSetAtt2; + + /** @endcond */ + +public: + + /** + * Creates a new ClassOne using the given SBML Level, Version and + * “vers” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ClassOne. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassOne. + * + * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this + * ClassOne. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassOne(unsigned int level = VersExtension::getDefaultLevel(), + unsigned int version = VersExtension::getDefaultVersion(), + unsigned int pkgVersion = + VersExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ClassOne using the given VersPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param versns the VersPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassOne(VersPkgNamespaces *versns); + + + /** + * Copy constructor for ClassOne. + * + * @param orig the ClassOne instance to copy. + */ + ClassOne(const ClassOne& orig); + + + /** + * Assignment operator for ClassOne. + * + * @param rhs the ClassOne object whose values are to be used as the basis of + * the assignment. + */ + ClassOne& operator=(const ClassOne& rhs); + + + /** + * Creates and returns a deep copy of this ClassOne object. + * + * @return a (deep) copy of this ClassOne object. + */ + virtual ClassOne* clone() const; + + + /** + * Destructor for ClassOne. + */ + virtual ~ClassOne(); + + + /** + * Returns the value of the "id" attribute of this ClassOne. + * + * @return the value of the "id" attribute of this ClassOne as a string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "att1" attribute of this ClassOne. + * + * @return the value of the "att1" attribute of this ClassOne as a boolean. + */ + bool getAtt1() const; + + + /** + * Returns the value of the "att2" attribute of this ClassOne. + * + * @return the value of the "att2" attribute of this ClassOne as a boolean. + */ + bool getAtt2() const; + + + /** + * Predicate returning @c true if this ClassOne's "id" attribute is set. + * + * @return @c true if this ClassOne's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this ClassOne's "att1" attribute is set. + * + * @return @c true if this ClassOne's "att1" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAtt1() const; + + + /** + * Predicate returning @c true if this ClassOne's "att2" attribute is set. + * + * @return @c true if this ClassOne's "att2" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAtt2() const; + + + /** + * Sets the value of the "id" attribute of this ClassOne. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "att1" attribute of this ClassOne. + * + * @param att1 bool value of the "att1" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAtt1(bool att1); + + + /** + * Sets the value of the "att2" attribute of this ClassOne. + * + * @param att2 bool value of the "att2" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAtt2(bool att2); + + + /** + * Unsets the value of the "id" attribute of this ClassOne. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "att1" attribute of this ClassOne. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAtt1(); + + + /** + * Unsets the value of the "att2" attribute of this ClassOne. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAtt2(); + + + /** + * Returns the XML element name of this ClassOne object. + * + * For ClassOne, the XML element name is always @c "classOne". + * + * @return the name of this element, i.e. @c "classOne". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ClassOne object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{CLASS_ONE, SBMLVersTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * ClassOne object have been set. + * + * @return @c true to indicate that all the required attributes of this + * ClassOne have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the ClassOne object are: + * @li "id" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ClassOne's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ClassOne's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this ClassOne. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V1V1Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V1V2Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V1V1Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V1V2Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ClassOne_t using the given SBML Level, Version and + * “vers” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ClassOne_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassOne_t. + * + * @param pkgVersion an unsigned int, the SBML Vers Version to assign to this + * ClassOne_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +ClassOne_t * +ClassOne_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ClassOne_t object. + * + * @param co the ClassOne_t structure. + * + * @return a (deep) copy of this ClassOne_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +ClassOne_t* +ClassOne_clone(const ClassOne_t* co); + + +/** + * Frees this ClassOne_t object. + * + * @param co the ClassOne_t structure. + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +void +ClassOne_free(ClassOne_t* co); + + +/** + * Returns the value of the "id" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure whose id is sought. + * + * @return the value of the "id" attribute of this ClassOne_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +char * +ClassOne_getId(const ClassOne_t * co); + + +/** + * Returns the value of the "att1" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure whose att1 is sought. + * + * @return the value of the "att1" attribute of this ClassOne_t as a boolean. + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_getAtt1(const ClassOne_t * co); + + +/** + * Returns the value of the "att2" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure whose att2 is sought. + * + * @return the value of the "att2" attribute of this ClassOne_t as a boolean. + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_getAtt2(const ClassOne_t * co); + + +/** + * Predicate returning @c 1 (true) if this ClassOne_t's "id" attribute is set. + * + * @param co the ClassOne_t structure. + * + * @return @c 1 (true) if this ClassOne_t's "id" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_isSetId(const ClassOne_t * co); + + +/** + * Predicate returning @c 1 (true) if this ClassOne_t's "att1" attribute is + * set. + * + * @param co the ClassOne_t structure. + * + * @return @c 1 (true) if this ClassOne_t's "att1" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_isSetAtt1(const ClassOne_t * co); + + +/** + * Predicate returning @c 1 (true) if this ClassOne_t's "att2" attribute is + * set. + * + * @param co the ClassOne_t structure. + * + * @return @c 1 (true) if this ClassOne_t's "att2" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_isSetAtt2(const ClassOne_t * co); + + +/** + * Sets the value of the "id" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling ClassOne_unsetId(). + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_setId(ClassOne_t * co, const char * id); + + +/** + * Sets the value of the "att1" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure. + * + * @param att1 int value of the "att1" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_setAtt1(ClassOne_t * co, int att1); + + +/** + * Sets the value of the "att2" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure. + * + * @param att2 int value of the "att2" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_setAtt2(ClassOne_t * co, int att2); + + +/** + * Unsets the value of the "id" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_unsetId(ClassOne_t * co); + + +/** + * Unsets the value of the "att1" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_unsetAtt1(ClassOne_t * co); + + +/** + * Unsets the value of the "att2" attribute of this ClassOne_t. + * + * @param co the ClassOne_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_unsetAtt2(ClassOne_t * co); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassOne_t object have been set. + * + * @param co the ClassOne_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * ClassOne_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the ClassOne_t object are: + * @li "id" + * + * @memberof ClassOne_t + */ +LIBSBML_EXTERN +int +ClassOne_hasRequiredAttributes(const ClassOne_t * co); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ClassOne_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ClassOneTwo.cpp b/generator/tests/test_cpp_code/test-code/ClassOneTwo.cpp index a95b3f4b..12169363 100644 --- a/generator/tests/test_cpp_code/test-code/ClassOneTwo.cpp +++ b/generator/tests/test_cpp_code/test-code/ClassOneTwo.cpp @@ -1,2407 +1,2407 @@ -/** - * @file ClassOneTwo.cpp - * @brief Implementation of the ClassOneTwo class. - * @author SBMLTeam - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ClassOneTwo using the given SBML Level, Version and - * “coreversmultipkg” package version. - */ -ClassOneTwo::ClassOneTwo(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mAtt1 (false) - , mIsSetAtt1 (false) - , mAttStr ("") - , mAttInt (SBML_INT_MAX) - , mIsSetAttInt (false) - , mAtt2 (false) - , mIsSetAtt2 (false) - , mAttDbl (util_NaN()) - , mIsSetAttDbl (false) - , mAttUnit ("") - , mAttEnum (OBJECTIVE_TYPE_INVALID) -{ - setSBMLNamespacesAndOwn(new CoreversmultipkgPkgNamespaces(level, version, - pkgVersion)); -} - - -/* - * Creates a new ClassOneTwo using the given CoreversmultipkgPkgNamespaces - * object. - */ -ClassOneTwo::ClassOneTwo(CoreversmultipkgPkgNamespaces *coreversmultipkgns) - : SBase(coreversmultipkgns) - , mAtt1 (false) - , mIsSetAtt1 (false) - , mAttStr ("") - , mAttInt (SBML_INT_MAX) - , mIsSetAttInt (false) - , mAtt2 (false) - , mIsSetAtt2 (false) - , mAttDbl (util_NaN()) - , mIsSetAttDbl (false) - , mAttUnit ("") - , mAttEnum (OBJECTIVE_TYPE_INVALID) -{ - setElementNamespace(coreversmultipkgns->getURI()); - loadPlugins(coreversmultipkgns); -} - - -/* - * Copy constructor for ClassOneTwo. - */ -ClassOneTwo::ClassOneTwo(const ClassOneTwo& orig) - : SBase( orig ) - , mAtt1 ( orig.mAtt1 ) - , mIsSetAtt1 ( orig.mIsSetAtt1 ) - , mAttStr ( orig.mAttStr ) - , mAttInt ( orig.mAttInt ) - , mIsSetAttInt ( orig.mIsSetAttInt ) - , mAtt2 ( orig.mAtt2 ) - , mIsSetAtt2 ( orig.mIsSetAtt2 ) - , mAttDbl ( orig.mAttDbl ) - , mIsSetAttDbl ( orig.mIsSetAttDbl ) - , mAttUnit ( orig.mAttUnit ) - , mAttEnum ( orig.mAttEnum ) -{ -} - - -/* - * Assignment operator for ClassOneTwo. - */ -ClassOneTwo& -ClassOneTwo::operator=(const ClassOneTwo& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mAtt1 = rhs.mAtt1; - mIsSetAtt1 = rhs.mIsSetAtt1; - mAttStr = rhs.mAttStr; - mAttInt = rhs.mAttInt; - mIsSetAttInt = rhs.mIsSetAttInt; - mAtt2 = rhs.mAtt2; - mIsSetAtt2 = rhs.mIsSetAtt2; - mAttDbl = rhs.mAttDbl; - mIsSetAttDbl = rhs.mIsSetAttDbl; - mAttUnit = rhs.mAttUnit; - mAttEnum = rhs.mAttEnum; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ClassOneTwo object. - */ -ClassOneTwo* -ClassOneTwo::clone() const -{ - return new ClassOneTwo(*this); -} - - -/* - * Destructor for ClassOneTwo. - */ -ClassOneTwo::~ClassOneTwo() -{ -} - - -/* - * Returns the value of the "id" attribute of this ClassOneTwo. - */ -const std::string& -ClassOneTwo::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "att1" attribute of this ClassOneTwo. - */ -bool -ClassOneTwo::getAtt1() const -{ - return mAtt1; -} - - -/* - * Returns the value of the "attStr" attribute of this ClassOneTwo. - */ -const std::string& -ClassOneTwo::getAttStr() const -{ - return mAttStr; -} - - -/* - * Returns the value of the "attInt" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::getAttInt() const -{ - return mAttInt; -} - - -/* - * Returns the value of the "att2" attribute of this ClassOneTwo. - */ -bool -ClassOneTwo::getAtt2() const -{ - return mAtt2; -} - - -/* - * Returns the value of the "attDbl" attribute of this ClassOneTwo. - */ -double -ClassOneTwo::getAttDbl() const -{ - return mAttDbl; -} - - -/* - * Returns the value of the "attUnit" attribute of this ClassOneTwo. - */ -const std::string& -ClassOneTwo::getAttUnit() const -{ - return mAttUnit; -} - - -/* - * Returns the value of the "attEnum" attribute of this ClassOneTwo. - */ -AbcType_t -ClassOneTwo::getAttEnum() const -{ - return mAttEnum; -} - - -/* - * Returns the value of the "attEnum" attribute of this ClassOneTwo. - */ -std::string -ClassOneTwo::getAttEnumAsString() const -{ - std::string code_str = AbcType_toString(mAttEnum); - return code_str; -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "id" attribute is set. - */ -bool -ClassOneTwo::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "att1" attribute is set. - */ -bool -ClassOneTwo::isSetAtt1() const -{ - return mIsSetAtt1; -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "attStr" attribute is set. - */ -bool -ClassOneTwo::isSetAttStr() const -{ - return (mAttStr.empty() == false); -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "attInt" attribute is set. - */ -bool -ClassOneTwo::isSetAttInt() const -{ - return mIsSetAttInt; -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "att2" attribute is set. - */ -bool -ClassOneTwo::isSetAtt2() const -{ - return mIsSetAtt2; -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "attDbl" attribute is set. - */ -bool -ClassOneTwo::isSetAttDbl() const -{ - return mIsSetAttDbl; -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "attUnit" attribute is - * set. - */ -bool -ClassOneTwo::isSetAttUnit() const -{ - return (mAttUnit.empty() == false); -} - - -/* - * Predicate returning @c true if this ClassOneTwo's "attEnum" attribute is - * set. - */ -bool -ClassOneTwo::isSetAttEnum() const -{ - return (mAttEnum != OBJECTIVE_TYPE_INVALID); -} - - -/* - * Sets the value of the "id" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setId(const std::string& id) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if ((coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) || (coreLevel == - 3 && coreVersion == 2 && pkgVersion == 1) || (coreLevel == 3 && coreVersion - == 2 && pkgVersion == 2)) - { - return SyntaxChecker::checkAndSetSId(id, mId); - } - else - { - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "att1" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAtt1(bool att1) -{ - mAtt1 = att1; - mIsSetAtt1 = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "attStr" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttStr(const std::string& attStr) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) - { - mAttStr = attStr; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "attInt" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttInt(int attInt) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if ((coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) || (coreLevel == - 3 && coreVersion == 2 && pkgVersion == 2)) - { - mAttInt = attInt; - mIsSetAttInt = true; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - mAttInt = attInt; - mIsSetAttInt = false; - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "att2" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAtt2(bool att2) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if ((coreLevel == 3 && coreVersion == 2 && pkgVersion == 1) || (coreLevel == - 3 && coreVersion == 2 && pkgVersion == 2) || (coreLevel == 4 && coreVersion - == 1 && pkgVersion == 1)) - { - mAtt2 = att2; - mIsSetAtt2 = true; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - mAtt2 = att2; - mIsSetAtt2 = false; - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "attDbl" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttDbl(double attDbl) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (coreLevel == 3 && coreVersion == 2 && pkgVersion == 1) - { - mAttDbl = attDbl; - mIsSetAttDbl = true; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - mAttDbl = attDbl; - mIsSetAttDbl = false; - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "attUnit" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttUnit(const std::string& attUnit) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (coreLevel == 4 && coreVersion == 1 && pkgVersion == 1) - { - if (!(SyntaxChecker::isValidInternalUnitSId(attUnit))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mAttUnit = attUnit; - return LIBSBML_OPERATION_SUCCESS; - } - } - else - { - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "attEnum" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttEnum(const AbcType_t attEnum) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (coreLevel == 4 && coreVersion == 1 && pkgVersion == 1) - { - if (AbcType_isValid(attEnum) == 0) - { - mAttEnum = OBJECTIVE_TYPE_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mAttEnum = attEnum; - return LIBSBML_OPERATION_SUCCESS; - } - } - else - { - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Sets the value of the "attEnum" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttEnum(const std::string& attEnum) -{ - unsigned int coreLevel = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (coreLevel == 4 && coreVersion == 1 && pkgVersion == 1) - { - mAttEnum = AbcType_fromString(attEnum.c_str()); - - if (mAttEnum == OBJECTIVE_TYPE_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_UNEXPECTED_ATTRIBUTE; - } -} - - -/* - * Unsets the value of the "id" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "att1" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAtt1() -{ - mAtt1 = false; - mIsSetAtt1 = false; - - if (isSetAtt1() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "attStr" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAttStr() -{ - mAttStr.erase(); - - if (mAttStr.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "attInt" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAttInt() -{ - mAttInt = SBML_INT_MAX; - mIsSetAttInt = false; - - if (isSetAttInt() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "att2" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAtt2() -{ - mAtt2 = false; - mIsSetAtt2 = false; - - if (isSetAtt2() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "attDbl" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAttDbl() -{ - mAttDbl = util_NaN(); - mIsSetAttDbl = false; - - if (isSetAttDbl() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "attUnit" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAttUnit() -{ - mAttUnit.erase(); - - if (mAttUnit.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "attEnum" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAttEnum() -{ - mAttEnum = OBJECTIVE_TYPE_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this ClassOneTwo object. - */ -const std::string& -ClassOneTwo::getElementName() const -{ - static const string name = "classOneTwo"; - return name; -} - - -/* - * Returns the libSBML type code for this ClassOneTwo object. - */ -int -ClassOneTwo::getTypeCode() const -{ - return SBML_COREVERS_CLASSONETWO; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * ClassOneTwo object have been set. - */ -bool -ClassOneTwo::hasRequiredAttributes() const -{ - bool allPresent = true; - - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if ((level == 3 && version == 1 && pkgVersion == 2) || (level == 3 && version - == 2 && pkgVersion == 1) || (level == 3 && version == 2 && pkgVersion == 2)) - { - if (isSetId() == false) - { - allPresent = false; - } - } - - if (level == 4 && version == 1 && pkgVersion == 1) - { - if (isSetAttEnum() == false) - { - allPresent = false; - } - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ClassOneTwo::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ClassOneTwo::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ClassOneTwo::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ClassOneTwo::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "att1") - { - value = getAtt1(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "att2") - { - value = getAtt2(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "attInt") - { - value = getAttInt(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "attDbl") - { - value = getAttDbl(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "attStr") - { - value = getAttStr(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "attUnit") - { - value = getAttUnit(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "attEnum") - { - value = getAttEnumAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ClassOneTwo's attribute "attributeName" - * is set. - */ -bool -ClassOneTwo::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "att1") - { - value = isSetAtt1(); - } - else if (attributeName == "attStr") - { - value = isSetAttStr(); - } - else if (attributeName == "attInt") - { - value = isSetAttInt(); - } - else if (attributeName == "att2") - { - value = isSetAtt2(); - } - else if (attributeName == "attDbl") - { - value = isSetAttDbl(); - } - else if (attributeName == "attUnit") - { - value = isSetAttUnit(); - } - else if (attributeName == "attEnum") - { - value = isSetAttEnum(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "att1") - { - return_value = setAtt1(value); - } - else if (attributeName == "att2") - { - return_value = setAtt2(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "attInt") - { - return_value = setAttInt(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "attDbl") - { - return_value = setAttDbl(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "attStr") - { - return_value = setAttStr(value); - } - else if (attributeName == "attUnit") - { - return_value = setAttUnit(value); - } - else if (attributeName == "attEnum") - { - return_value = setAttEnum(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this ClassOneTwo. - */ -int -ClassOneTwo::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "att1") - { - value = unsetAtt1(); - } - else if (attributeName == "attStr") - { - value = unsetAttStr(); - } - else if (attributeName == "attInt") - { - value = unsetAttInt(); - } - else if (attributeName == "att2") - { - value = unsetAtt2(); - } - else if (attributeName == "attDbl") - { - value = unsetAttDbl(); - } - else if (attributeName == "attUnit") - { - value = unsetAttUnit(); - } - else if (attributeName == "attEnum") - { - value = unsetAttEnum(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -ClassOneTwo::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - unsigned int level = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && coreVersion == 1 && pkgVersion == 2) - { - attributes.add("id"); - attributes.add("att1"); - attributes.add("attStr"); - attributes.add("attInt"); - } - - if (level == 3 && coreVersion == 2 && pkgVersion == 1) - { - attributes.add("att1"); - attributes.add("att2"); - attributes.add("attDbl"); - } - - if (level == 3 && coreVersion == 2 && pkgVersion == 2) - { - attributes.add("att1"); - attributes.add("att2"); - attributes.add("attInt"); - } - - if (level == 4 && coreVersion == 1 && pkgVersion == 1) - { - attributes.add("att1"); - attributes.add("att2"); - attributes.add("attUnit"); - attributes.add("attEnum"); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOneTwo::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - if (level == 3 && version == 1 && pkgVersion == 2) - { - readL3V1V2Attributes(attributes); - } - - if (level == 3 && version == 2 && pkgVersion == 1) - { - readL3V2V1Attributes(attributes); - } - - if (level == 3 && version == 2 && pkgVersion == 2) - { - readL3V2V2Attributes(attributes); - } - - if (level == 4 && version == 1 && pkgVersion == 1) - { - readL4V1V1Attributes(attributes); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOneTwo::readL3V1V2Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - unsigned int numErrs; - - // - // id SId (use = "required" ) - // - - XMLTriple tripleID("id", mURI, getPrefix()); - assigned = attributes.readInto(tripleID, mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("coreversmultipkg", CoreversmultipkgIdSyntaxRule, - pkgVersion, level, version, "The id on the <" + getElementName() + "> is " - "'" + mId + "', which does not conform to the syntax.", getLine(), - getColumn()); - } - } - else - { - if (log) - { - std::string message = "Coreversmultipkg attribute 'id' is missing from " - "the element."; - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // att1 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt1 = attributes.readInto("att1", mAtt1); - - if (mIsSetAtt1 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, - version); - } - } - - // - // attStr string (use = "optional" ) - // - - assigned = attributes.readInto("attStr", mAttStr); - - if (assigned == true) - { - if (mAttStr.empty() == true) - { - logEmptyString(mAttStr, level, version, ""); - } - } - - // - // attInt int (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAttInt = attributes.readInto("attInt", mAttInt); - - if ( mIsSetAttInt == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Coreversmultipkg attribute 'attInt' from the " - " element must be an integer."; - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAttIntMustBeInteger, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOneTwo::readL3V2V1Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - unsigned int numErrs; - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("coreversmultipkg", CoreversmultipkgIdSyntaxRule, - pkgVersion, level, version, "The id on the <" + getElementName() + "> is " - "'" + mId + "', which does not conform to the syntax.", getLine(), - getColumn()); - } - } - else - { - if (log) - { - std::string message = "Coreversmultipkg attribute 'id' is missing from " - "the element."; - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // att1 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt1 = attributes.readInto("att1", mAtt1); - - if (mIsSetAtt1 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, - version); - } - } - - // - // att2 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt2 = attributes.readInto("att2", mAtt2); - - if (mIsSetAtt2 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAtt2MustBeBoolean, pkgVersion, level, - version); - } - } - - // - // attDbl double (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAttDbl = attributes.readInto("attDbl", mAttDbl); - - if ( mIsSetAttDbl == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Coreversmultipkg attribute 'attDbl' from the " - " element must be an integer."; - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAttDblMustBeDouble, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOneTwo::readL3V2V2Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - unsigned int numErrs; - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("coreversmultipkg", CoreversmultipkgIdSyntaxRule, - pkgVersion, level, version, "The id on the <" + getElementName() + "> is " - "'" + mId + "', which does not conform to the syntax.", getLine(), - getColumn()); - } - } - else - { - if (log) - { - std::string message = "Coreversmultipkg attribute 'id' is missing from " - "the element."; - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // att1 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt1 = attributes.readInto("att1", mAtt1); - - if (mIsSetAtt1 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, - version); - } - } - - // - // att2 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt2 = attributes.readInto("att2", mAtt2); - - if (mIsSetAtt2 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAtt2MustBeBoolean, pkgVersion, level, - version); - } - } - - // - // attInt int (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAttInt = attributes.readInto("attInt", mAttInt); - - if ( mIsSetAttInt == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Coreversmultipkg attribute 'attInt' from the " - " element must be an integer."; - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAttIntMustBeInteger, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassOneTwo::readL4V1V1Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - unsigned int numErrs; - - // - // att1 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt1 = attributes.readInto("att1", mAtt1); - - if (mIsSetAtt1 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, - version); - } - } - - // - // att2 bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetAtt2 = attributes.readInto("att2", mAtt2); - - if (mIsSetAtt2 == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAtt2MustBeBoolean, pkgVersion, level, - version); - } - } - - // - // attUnit UnitSId (use = "optional" ) - // - - assigned = attributes.readInto("attUnit", mAttUnit); - - if (assigned == true) - { - if (mAttUnit.empty() == true) - { - logEmptyString(mAttUnit, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mAttUnit) == false) - { - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAttUnitMustBeUnitSId, pkgVersion, level, - version, "The attribute attUnit='" + mAttUnit + "' does not conform to " - "the syntax.", getLine(), getColumn()); - } - } - - // - // attEnum enum (use = "required" ) - // - - std::string attEnum; - assigned = attributes.readInto("attEnum", attEnum); - - if (assigned == true) - { - if (attEnum.empty() == true) - { - logEmptyString(attEnum, level, version, ""); - } - else - { - mAttEnum = AbcType_fromString(attEnum.c_str()); - - if (log && AbcType_isValid(mAttEnum) == 0) - { - std::string msg = "The attEnum on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + attEnum + "', which is not a valid option."; - - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAttEnumMustBeAbcTypeEnum, pkgVersion, level, - version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Coreversmultipkg attribute 'attEnum' is missing."; - log->logPackageError("coreversmultipkg", - CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOneTwo::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && version == 1 && pkgVersion == 2) - { - writeL3V1V2Attributes(stream); - } - - if (level == 3 && version == 2 && pkgVersion == 1) - { - writeL3V2V1Attributes(stream); - } - - if (level == 3 && version == 2 && pkgVersion == 2) - { - writeL3V2V2Attributes(stream); - } - - if (level == 4 && version == 1 && pkgVersion == 1) - { - writeL4V1V1Attributes(stream); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOneTwo::writeL3V1V2Attributes(XMLOutputStream& stream) const -{ - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetAtt1() == true) - { - stream.writeAttribute("att1", getPrefix(), mAtt1); - } - - if (isSetAttStr() == true) - { - stream.writeAttribute("attStr", getPrefix(), mAttStr); - } - - if (isSetAttInt() == true) - { - stream.writeAttribute("attInt", getPrefix(), mAttInt); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOneTwo::writeL3V2V1Attributes(XMLOutputStream& stream) const -{ - if (isSetAtt1() == true) - { - stream.writeAttribute("att1", getPrefix(), mAtt1); - } - - if (isSetAtt2() == true) - { - stream.writeAttribute("att2", getPrefix(), mAtt2); - } - - if (isSetAttDbl() == true) - { - stream.writeAttribute("attDbl", getPrefix(), mAttDbl); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOneTwo::writeL3V2V2Attributes(XMLOutputStream& stream) const -{ - if (isSetAtt1() == true) - { - stream.writeAttribute("att1", getPrefix(), mAtt1); - } - - if (isSetAtt2() == true) - { - stream.writeAttribute("att2", getPrefix(), mAtt2); - } - - if (isSetAttInt() == true) - { - stream.writeAttribute("attInt", getPrefix(), mAttInt); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassOneTwo::writeL4V1V1Attributes(XMLOutputStream& stream) const -{ - if (isSetAtt1() == true) - { - stream.writeAttribute("att1", getPrefix(), mAtt1); - } - - if (isSetAtt2() == true) - { - stream.writeAttribute("att2", getPrefix(), mAtt2); - } - - if (isSetAttUnit() == true) - { - stream.writeAttribute("attUnit", getPrefix(), mAttUnit); - } - - if (isSetAttEnum() == true) - { - stream.writeAttribute("attEnum", getPrefix(), AbcType_toString(mAttEnum)); - } -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ClassOneTwo_t using the given SBML Level, Version and - * “coreversmultipkg” package version. - */ -LIBSBML_EXTERN -ClassOneTwo_t * -ClassOneTwo_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ClassOneTwo(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ClassOneTwo_t object. - */ -LIBSBML_EXTERN -ClassOneTwo_t* -ClassOneTwo_clone(const ClassOneTwo_t* cot) -{ - if (cot != NULL) - { - return static_cast(cot->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ClassOneTwo_t object. - */ -LIBSBML_EXTERN -void -ClassOneTwo_free(ClassOneTwo_t* cot) -{ - if (cot != NULL) - { - delete cot; - } -} - - -/* - * Returns the value of the "id" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getId(const ClassOneTwo_t * cot) -{ - if (cot == NULL) - { - return NULL; - } - - return cot->getId().empty() ? NULL : safe_strdup(cot->getId().c_str()); -} - - -/* - * Returns the value of the "att1" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_getAtt1(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->getAtt1()) : 0; -} - - -/* - * Returns the value of the "attStr" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getAttStr(const ClassOneTwo_t * cot) -{ - if (cot == NULL) - { - return NULL; - } - - return cot->getAttStr().empty() ? NULL : - safe_strdup(cot->getAttStr().c_str()); -} - - -/* - * Returns the value of the "attInt" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_getAttInt(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->getAttInt() : SBML_INT_MAX; -} - - -/* - * Returns the value of the "att2" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_getAtt2(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->getAtt2()) : 0; -} - - -/* - * Returns the value of the "attDbl" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -double -ClassOneTwo_getAttDbl(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->getAttDbl() : util_NaN(); -} - - -/* - * Returns the value of the "attUnit" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getAttUnit(const ClassOneTwo_t * cot) -{ - if (cot == NULL) - { - return NULL; - } - - return cot->getAttUnit().empty() ? NULL : - safe_strdup(cot->getAttUnit().c_str()); -} - - -/* - * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -AbcType_t -ClassOneTwo_getAttEnum(const ClassOneTwo_t * cot) -{ - if (cot == NULL) - { - return OBJECTIVE_TYPE_INVALID; - } - - return cot->getAttEnum(); -} - - -/* - * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getAttEnumAsString(const ClassOneTwo_t * cot) -{ - return (char*)(AbcType_toString(cot->getAttEnum())); -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "id" attribute is - * set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetId(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att1" attribute is - * set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAtt1(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetAtt1()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attStr" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttStr(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetAttStr()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attInt" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttInt(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetAttInt()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att2" attribute is - * set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAtt2(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetAtt2()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attDbl" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttDbl(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetAttDbl()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attUnit" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttUnit(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetAttUnit()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attEnum" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttEnum(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->isSetAttEnum()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setId(ClassOneTwo_t * cot, const char * id) -{ - return (cot != NULL) ? cot->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "att1" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAtt1(ClassOneTwo_t * cot, int att1) -{ - return (cot != NULL) ? cot->setAtt1(att1) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "attStr" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttStr(ClassOneTwo_t * cot, const char * attStr) -{ - return (cot != NULL) ? cot->setAttStr(attStr) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "attInt" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttInt(ClassOneTwo_t * cot, int attInt) -{ - return (cot != NULL) ? cot->setAttInt(attInt) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "att2" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAtt2(ClassOneTwo_t * cot, int att2) -{ - return (cot != NULL) ? cot->setAtt2(att2) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "attDbl" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttDbl(ClassOneTwo_t * cot, double attDbl) -{ - return (cot != NULL) ? cot->setAttDbl(attDbl) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "attUnit" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttUnit(ClassOneTwo_t * cot, const char * attUnit) -{ - return (cot != NULL) ? cot->setAttUnit(attUnit) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttEnum(ClassOneTwo_t * cot, AbcType_t attEnum) -{ - return (cot != NULL) ? cot->setAttEnum(attEnum) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttEnumAsString(ClassOneTwo_t * cot, const char * attEnum) -{ - return (cot != NULL) ? cot->setAttEnum(attEnum): LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetId(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "att1" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAtt1(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetAtt1() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "attStr" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttStr(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetAttStr() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "attInt" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttInt(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetAttInt() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "att2" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAtt2(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetAtt2() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "attDbl" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttDbl(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetAttDbl() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "attUnit" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttUnit(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetAttUnit() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "attEnum" attribute of this ClassOneTwo_t. - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttEnum(ClassOneTwo_t * cot) -{ - return (cot != NULL) ? cot->unsetAttEnum() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassOneTwo_t object have been set. - */ -LIBSBML_EXTERN -int -ClassOneTwo_hasRequiredAttributes(const ClassOneTwo_t * cot) -{ - return (cot != NULL) ? static_cast(cot->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ClassOneTwo.cpp + * @brief Implementation of the ClassOneTwo class. + * @author SBMLTeam + * + * + */ +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ClassOneTwo using the given SBML Level, Version and + * “coreversmultipkg” package version. + */ +ClassOneTwo::ClassOneTwo(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mAtt1 (false) + , mIsSetAtt1 (false) + , mAttStr ("") + , mAttInt (SBML_INT_MAX) + , mIsSetAttInt (false) + , mAtt2 (false) + , mIsSetAtt2 (false) + , mAttDbl (util_NaN()) + , mIsSetAttDbl (false) + , mAttUnit ("") + , mAttEnum (OBJECTIVE_TYPE_INVALID) +{ + setSBMLNamespacesAndOwn(new CoreversmultipkgPkgNamespaces(level, version, + pkgVersion)); +} + + +/* + * Creates a new ClassOneTwo using the given CoreversmultipkgPkgNamespaces + * object. + */ +ClassOneTwo::ClassOneTwo(CoreversmultipkgPkgNamespaces *coreversmultipkgns) + : SBase(coreversmultipkgns) + , mAtt1 (false) + , mIsSetAtt1 (false) + , mAttStr ("") + , mAttInt (SBML_INT_MAX) + , mIsSetAttInt (false) + , mAtt2 (false) + , mIsSetAtt2 (false) + , mAttDbl (util_NaN()) + , mIsSetAttDbl (false) + , mAttUnit ("") + , mAttEnum (OBJECTIVE_TYPE_INVALID) +{ + setElementNamespace(coreversmultipkgns->getURI()); + loadPlugins(coreversmultipkgns); +} + + +/* + * Copy constructor for ClassOneTwo. + */ +ClassOneTwo::ClassOneTwo(const ClassOneTwo& orig) + : SBase( orig ) + , mAtt1 ( orig.mAtt1 ) + , mIsSetAtt1 ( orig.mIsSetAtt1 ) + , mAttStr ( orig.mAttStr ) + , mAttInt ( orig.mAttInt ) + , mIsSetAttInt ( orig.mIsSetAttInt ) + , mAtt2 ( orig.mAtt2 ) + , mIsSetAtt2 ( orig.mIsSetAtt2 ) + , mAttDbl ( orig.mAttDbl ) + , mIsSetAttDbl ( orig.mIsSetAttDbl ) + , mAttUnit ( orig.mAttUnit ) + , mAttEnum ( orig.mAttEnum ) +{ +} + + +/* + * Assignment operator for ClassOneTwo. + */ +ClassOneTwo& +ClassOneTwo::operator=(const ClassOneTwo& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mAtt1 = rhs.mAtt1; + mIsSetAtt1 = rhs.mIsSetAtt1; + mAttStr = rhs.mAttStr; + mAttInt = rhs.mAttInt; + mIsSetAttInt = rhs.mIsSetAttInt; + mAtt2 = rhs.mAtt2; + mIsSetAtt2 = rhs.mIsSetAtt2; + mAttDbl = rhs.mAttDbl; + mIsSetAttDbl = rhs.mIsSetAttDbl; + mAttUnit = rhs.mAttUnit; + mAttEnum = rhs.mAttEnum; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ClassOneTwo object. + */ +ClassOneTwo* +ClassOneTwo::clone() const +{ + return new ClassOneTwo(*this); +} + + +/* + * Destructor for ClassOneTwo. + */ +ClassOneTwo::~ClassOneTwo() +{ +} + + +/* + * Returns the value of the "id" attribute of this ClassOneTwo. + */ +const std::string& +ClassOneTwo::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "att1" attribute of this ClassOneTwo. + */ +bool +ClassOneTwo::getAtt1() const +{ + return mAtt1; +} + + +/* + * Returns the value of the "attStr" attribute of this ClassOneTwo. + */ +const std::string& +ClassOneTwo::getAttStr() const +{ + return mAttStr; +} + + +/* + * Returns the value of the "attInt" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::getAttInt() const +{ + return mAttInt; +} + + +/* + * Returns the value of the "att2" attribute of this ClassOneTwo. + */ +bool +ClassOneTwo::getAtt2() const +{ + return mAtt2; +} + + +/* + * Returns the value of the "attDbl" attribute of this ClassOneTwo. + */ +double +ClassOneTwo::getAttDbl() const +{ + return mAttDbl; +} + + +/* + * Returns the value of the "attUnit" attribute of this ClassOneTwo. + */ +const std::string& +ClassOneTwo::getAttUnit() const +{ + return mAttUnit; +} + + +/* + * Returns the value of the "attEnum" attribute of this ClassOneTwo. + */ +AbcType_t +ClassOneTwo::getAttEnum() const +{ + return mAttEnum; +} + + +/* + * Returns the value of the "attEnum" attribute of this ClassOneTwo. + */ +std::string +ClassOneTwo::getAttEnumAsString() const +{ + std::string code_str = AbcType_toString(mAttEnum); + return code_str; +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "id" attribute is set. + */ +bool +ClassOneTwo::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "att1" attribute is set. + */ +bool +ClassOneTwo::isSetAtt1() const +{ + return mIsSetAtt1; +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "attStr" attribute is set. + */ +bool +ClassOneTwo::isSetAttStr() const +{ + return (mAttStr.empty() == false); +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "attInt" attribute is set. + */ +bool +ClassOneTwo::isSetAttInt() const +{ + return mIsSetAttInt; +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "att2" attribute is set. + */ +bool +ClassOneTwo::isSetAtt2() const +{ + return mIsSetAtt2; +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "attDbl" attribute is set. + */ +bool +ClassOneTwo::isSetAttDbl() const +{ + return mIsSetAttDbl; +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "attUnit" attribute is + * set. + */ +bool +ClassOneTwo::isSetAttUnit() const +{ + return (mAttUnit.empty() == false); +} + + +/* + * Predicate returning @c true if this ClassOneTwo's "attEnum" attribute is + * set. + */ +bool +ClassOneTwo::isSetAttEnum() const +{ + return (mAttEnum != OBJECTIVE_TYPE_INVALID); +} + + +/* + * Sets the value of the "id" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setId(const std::string& id) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if ((coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) || (coreLevel == + 3 && coreVersion == 2 && pkgVersion == 1) || (coreLevel == 3 && coreVersion + == 2 && pkgVersion == 2)) + { + return SyntaxChecker::checkAndSetSId(id, mId); + } + else + { + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "att1" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAtt1(bool att1) +{ + mAtt1 = att1; + mIsSetAtt1 = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "attStr" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttStr(const std::string& attStr) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) + { + mAttStr = attStr; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "attInt" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttInt(int attInt) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if ((coreLevel == 3 && coreVersion == 1 && pkgVersion == 2) || (coreLevel == + 3 && coreVersion == 2 && pkgVersion == 2)) + { + mAttInt = attInt; + mIsSetAttInt = true; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + mAttInt = attInt; + mIsSetAttInt = false; + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "att2" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAtt2(bool att2) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if ((coreLevel == 3 && coreVersion == 2 && pkgVersion == 1) || (coreLevel == + 3 && coreVersion == 2 && pkgVersion == 2) || (coreLevel == 4 && coreVersion + == 1 && pkgVersion == 1)) + { + mAtt2 = att2; + mIsSetAtt2 = true; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + mAtt2 = att2; + mIsSetAtt2 = false; + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "attDbl" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttDbl(double attDbl) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (coreLevel == 3 && coreVersion == 2 && pkgVersion == 1) + { + mAttDbl = attDbl; + mIsSetAttDbl = true; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + mAttDbl = attDbl; + mIsSetAttDbl = false; + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "attUnit" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttUnit(const std::string& attUnit) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (coreLevel == 4 && coreVersion == 1 && pkgVersion == 1) + { + if (!(SyntaxChecker::isValidInternalUnitSId(attUnit))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mAttUnit = attUnit; + return LIBSBML_OPERATION_SUCCESS; + } + } + else + { + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "attEnum" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttEnum(const AbcType_t attEnum) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (coreLevel == 4 && coreVersion == 1 && pkgVersion == 1) + { + if (AbcType_isValid(attEnum) == 0) + { + mAttEnum = OBJECTIVE_TYPE_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mAttEnum = attEnum; + return LIBSBML_OPERATION_SUCCESS; + } + } + else + { + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Sets the value of the "attEnum" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttEnum(const std::string& attEnum) +{ + unsigned int coreLevel = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (coreLevel == 4 && coreVersion == 1 && pkgVersion == 1) + { + mAttEnum = AbcType_fromString(attEnum.c_str()); + + if (mAttEnum == OBJECTIVE_TYPE_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_UNEXPECTED_ATTRIBUTE; + } +} + + +/* + * Unsets the value of the "id" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "att1" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAtt1() +{ + mAtt1 = false; + mIsSetAtt1 = false; + + if (isSetAtt1() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "attStr" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAttStr() +{ + mAttStr.erase(); + + if (mAttStr.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "attInt" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAttInt() +{ + mAttInt = SBML_INT_MAX; + mIsSetAttInt = false; + + if (isSetAttInt() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "att2" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAtt2() +{ + mAtt2 = false; + mIsSetAtt2 = false; + + if (isSetAtt2() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "attDbl" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAttDbl() +{ + mAttDbl = util_NaN(); + mIsSetAttDbl = false; + + if (isSetAttDbl() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "attUnit" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAttUnit() +{ + mAttUnit.erase(); + + if (mAttUnit.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "attEnum" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAttEnum() +{ + mAttEnum = OBJECTIVE_TYPE_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this ClassOneTwo object. + */ +const std::string& +ClassOneTwo::getElementName() const +{ + static const string name = "classOneTwo"; + return name; +} + + +/* + * Returns the libSBML type code for this ClassOneTwo object. + */ +int +ClassOneTwo::getTypeCode() const +{ + return SBML_COREVERS_CLASSONETWO; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * ClassOneTwo object have been set. + */ +bool +ClassOneTwo::hasRequiredAttributes() const +{ + bool allPresent = true; + + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if ((level == 3 && version == 1 && pkgVersion == 2) || (level == 3 && version + == 2 && pkgVersion == 1) || (level == 3 && version == 2 && pkgVersion == 2)) + { + if (isSetId() == false) + { + allPresent = false; + } + } + + if (level == 4 && version == 1 && pkgVersion == 1) + { + if (isSetAttEnum() == false) + { + allPresent = false; + } + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ClassOneTwo::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ClassOneTwo::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ClassOneTwo::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ClassOneTwo::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "att1") + { + value = getAtt1(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "att2") + { + value = getAtt2(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "attInt") + { + value = getAttInt(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "attDbl") + { + value = getAttDbl(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "attStr") + { + value = getAttStr(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "attUnit") + { + value = getAttUnit(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "attEnum") + { + value = getAttEnumAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ClassOneTwo's attribute "attributeName" + * is set. + */ +bool +ClassOneTwo::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "att1") + { + value = isSetAtt1(); + } + else if (attributeName == "attStr") + { + value = isSetAttStr(); + } + else if (attributeName == "attInt") + { + value = isSetAttInt(); + } + else if (attributeName == "att2") + { + value = isSetAtt2(); + } + else if (attributeName == "attDbl") + { + value = isSetAttDbl(); + } + else if (attributeName == "attUnit") + { + value = isSetAttUnit(); + } + else if (attributeName == "attEnum") + { + value = isSetAttEnum(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "att1") + { + return_value = setAtt1(value); + } + else if (attributeName == "att2") + { + return_value = setAtt2(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "attInt") + { + return_value = setAttInt(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "attDbl") + { + return_value = setAttDbl(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "attStr") + { + return_value = setAttStr(value); + } + else if (attributeName == "attUnit") + { + return_value = setAttUnit(value); + } + else if (attributeName == "attEnum") + { + return_value = setAttEnum(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this ClassOneTwo. + */ +int +ClassOneTwo::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "att1") + { + value = unsetAtt1(); + } + else if (attributeName == "attStr") + { + value = unsetAttStr(); + } + else if (attributeName == "attInt") + { + value = unsetAttInt(); + } + else if (attributeName == "att2") + { + value = unsetAtt2(); + } + else if (attributeName == "attDbl") + { + value = unsetAttDbl(); + } + else if (attributeName == "attUnit") + { + value = unsetAttUnit(); + } + else if (attributeName == "attEnum") + { + value = unsetAttEnum(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +ClassOneTwo::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + unsigned int level = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && coreVersion == 1 && pkgVersion == 2) + { + attributes.add("id"); + attributes.add("att1"); + attributes.add("attStr"); + attributes.add("attInt"); + } + + if (level == 3 && coreVersion == 2 && pkgVersion == 1) + { + attributes.add("att1"); + attributes.add("att2"); + attributes.add("attDbl"); + } + + if (level == 3 && coreVersion == 2 && pkgVersion == 2) + { + attributes.add("att1"); + attributes.add("att2"); + attributes.add("attInt"); + } + + if (level == 4 && coreVersion == 1 && pkgVersion == 1) + { + attributes.add("att1"); + attributes.add("att2"); + attributes.add("attUnit"); + attributes.add("attEnum"); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOneTwo::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + if (level == 3 && version == 1 && pkgVersion == 2) + { + readL3V1V2Attributes(attributes); + } + + if (level == 3 && version == 2 && pkgVersion == 1) + { + readL3V2V1Attributes(attributes); + } + + if (level == 3 && version == 2 && pkgVersion == 2) + { + readL3V2V2Attributes(attributes); + } + + if (level == 4 && version == 1 && pkgVersion == 1) + { + readL4V1V1Attributes(attributes); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOneTwo::readL3V1V2Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + unsigned int numErrs; + + // + // id SId (use = "required" ) + // + + XMLTriple tripleID("id", mURI, getPrefix()); + assigned = attributes.readInto(tripleID, mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("coreversmultipkg", CoreversmultipkgIdSyntaxRule, + pkgVersion, level, version, "The id on the <" + getElementName() + "> is " + "'" + mId + "', which does not conform to the syntax.", getLine(), + getColumn()); + } + } + else + { + if (log) + { + std::string message = "Coreversmultipkg attribute 'id' is missing from " + "the element."; + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // att1 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt1 = attributes.readInto("att1", mAtt1); + + if (mIsSetAtt1 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, + version); + } + } + + // + // attStr string (use = "optional" ) + // + + assigned = attributes.readInto("attStr", mAttStr); + + if (assigned == true) + { + if (mAttStr.empty() == true) + { + logEmptyString(mAttStr, level, version, ""); + } + } + + // + // attInt int (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAttInt = attributes.readInto("attInt", mAttInt); + + if ( mIsSetAttInt == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Coreversmultipkg attribute 'attInt' from the " + " element must be an integer."; + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAttIntMustBeInteger, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOneTwo::readL3V2V1Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + unsigned int numErrs; + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("coreversmultipkg", CoreversmultipkgIdSyntaxRule, + pkgVersion, level, version, "The id on the <" + getElementName() + "> is " + "'" + mId + "', which does not conform to the syntax.", getLine(), + getColumn()); + } + } + else + { + if (log) + { + std::string message = "Coreversmultipkg attribute 'id' is missing from " + "the element."; + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // att1 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt1 = attributes.readInto("att1", mAtt1); + + if (mIsSetAtt1 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, + version); + } + } + + // + // att2 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt2 = attributes.readInto("att2", mAtt2); + + if (mIsSetAtt2 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAtt2MustBeBoolean, pkgVersion, level, + version); + } + } + + // + // attDbl double (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAttDbl = attributes.readInto("attDbl", mAttDbl); + + if ( mIsSetAttDbl == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Coreversmultipkg attribute 'attDbl' from the " + " element must be an integer."; + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAttDblMustBeDouble, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOneTwo::readL3V2V2Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + unsigned int numErrs; + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("coreversmultipkg", CoreversmultipkgIdSyntaxRule, + pkgVersion, level, version, "The id on the <" + getElementName() + "> is " + "'" + mId + "', which does not conform to the syntax.", getLine(), + getColumn()); + } + } + else + { + if (log) + { + std::string message = "Coreversmultipkg attribute 'id' is missing from " + "the element."; + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // att1 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt1 = attributes.readInto("att1", mAtt1); + + if (mIsSetAtt1 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, + version); + } + } + + // + // att2 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt2 = attributes.readInto("att2", mAtt2); + + if (mIsSetAtt2 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAtt2MustBeBoolean, pkgVersion, level, + version); + } + } + + // + // attInt int (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAttInt = attributes.readInto("attInt", mAttInt); + + if ( mIsSetAttInt == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Coreversmultipkg attribute 'attInt' from the " + " element must be an integer."; + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAttIntMustBeInteger, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassOneTwo::readL4V1V1Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + unsigned int numErrs; + + // + // att1 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt1 = attributes.readInto("att1", mAtt1); + + if (mIsSetAtt1 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAtt1MustBeBoolean, pkgVersion, level, + version); + } + } + + // + // att2 bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetAtt2 = attributes.readInto("att2", mAtt2); + + if (mIsSetAtt2 == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAtt2MustBeBoolean, pkgVersion, level, + version); + } + } + + // + // attUnit UnitSId (use = "optional" ) + // + + assigned = attributes.readInto("attUnit", mAttUnit); + + if (assigned == true) + { + if (mAttUnit.empty() == true) + { + logEmptyString(mAttUnit, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mAttUnit) == false) + { + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAttUnitMustBeUnitSId, pkgVersion, level, + version, "The attribute attUnit='" + mAttUnit + "' does not conform to " + "the syntax.", getLine(), getColumn()); + } + } + + // + // attEnum enum (use = "required" ) + // + + std::string attEnum; + assigned = attributes.readInto("attEnum", attEnum); + + if (assigned == true) + { + if (attEnum.empty() == true) + { + logEmptyString(attEnum, level, version, ""); + } + else + { + mAttEnum = AbcType_fromString(attEnum.c_str()); + + if (log && AbcType_isValid(mAttEnum) == 0) + { + std::string msg = "The attEnum on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + attEnum + "', which is not a valid option."; + + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAttEnumMustBeAbcTypeEnum, pkgVersion, level, + version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Coreversmultipkg attribute 'attEnum' is missing."; + log->logPackageError("coreversmultipkg", + CoreversmultipkgClassOneTwoAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOneTwo::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && version == 1 && pkgVersion == 2) + { + writeL3V1V2Attributes(stream); + } + + if (level == 3 && version == 2 && pkgVersion == 1) + { + writeL3V2V1Attributes(stream); + } + + if (level == 3 && version == 2 && pkgVersion == 2) + { + writeL3V2V2Attributes(stream); + } + + if (level == 4 && version == 1 && pkgVersion == 1) + { + writeL4V1V1Attributes(stream); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOneTwo::writeL3V1V2Attributes(XMLOutputStream& stream) const +{ + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetAtt1() == true) + { + stream.writeAttribute("att1", getPrefix(), mAtt1); + } + + if (isSetAttStr() == true) + { + stream.writeAttribute("attStr", getPrefix(), mAttStr); + } + + if (isSetAttInt() == true) + { + stream.writeAttribute("attInt", getPrefix(), mAttInt); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOneTwo::writeL3V2V1Attributes(XMLOutputStream& stream) const +{ + if (isSetAtt1() == true) + { + stream.writeAttribute("att1", getPrefix(), mAtt1); + } + + if (isSetAtt2() == true) + { + stream.writeAttribute("att2", getPrefix(), mAtt2); + } + + if (isSetAttDbl() == true) + { + stream.writeAttribute("attDbl", getPrefix(), mAttDbl); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOneTwo::writeL3V2V2Attributes(XMLOutputStream& stream) const +{ + if (isSetAtt1() == true) + { + stream.writeAttribute("att1", getPrefix(), mAtt1); + } + + if (isSetAtt2() == true) + { + stream.writeAttribute("att2", getPrefix(), mAtt2); + } + + if (isSetAttInt() == true) + { + stream.writeAttribute("attInt", getPrefix(), mAttInt); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassOneTwo::writeL4V1V1Attributes(XMLOutputStream& stream) const +{ + if (isSetAtt1() == true) + { + stream.writeAttribute("att1", getPrefix(), mAtt1); + } + + if (isSetAtt2() == true) + { + stream.writeAttribute("att2", getPrefix(), mAtt2); + } + + if (isSetAttUnit() == true) + { + stream.writeAttribute("attUnit", getPrefix(), mAttUnit); + } + + if (isSetAttEnum() == true) + { + stream.writeAttribute("attEnum", getPrefix(), AbcType_toString(mAttEnum)); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ClassOneTwo_t using the given SBML Level, Version and + * “coreversmultipkg” package version. + */ +LIBSBML_EXTERN +ClassOneTwo_t * +ClassOneTwo_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ClassOneTwo(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ClassOneTwo_t object. + */ +LIBSBML_EXTERN +ClassOneTwo_t* +ClassOneTwo_clone(const ClassOneTwo_t* cot) +{ + if (cot != NULL) + { + return static_cast(cot->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ClassOneTwo_t object. + */ +LIBSBML_EXTERN +void +ClassOneTwo_free(ClassOneTwo_t* cot) +{ + if (cot != NULL) + { + delete cot; + } +} + + +/* + * Returns the value of the "id" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getId(const ClassOneTwo_t * cot) +{ + if (cot == NULL) + { + return NULL; + } + + return cot->getId().empty() ? NULL : safe_strdup(cot->getId().c_str()); +} + + +/* + * Returns the value of the "att1" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_getAtt1(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->getAtt1()) : 0; +} + + +/* + * Returns the value of the "attStr" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getAttStr(const ClassOneTwo_t * cot) +{ + if (cot == NULL) + { + return NULL; + } + + return cot->getAttStr().empty() ? NULL : + safe_strdup(cot->getAttStr().c_str()); +} + + +/* + * Returns the value of the "attInt" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_getAttInt(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->getAttInt() : SBML_INT_MAX; +} + + +/* + * Returns the value of the "att2" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_getAtt2(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->getAtt2()) : 0; +} + + +/* + * Returns the value of the "attDbl" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +double +ClassOneTwo_getAttDbl(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->getAttDbl() : util_NaN(); +} + + +/* + * Returns the value of the "attUnit" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getAttUnit(const ClassOneTwo_t * cot) +{ + if (cot == NULL) + { + return NULL; + } + + return cot->getAttUnit().empty() ? NULL : + safe_strdup(cot->getAttUnit().c_str()); +} + + +/* + * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +AbcType_t +ClassOneTwo_getAttEnum(const ClassOneTwo_t * cot) +{ + if (cot == NULL) + { + return OBJECTIVE_TYPE_INVALID; + } + + return cot->getAttEnum(); +} + + +/* + * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getAttEnumAsString(const ClassOneTwo_t * cot) +{ + return (char*)(AbcType_toString(cot->getAttEnum())); +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "id" attribute is + * set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetId(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att1" attribute is + * set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAtt1(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetAtt1()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attStr" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttStr(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetAttStr()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attInt" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttInt(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetAttInt()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att2" attribute is + * set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAtt2(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetAtt2()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attDbl" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttDbl(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetAttDbl()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attUnit" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttUnit(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetAttUnit()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attEnum" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttEnum(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->isSetAttEnum()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setId(ClassOneTwo_t * cot, const char * id) +{ + return (cot != NULL) ? cot->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "att1" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAtt1(ClassOneTwo_t * cot, int att1) +{ + return (cot != NULL) ? cot->setAtt1(att1) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "attStr" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttStr(ClassOneTwo_t * cot, const char * attStr) +{ + return (cot != NULL) ? cot->setAttStr(attStr) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "attInt" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttInt(ClassOneTwo_t * cot, int attInt) +{ + return (cot != NULL) ? cot->setAttInt(attInt) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "att2" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAtt2(ClassOneTwo_t * cot, int att2) +{ + return (cot != NULL) ? cot->setAtt2(att2) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "attDbl" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttDbl(ClassOneTwo_t * cot, double attDbl) +{ + return (cot != NULL) ? cot->setAttDbl(attDbl) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "attUnit" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttUnit(ClassOneTwo_t * cot, const char * attUnit) +{ + return (cot != NULL) ? cot->setAttUnit(attUnit) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttEnum(ClassOneTwo_t * cot, AbcType_t attEnum) +{ + return (cot != NULL) ? cot->setAttEnum(attEnum) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttEnumAsString(ClassOneTwo_t * cot, const char * attEnum) +{ + return (cot != NULL) ? cot->setAttEnum(attEnum): LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetId(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "att1" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAtt1(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetAtt1() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "attStr" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttStr(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetAttStr() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "attInt" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttInt(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetAttInt() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "att2" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAtt2(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetAtt2() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "attDbl" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttDbl(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetAttDbl() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "attUnit" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttUnit(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetAttUnit() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "attEnum" attribute of this ClassOneTwo_t. + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttEnum(ClassOneTwo_t * cot) +{ + return (cot != NULL) ? cot->unsetAttEnum() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassOneTwo_t object have been set. + */ +LIBSBML_EXTERN +int +ClassOneTwo_hasRequiredAttributes(const ClassOneTwo_t * cot) +{ + return (cot != NULL) ? static_cast(cot->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ClassOneTwo.h b/generator/tests/test_cpp_code/test-code/ClassOneTwo.h index 99df34ca..d801c10b 100644 --- a/generator/tests/test_cpp_code/test-code/ClassOneTwo.h +++ b/generator/tests/test_cpp_code/test-code/ClassOneTwo.h @@ -1,1734 +1,1734 @@ -/** - * @file ClassOneTwo.h - * @brief Definition of the ClassOneTwo class. - * @author SBMLTeam - * - * - * - * @class ClassOneTwo - * @sbmlbrief{coreversmultipkg} TODO:Definition of the ClassOneTwo class. - */ - -/** - * - * - * - * @class doc_classonetwo_attEnum - * - * @par - * The attribute "attEnum" on a ClassOneTwo object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Coreversmultipkg specification, the following - * are the - * allowable values for "attEnum": - *
    - *
  • @c "maximize", TODO:add description - * - *
  • @c "minimize", TODO:add description - * - *
- */ - - -#ifndef ClassOneTwo_H__ -#define ClassOneTwo_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ClassOneTwo : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - bool mAtt1; - bool mIsSetAtt1; - std::string mAttStr; - int mAttInt; - bool mIsSetAttInt; - bool mAtt2; - bool mIsSetAtt2; - double mAttDbl; - bool mIsSetAttDbl; - std::string mAttUnit; - AbcType_t mAttEnum; - - /** @endcond */ - -public: - - /** - * Creates a new ClassOneTwo using the given SBML Level, Version and - * “coreversmultipkg” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ClassOneTwo. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassOneTwo. - * - * @param pkgVersion an unsigned int, the SBML Coreversmultipkg Version to - * assign to this ClassOneTwo. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassOneTwo(unsigned int level = - CoreversmultipkgExtension::getDefaultLevel(), - unsigned int version = - CoreversmultipkgExtension::getDefaultVersion(), - unsigned int pkgVersion = - CoreversmultipkgExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ClassOneTwo using the given CoreversmultipkgPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param coreversmultipkgns the CoreversmultipkgPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassOneTwo(CoreversmultipkgPkgNamespaces *coreversmultipkgns); - - - /** - * Copy constructor for ClassOneTwo. - * - * @param orig the ClassOneTwo instance to copy. - */ - ClassOneTwo(const ClassOneTwo& orig); - - - /** - * Assignment operator for ClassOneTwo. - * - * @param rhs the ClassOneTwo object whose values are to be used as the basis - * of the assignment. - */ - ClassOneTwo& operator=(const ClassOneTwo& rhs); - - - /** - * Creates and returns a deep copy of this ClassOneTwo object. - * - * @return a (deep) copy of this ClassOneTwo object. - */ - virtual ClassOneTwo* clone() const; - - - /** - * Destructor for ClassOneTwo. - */ - virtual ~ClassOneTwo(); - - - /** - * Returns the value of the "id" attribute of this ClassOneTwo. - * - * @return the value of the "id" attribute of this ClassOneTwo as a string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "att1" attribute of this ClassOneTwo. - * - * @return the value of the "att1" attribute of this ClassOneTwo as a - * boolean. - */ - bool getAtt1() const; - - - /** - * Returns the value of the "attStr" attribute of this ClassOneTwo. - * - * @return the value of the "attStr" attribute of this ClassOneTwo as a - * string. - */ - const std::string& getAttStr() const; - - - /** - * Returns the value of the "attInt" attribute of this ClassOneTwo. - * - * @return the value of the "attInt" attribute of this ClassOneTwo as a - * integer. - */ - int getAttInt() const; - - - /** - * Returns the value of the "att2" attribute of this ClassOneTwo. - * - * @return the value of the "att2" attribute of this ClassOneTwo as a - * boolean. - */ - bool getAtt2() const; - - - /** - * Returns the value of the "attDbl" attribute of this ClassOneTwo. - * - * @return the value of the "attDbl" attribute of this ClassOneTwo as a - * double. - */ - double getAttDbl() const; - - - /** - * Returns the value of the "attUnit" attribute of this ClassOneTwo. - * - * @return the value of the "attUnit" attribute of this ClassOneTwo as a - * string. - */ - const std::string& getAttUnit() const; - - - /** - * Returns the value of the "attEnum" attribute of this ClassOneTwo. - * - * @return the value of the "attEnum" attribute of this ClassOneTwo as a - * AbcType_t. - * - * @copydetails doc_classonetwo_attEnum - * @if clike The value is drawn from the enumeration @ref AbcType_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{OBJECTIVE_TYPE_MAXIMIZE, AbcType_t} - * @li @sbmlconstant{OBJECTIVE_TYPE_MINIMIZE, AbcType_t} - * @li @sbmlconstant{OBJECTIVE_TYPE_INVALID, AbcType_t} - */ - AbcType_t getAttEnum() const; - - - /** - * Returns the value of the "attEnum" attribute of this ClassOneTwo. - * - * @return the value of the "attEnum" attribute of this ClassOneTwo as a - * string. - * - * @copydetails doc_classonetwo_attEnum - * The possible values returned by this method are: - * @li @c "maximize" - * @li @c "minimize" - * @li @c "invalid AbcType value" - */ - std::string getAttEnumAsString() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "id" attribute is set. - * - * @return @c true if this ClassOneTwo's "id" attribute has been set, - * otherwise @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "att1" attribute is set. - * - * @return @c true if this ClassOneTwo's "att1" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAtt1() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "attStr" attribute is - * set. - * - * @return @c true if this ClassOneTwo's "attStr" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAttStr() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "attInt" attribute is - * set. - * - * @return @c true if this ClassOneTwo's "attInt" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAttInt() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "att2" attribute is set. - * - * @return @c true if this ClassOneTwo's "att2" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAtt2() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "attDbl" attribute is - * set. - * - * @return @c true if this ClassOneTwo's "attDbl" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAttDbl() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "attUnit" attribute is - * set. - * - * @return @c true if this ClassOneTwo's "attUnit" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetAttUnit() const; - - - /** - * Predicate returning @c true if this ClassOneTwo's "attEnum" attribute is - * set. - * - * @return @c true if this ClassOneTwo's "attEnum" attribute has been set, - * otherwise @c false is returned. - * - * @copydetails doc_classonetwo_attEnum - */ - bool isSetAttEnum() const; - - - /** - * Sets the value of the "id" attribute of this ClassOneTwo. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "att1" attribute of this ClassOneTwo. - * - * @param att1 bool value of the "att1" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAtt1(bool att1); - - - /** - * Sets the value of the "attStr" attribute of this ClassOneTwo. - * - * @param attStr std::string& value of the "attStr" attribute to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p attStr = @c NULL or an empty string is - * equivalent to calling unsetAttStr(). - */ - int setAttStr(const std::string& attStr); - - - /** - * Sets the value of the "attInt" attribute of this ClassOneTwo. - * - * @param attInt int value of the "attInt" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAttInt(int attInt); - - - /** - * Sets the value of the "att2" attribute of this ClassOneTwo. - * - * @param att2 bool value of the "att2" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAtt2(bool att2); - - - /** - * Sets the value of the "attDbl" attribute of this ClassOneTwo. - * - * @param attDbl double value of the "attDbl" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAttDbl(double attDbl); - - - /** - * Sets the value of the "attUnit" attribute of this ClassOneTwo. - * - * @param attUnit std::string& value of the "attUnit" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setAttUnit(const std::string& attUnit); - - - /** - * Sets the value of the "attEnum" attribute of this ClassOneTwo. - * - * @param attEnum @if clike AbcType_t@else int@endif value of the "attEnum" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classonetwo_attEnum - */ - int setAttEnum(const AbcType_t attEnum); - - - /** - * Sets the value of the "attEnum" attribute of this ClassOneTwo. - * - * @param attEnum std::string& of the "attEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classonetwo_attEnum - */ - int setAttEnum(const std::string& attEnum); - - - /** - * Unsets the value of the "id" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "att1" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAtt1(); - - - /** - * Unsets the value of the "attStr" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAttStr(); - - - /** - * Unsets the value of the "attInt" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAttInt(); - - - /** - * Unsets the value of the "att2" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAtt2(); - - - /** - * Unsets the value of the "attDbl" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAttDbl(); - - - /** - * Unsets the value of the "attUnit" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetAttUnit(); - - - /** - * Unsets the value of the "attEnum" attribute of this ClassOneTwo. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_classonetwo_attEnum - */ - int unsetAttEnum(); - - - /** - * Returns the XML element name of this ClassOneTwo object. - * - * For ClassOneTwo, the XML element name is always @c "classOneTwo". - * - * @return the name of this element, i.e. @c "classOneTwo". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ClassOneTwo object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_COREVERS_CLASSONETWO, SBMLCoreversmultipkgTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * ClassOneTwo object have been set. - * - * @return @c true to indicate that all the required attributes of this - * ClassOneTwo have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the ClassOneTwo object are: - * @li "id" - * @li "attEnum" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ClassOneTwo's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ClassOneTwo's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this ClassOneTwo. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V1V2Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V2V1Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V2V2Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL4V1V1Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V1V2Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V2V1Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V2V2Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL4V1V1Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ClassOneTwo_t using the given SBML Level, Version and - * “coreversmultipkg” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ClassOneTwo_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassOneTwo_t. - * - * @param pkgVersion an unsigned int, the SBML Coreversmultipkg Version to - * assign to this ClassOneTwo_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -ClassOneTwo_t * -ClassOneTwo_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ClassOneTwo_t object. - * - * @param cot the ClassOneTwo_t structure. - * - * @return a (deep) copy of this ClassOneTwo_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -ClassOneTwo_t* -ClassOneTwo_clone(const ClassOneTwo_t* cot); - - -/** - * Frees this ClassOneTwo_t object. - * - * @param cot the ClassOneTwo_t structure. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -void -ClassOneTwo_free(ClassOneTwo_t* cot); - - -/** - * Returns the value of the "id" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose id is sought. - * - * @return the value of the "id" attribute of this ClassOneTwo_t as a pointer - * to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getId(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "att1" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose att1 is sought. - * - * @return the value of the "att1" attribute of this ClassOneTwo_t as a - * boolean. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_getAtt1(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "attStr" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose attStr is sought. - * - * @return the value of the "attStr" attribute of this ClassOneTwo_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getAttStr(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "attInt" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose attInt is sought. - * - * @return the value of the "attInt" attribute of this ClassOneTwo_t as a - * integer. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_getAttInt(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "att2" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose att2 is sought. - * - * @return the value of the "att2" attribute of this ClassOneTwo_t as a - * boolean. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_getAtt2(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "attDbl" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose attDbl is sought. - * - * @return the value of the "attDbl" attribute of this ClassOneTwo_t as a - * double. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -double -ClassOneTwo_getAttDbl(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "attUnit" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose attUnit is sought. - * - * @return the value of the "attUnit" attribute of this ClassOneTwo_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getAttUnit(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose attEnum is sought. - * - * @return the value of the "attEnum" attribute of this ClassOneTwo_t as a - * AbcType_t. - * - * @copydetails doc_classonetwo_attEnum - * @if clike The value is drawn from the enumeration @ref AbcType_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{OBJECTIVE_TYPE_MAXIMIZE, AbcType_t} - * @li @sbmlconstant{OBJECTIVE_TYPE_MINIMIZE, AbcType_t} - * @li @sbmlconstant{OBJECTIVE_TYPE_INVALID, AbcType_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -AbcType_t -ClassOneTwo_getAttEnum(const ClassOneTwo_t * cot); - - -/** - * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure whose attEnum is sought. - * - * @return the value of the "attEnum" attribute of this ClassOneTwo_t as a - * const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_classonetwo_attEnum - * The possible values returned by this method are: - * @li @c "maximize" - * @li @c "minimize" - * @li @c "invalid AbcType value" - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -char * -ClassOneTwo_getAttEnumAsString(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "id" attribute is - * set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "id" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetId(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att1" attribute is - * set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "att1" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAtt1(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attStr" attribute - * is set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "attStr" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttStr(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attInt" attribute - * is set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "attInt" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttInt(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att2" attribute is - * set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "att2" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAtt2(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attDbl" attribute - * is set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "attDbl" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttDbl(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attUnit" attribute - * is set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "attUnit" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttUnit(const ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attEnum" attribute - * is set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) if this ClassOneTwo_t's "attEnum" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @copydetails doc_classonetwo_attEnum - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_isSetAttEnum(const ClassOneTwo_t * cot); - - -/** - * Sets the value of the "id" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling ClassOneTwo_unsetId(). - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setId(ClassOneTwo_t * cot, const char * id); - - -/** - * Sets the value of the "att1" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param att1 int value of the "att1" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAtt1(ClassOneTwo_t * cot, int att1); - - -/** - * Sets the value of the "attStr" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param attStr const char * value of the "attStr" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p attStr = @c NULL or an empty string is - * equivalent to calling ClassOneTwo_unsetAttStr(). - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttStr(ClassOneTwo_t * cot, const char * attStr); - - -/** - * Sets the value of the "attInt" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param attInt int value of the "attInt" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttInt(ClassOneTwo_t * cot, int attInt); - - -/** - * Sets the value of the "att2" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param att2 int value of the "att2" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAtt2(ClassOneTwo_t * cot, int att2); - - -/** - * Sets the value of the "attDbl" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param attDbl double value of the "attDbl" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttDbl(ClassOneTwo_t * cot, double attDbl); - - -/** - * Sets the value of the "attUnit" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param attUnit const char * value of the "attUnit" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttUnit(ClassOneTwo_t * cot, const char * attUnit); - - -/** - * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param attEnum AbcType_t value of the "attEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classonetwo_attEnum - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttEnum(ClassOneTwo_t * cot, AbcType_t attEnum); - - -/** - * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @param attEnum const char * of the "attEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classonetwo_attEnum - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_setAttEnumAsString(ClassOneTwo_t * cot, const char * attEnum); - - -/** - * Unsets the value of the "id" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetId(ClassOneTwo_t * cot); - - -/** - * Unsets the value of the "att1" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAtt1(ClassOneTwo_t * cot); - - -/** - * Unsets the value of the "attStr" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttStr(ClassOneTwo_t * cot); - - -/** - * Unsets the value of the "attInt" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttInt(ClassOneTwo_t * cot); - - -/** - * Unsets the value of the "att2" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAtt2(ClassOneTwo_t * cot); - - -/** - * Unsets the value of the "attDbl" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttDbl(ClassOneTwo_t * cot); - - -/** - * Unsets the value of the "attUnit" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttUnit(ClassOneTwo_t * cot); - - -/** - * Unsets the value of the "attEnum" attribute of this ClassOneTwo_t. - * - * @param cot the ClassOneTwo_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classonetwo_attEnum - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_unsetAttEnum(ClassOneTwo_t * cot); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassOneTwo_t object have been set. - * - * @param cot the ClassOneTwo_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * ClassOneTwo_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the ClassOneTwo_t object are: - * @li "id" - * @li "attEnum" - * - * @memberof ClassOneTwo_t - */ -LIBSBML_EXTERN -int -ClassOneTwo_hasRequiredAttributes(const ClassOneTwo_t * cot); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ClassOneTwo_H__ */ - - +/** + * @file ClassOneTwo.h + * @brief Definition of the ClassOneTwo class. + * @author SBMLTeam + * + * + * + * @class ClassOneTwo + * @sbmlbrief{coreversmultipkg} TODO:Definition of the ClassOneTwo class. + */ + +/** + * + * + * + * @class doc_classonetwo_attEnum + * + * @par + * The attribute "attEnum" on a ClassOneTwo object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Coreversmultipkg specification, the following + * are the + * allowable values for "attEnum": + *
    + *
  • @c "maximize", TODO:add description + * + *
  • @c "minimize", TODO:add description + * + *
+ */ + + +#ifndef ClassOneTwo_H__ +#define ClassOneTwo_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ClassOneTwo : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + bool mAtt1; + bool mIsSetAtt1; + std::string mAttStr; + int mAttInt; + bool mIsSetAttInt; + bool mAtt2; + bool mIsSetAtt2; + double mAttDbl; + bool mIsSetAttDbl; + std::string mAttUnit; + AbcType_t mAttEnum; + + /** @endcond */ + +public: + + /** + * Creates a new ClassOneTwo using the given SBML Level, Version and + * “coreversmultipkg” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ClassOneTwo. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassOneTwo. + * + * @param pkgVersion an unsigned int, the SBML Coreversmultipkg Version to + * assign to this ClassOneTwo. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassOneTwo(unsigned int level = + CoreversmultipkgExtension::getDefaultLevel(), + unsigned int version = + CoreversmultipkgExtension::getDefaultVersion(), + unsigned int pkgVersion = + CoreversmultipkgExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ClassOneTwo using the given CoreversmultipkgPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param coreversmultipkgns the CoreversmultipkgPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassOneTwo(CoreversmultipkgPkgNamespaces *coreversmultipkgns); + + + /** + * Copy constructor for ClassOneTwo. + * + * @param orig the ClassOneTwo instance to copy. + */ + ClassOneTwo(const ClassOneTwo& orig); + + + /** + * Assignment operator for ClassOneTwo. + * + * @param rhs the ClassOneTwo object whose values are to be used as the basis + * of the assignment. + */ + ClassOneTwo& operator=(const ClassOneTwo& rhs); + + + /** + * Creates and returns a deep copy of this ClassOneTwo object. + * + * @return a (deep) copy of this ClassOneTwo object. + */ + virtual ClassOneTwo* clone() const; + + + /** + * Destructor for ClassOneTwo. + */ + virtual ~ClassOneTwo(); + + + /** + * Returns the value of the "id" attribute of this ClassOneTwo. + * + * @return the value of the "id" attribute of this ClassOneTwo as a string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "att1" attribute of this ClassOneTwo. + * + * @return the value of the "att1" attribute of this ClassOneTwo as a + * boolean. + */ + bool getAtt1() const; + + + /** + * Returns the value of the "attStr" attribute of this ClassOneTwo. + * + * @return the value of the "attStr" attribute of this ClassOneTwo as a + * string. + */ + const std::string& getAttStr() const; + + + /** + * Returns the value of the "attInt" attribute of this ClassOneTwo. + * + * @return the value of the "attInt" attribute of this ClassOneTwo as a + * integer. + */ + int getAttInt() const; + + + /** + * Returns the value of the "att2" attribute of this ClassOneTwo. + * + * @return the value of the "att2" attribute of this ClassOneTwo as a + * boolean. + */ + bool getAtt2() const; + + + /** + * Returns the value of the "attDbl" attribute of this ClassOneTwo. + * + * @return the value of the "attDbl" attribute of this ClassOneTwo as a + * double. + */ + double getAttDbl() const; + + + /** + * Returns the value of the "attUnit" attribute of this ClassOneTwo. + * + * @return the value of the "attUnit" attribute of this ClassOneTwo as a + * string. + */ + const std::string& getAttUnit() const; + + + /** + * Returns the value of the "attEnum" attribute of this ClassOneTwo. + * + * @return the value of the "attEnum" attribute of this ClassOneTwo as a + * AbcType_t. + * + * @copydetails doc_classonetwo_attEnum + * @if clike The value is drawn from the enumeration @ref AbcType_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{OBJECTIVE_TYPE_MAXIMIZE, AbcType_t} + * @li @sbmlconstant{OBJECTIVE_TYPE_MINIMIZE, AbcType_t} + * @li @sbmlconstant{OBJECTIVE_TYPE_INVALID, AbcType_t} + */ + AbcType_t getAttEnum() const; + + + /** + * Returns the value of the "attEnum" attribute of this ClassOneTwo. + * + * @return the value of the "attEnum" attribute of this ClassOneTwo as a + * string. + * + * @copydetails doc_classonetwo_attEnum + * The possible values returned by this method are: + * @li @c "maximize" + * @li @c "minimize" + * @li @c "invalid AbcType value" + */ + std::string getAttEnumAsString() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "id" attribute is set. + * + * @return @c true if this ClassOneTwo's "id" attribute has been set, + * otherwise @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "att1" attribute is set. + * + * @return @c true if this ClassOneTwo's "att1" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAtt1() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "attStr" attribute is + * set. + * + * @return @c true if this ClassOneTwo's "attStr" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAttStr() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "attInt" attribute is + * set. + * + * @return @c true if this ClassOneTwo's "attInt" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAttInt() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "att2" attribute is set. + * + * @return @c true if this ClassOneTwo's "att2" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAtt2() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "attDbl" attribute is + * set. + * + * @return @c true if this ClassOneTwo's "attDbl" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAttDbl() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "attUnit" attribute is + * set. + * + * @return @c true if this ClassOneTwo's "attUnit" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetAttUnit() const; + + + /** + * Predicate returning @c true if this ClassOneTwo's "attEnum" attribute is + * set. + * + * @return @c true if this ClassOneTwo's "attEnum" attribute has been set, + * otherwise @c false is returned. + * + * @copydetails doc_classonetwo_attEnum + */ + bool isSetAttEnum() const; + + + /** + * Sets the value of the "id" attribute of this ClassOneTwo. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "att1" attribute of this ClassOneTwo. + * + * @param att1 bool value of the "att1" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAtt1(bool att1); + + + /** + * Sets the value of the "attStr" attribute of this ClassOneTwo. + * + * @param attStr std::string& value of the "attStr" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p attStr = @c NULL or an empty string is + * equivalent to calling unsetAttStr(). + */ + int setAttStr(const std::string& attStr); + + + /** + * Sets the value of the "attInt" attribute of this ClassOneTwo. + * + * @param attInt int value of the "attInt" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAttInt(int attInt); + + + /** + * Sets the value of the "att2" attribute of this ClassOneTwo. + * + * @param att2 bool value of the "att2" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAtt2(bool att2); + + + /** + * Sets the value of the "attDbl" attribute of this ClassOneTwo. + * + * @param attDbl double value of the "attDbl" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAttDbl(double attDbl); + + + /** + * Sets the value of the "attUnit" attribute of this ClassOneTwo. + * + * @param attUnit std::string& value of the "attUnit" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setAttUnit(const std::string& attUnit); + + + /** + * Sets the value of the "attEnum" attribute of this ClassOneTwo. + * + * @param attEnum @if clike AbcType_t@else int@endif value of the "attEnum" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classonetwo_attEnum + */ + int setAttEnum(const AbcType_t attEnum); + + + /** + * Sets the value of the "attEnum" attribute of this ClassOneTwo. + * + * @param attEnum std::string& of the "attEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classonetwo_attEnum + */ + int setAttEnum(const std::string& attEnum); + + + /** + * Unsets the value of the "id" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "att1" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAtt1(); + + + /** + * Unsets the value of the "attStr" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAttStr(); + + + /** + * Unsets the value of the "attInt" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAttInt(); + + + /** + * Unsets the value of the "att2" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAtt2(); + + + /** + * Unsets the value of the "attDbl" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAttDbl(); + + + /** + * Unsets the value of the "attUnit" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetAttUnit(); + + + /** + * Unsets the value of the "attEnum" attribute of this ClassOneTwo. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_classonetwo_attEnum + */ + int unsetAttEnum(); + + + /** + * Returns the XML element name of this ClassOneTwo object. + * + * For ClassOneTwo, the XML element name is always @c "classOneTwo". + * + * @return the name of this element, i.e. @c "classOneTwo". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ClassOneTwo object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_COREVERS_CLASSONETWO, SBMLCoreversmultipkgTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * ClassOneTwo object have been set. + * + * @return @c true to indicate that all the required attributes of this + * ClassOneTwo have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the ClassOneTwo object are: + * @li "id" + * @li "attEnum" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ClassOneTwo's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ClassOneTwo's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this ClassOneTwo. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V1V2Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V2V1Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V2V2Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL4V1V1Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V1V2Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V2V1Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V2V2Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL4V1V1Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ClassOneTwo_t using the given SBML Level, Version and + * “coreversmultipkg” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ClassOneTwo_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassOneTwo_t. + * + * @param pkgVersion an unsigned int, the SBML Coreversmultipkg Version to + * assign to this ClassOneTwo_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +ClassOneTwo_t * +ClassOneTwo_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ClassOneTwo_t object. + * + * @param cot the ClassOneTwo_t structure. + * + * @return a (deep) copy of this ClassOneTwo_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +ClassOneTwo_t* +ClassOneTwo_clone(const ClassOneTwo_t* cot); + + +/** + * Frees this ClassOneTwo_t object. + * + * @param cot the ClassOneTwo_t structure. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +void +ClassOneTwo_free(ClassOneTwo_t* cot); + + +/** + * Returns the value of the "id" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose id is sought. + * + * @return the value of the "id" attribute of this ClassOneTwo_t as a pointer + * to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getId(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "att1" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose att1 is sought. + * + * @return the value of the "att1" attribute of this ClassOneTwo_t as a + * boolean. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_getAtt1(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "attStr" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose attStr is sought. + * + * @return the value of the "attStr" attribute of this ClassOneTwo_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getAttStr(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "attInt" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose attInt is sought. + * + * @return the value of the "attInt" attribute of this ClassOneTwo_t as a + * integer. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_getAttInt(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "att2" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose att2 is sought. + * + * @return the value of the "att2" attribute of this ClassOneTwo_t as a + * boolean. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_getAtt2(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "attDbl" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose attDbl is sought. + * + * @return the value of the "attDbl" attribute of this ClassOneTwo_t as a + * double. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +double +ClassOneTwo_getAttDbl(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "attUnit" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose attUnit is sought. + * + * @return the value of the "attUnit" attribute of this ClassOneTwo_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getAttUnit(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose attEnum is sought. + * + * @return the value of the "attEnum" attribute of this ClassOneTwo_t as a + * AbcType_t. + * + * @copydetails doc_classonetwo_attEnum + * @if clike The value is drawn from the enumeration @ref AbcType_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{OBJECTIVE_TYPE_MAXIMIZE, AbcType_t} + * @li @sbmlconstant{OBJECTIVE_TYPE_MINIMIZE, AbcType_t} + * @li @sbmlconstant{OBJECTIVE_TYPE_INVALID, AbcType_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +AbcType_t +ClassOneTwo_getAttEnum(const ClassOneTwo_t * cot); + + +/** + * Returns the value of the "attEnum" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure whose attEnum is sought. + * + * @return the value of the "attEnum" attribute of this ClassOneTwo_t as a + * const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_classonetwo_attEnum + * The possible values returned by this method are: + * @li @c "maximize" + * @li @c "minimize" + * @li @c "invalid AbcType value" + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +char * +ClassOneTwo_getAttEnumAsString(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "id" attribute is + * set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "id" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetId(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att1" attribute is + * set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "att1" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAtt1(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attStr" attribute + * is set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "attStr" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttStr(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attInt" attribute + * is set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "attInt" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttInt(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "att2" attribute is + * set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "att2" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAtt2(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attDbl" attribute + * is set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "attDbl" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttDbl(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attUnit" attribute + * is set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "attUnit" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttUnit(const ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if this ClassOneTwo_t's "attEnum" attribute + * is set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) if this ClassOneTwo_t's "attEnum" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @copydetails doc_classonetwo_attEnum + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_isSetAttEnum(const ClassOneTwo_t * cot); + + +/** + * Sets the value of the "id" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling ClassOneTwo_unsetId(). + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setId(ClassOneTwo_t * cot, const char * id); + + +/** + * Sets the value of the "att1" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param att1 int value of the "att1" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAtt1(ClassOneTwo_t * cot, int att1); + + +/** + * Sets the value of the "attStr" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param attStr const char * value of the "attStr" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p attStr = @c NULL or an empty string is + * equivalent to calling ClassOneTwo_unsetAttStr(). + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttStr(ClassOneTwo_t * cot, const char * attStr); + + +/** + * Sets the value of the "attInt" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param attInt int value of the "attInt" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttInt(ClassOneTwo_t * cot, int attInt); + + +/** + * Sets the value of the "att2" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param att2 int value of the "att2" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAtt2(ClassOneTwo_t * cot, int att2); + + +/** + * Sets the value of the "attDbl" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param attDbl double value of the "attDbl" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttDbl(ClassOneTwo_t * cot, double attDbl); + + +/** + * Sets the value of the "attUnit" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param attUnit const char * value of the "attUnit" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttUnit(ClassOneTwo_t * cot, const char * attUnit); + + +/** + * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param attEnum AbcType_t value of the "attEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classonetwo_attEnum + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttEnum(ClassOneTwo_t * cot, AbcType_t attEnum); + + +/** + * Sets the value of the "attEnum" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @param attEnum const char * of the "attEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classonetwo_attEnum + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_setAttEnumAsString(ClassOneTwo_t * cot, const char * attEnum); + + +/** + * Unsets the value of the "id" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetId(ClassOneTwo_t * cot); + + +/** + * Unsets the value of the "att1" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAtt1(ClassOneTwo_t * cot); + + +/** + * Unsets the value of the "attStr" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttStr(ClassOneTwo_t * cot); + + +/** + * Unsets the value of the "attInt" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttInt(ClassOneTwo_t * cot); + + +/** + * Unsets the value of the "att2" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAtt2(ClassOneTwo_t * cot); + + +/** + * Unsets the value of the "attDbl" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttDbl(ClassOneTwo_t * cot); + + +/** + * Unsets the value of the "attUnit" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttUnit(ClassOneTwo_t * cot); + + +/** + * Unsets the value of the "attEnum" attribute of this ClassOneTwo_t. + * + * @param cot the ClassOneTwo_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classonetwo_attEnum + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_unsetAttEnum(ClassOneTwo_t * cot); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassOneTwo_t object have been set. + * + * @param cot the ClassOneTwo_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * ClassOneTwo_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the ClassOneTwo_t object are: + * @li "id" + * @li "attEnum" + * + * @memberof ClassOneTwo_t + */ +LIBSBML_EXTERN +int +ClassOneTwo_hasRequiredAttributes(const ClassOneTwo_t * cot); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ClassOneTwo_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ClassThree.cpp b/generator/tests/test_cpp_code/test-code/ClassThree.cpp index cd804162..49c71824 100644 --- a/generator/tests/test_cpp_code/test-code/ClassThree.cpp +++ b/generator/tests/test_cpp_code/test-code/ClassThree.cpp @@ -1,1667 +1,1667 @@ -/** - * @file ClassThree.cpp - * @brief Implementation of the ClassThree class. - * @author SBMLTeam - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ClassThree using the given SBML Level, Version and - * “test” package version. - */ -ClassThree::ClassThree(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mNumber (TEST_ENUM_INVALID) - , mBadName (TEST_FRED_INVALID) - , mOtherNum (TEST_ENUM_INVALID) - , mLongEnum (TEST_EXTRALONG_INVALID) -{ - setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); -} - - -/* - * Creates a new ClassThree using the given TestPkgNamespaces object. - */ -ClassThree::ClassThree(TestPkgNamespaces *testns) - : SBase(testns) - , mNumber (TEST_ENUM_INVALID) - , mBadName (TEST_FRED_INVALID) - , mOtherNum (TEST_ENUM_INVALID) - , mLongEnum (TEST_EXTRALONG_INVALID) -{ - setElementNamespace(testns->getURI()); - loadPlugins(testns); -} - - -/* - * Copy constructor for ClassThree. - */ -ClassThree::ClassThree(const ClassThree& orig) - : SBase( orig ) - , mNumber ( orig.mNumber ) - , mBadName ( orig.mBadName ) - , mOtherNum ( orig.mOtherNum ) - , mLongEnum ( orig.mLongEnum ) -{ -} - - -/* - * Assignment operator for ClassThree. - */ -ClassThree& -ClassThree::operator=(const ClassThree& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mNumber = rhs.mNumber; - mBadName = rhs.mBadName; - mOtherNum = rhs.mOtherNum; - mLongEnum = rhs.mLongEnum; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ClassThree object. - */ -ClassThree* -ClassThree::clone() const -{ - return new ClassThree(*this); -} - - -/* - * Destructor for ClassThree. - */ -ClassThree::~ClassThree() -{ -} - - -/* - * Returns the value of the "number" attribute of this ClassThree. - */ -Enum_t -ClassThree::getNumber() const -{ - return mNumber; -} - - -/* - * Returns the value of the "number" attribute of this ClassThree. - */ -std::string -ClassThree::getNumberAsString() const -{ - std::string code_str = Enum_toString(mNumber); - return code_str; -} - - -/* - * Returns the value of the "name" attribute of this ClassThree. - */ -Fred_t -ClassThree::getName() const -{ - return mName; -} - - -/* - * Returns the value of the "name" attribute of this ClassThree. - */ -std::string -ClassThree::getNameAsString() const -{ - std::string code_str = Fred_toString(mName); - return code_str; -} - - -/* - * Returns the value of the "badName" attribute of this ClassThree. - */ -Fred_t -ClassThree::getBadName() const -{ - return mBadName; -} - - -/* - * Returns the value of the "badName" attribute of this ClassThree. - */ -std::string -ClassThree::getBadNameAsString() const -{ - std::string code_str = Fred_toString(mBadName); - return code_str; -} - - -/* - * Returns the value of the "otherNum" attribute of this ClassThree. - */ -Enum_t -ClassThree::getOtherNum() const -{ - return mOtherNum; -} - - -/* - * Returns the value of the "otherNum" attribute of this ClassThree. - */ -std::string -ClassThree::getOtherNumAsString() const -{ - std::string code_str = Enum_toString(mOtherNum); - return code_str; -} - - -/* - * Returns the value of the "longEnum" attribute of this ClassThree. - */ -ExtraLong_t -ClassThree::getLongEnum() const -{ - return mLongEnum; -} - - -/* - * Returns the value of the "longEnum" attribute of this ClassThree. - */ -std::string -ClassThree::getLongEnumAsString() const -{ - std::string code_str = ExtraLong_toString(mLongEnum); - return code_str; -} - - -/* - * Predicate returning @c true if this ClassThree's "number" attribute is set. - */ -bool -ClassThree::isSetNumber() const -{ - return (mNumber != TEST_ENUM_INVALID); -} - - -/* - * Predicate returning @c true if this ClassThree's "name" attribute is set. - */ -bool -ClassThree::isSetName() const -{ - return (mName != TEST_FRED_INVALID); -} - - -/* - * Predicate returning @c true if this ClassThree's "badName" attribute is set. - */ -bool -ClassThree::isSetBadName() const -{ - return (mBadName != TEST_FRED_INVALID); -} - - -/* - * Predicate returning @c true if this ClassThree's "otherNum" attribute is - * set. - */ -bool -ClassThree::isSetOtherNum() const -{ - return (mOtherNum != TEST_ENUM_INVALID); -} - - -/* - * Predicate returning @c true if this ClassThree's "longEnum" attribute is - * set. - */ -bool -ClassThree::isSetLongEnum() const -{ - return (mLongEnum != TEST_EXTRALONG_INVALID); -} - - -/* - * Sets the value of the "number" attribute of this ClassThree. - */ -int -ClassThree::setNumber(const Enum_t number) -{ - if (Enum_isValid(number) == 0) - { - mNumber = TEST_ENUM_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mNumber = number; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "number" attribute of this ClassThree. - */ -int -ClassThree::setNumber(const std::string& number) -{ - mNumber = Enum_fromString(number.c_str()); - - if (mNumber == TEST_ENUM_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "name" attribute of this ClassThree. - */ -int -ClassThree::setName(const Fred_t name) -{ - if (Fred_isValid(name) == 0) - { - mName = TEST_FRED_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mName = name; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "name" attribute of this ClassThree. - */ -int -ClassThree::setName(const std::string& name) -{ - mName = Fred_fromString(name.c_str()); - - if (mName == TEST_FRED_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "badName" attribute of this ClassThree. - */ -int -ClassThree::setBadName(const Fred_t badName) -{ - if (Fred_isValid(badName) == 0) - { - mBadName = TEST_FRED_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mBadName = badName; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "badName" attribute of this ClassThree. - */ -int -ClassThree::setBadName(const std::string& badName) -{ - mBadName = Fred_fromString(badName.c_str()); - - if (mBadName == TEST_FRED_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "otherNum" attribute of this ClassThree. - */ -int -ClassThree::setOtherNum(const Enum_t otherNum) -{ - if (Enum_isValid(otherNum) == 0) - { - mOtherNum = TEST_ENUM_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mOtherNum = otherNum; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "otherNum" attribute of this ClassThree. - */ -int -ClassThree::setOtherNum(const std::string& otherNum) -{ - mOtherNum = Enum_fromString(otherNum.c_str()); - - if (mOtherNum == TEST_ENUM_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "longEnum" attribute of this ClassThree. - */ -int -ClassThree::setLongEnum(const ExtraLong_t longEnum) -{ - if (ExtraLong_isValid(longEnum) == 0) - { - mLongEnum = TEST_EXTRALONG_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mLongEnum = longEnum; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "longEnum" attribute of this ClassThree. - */ -int -ClassThree::setLongEnum(const std::string& longEnum) -{ - mLongEnum = ExtraLong_fromString(longEnum.c_str()); - - if (mLongEnum == TEST_EXTRALONG_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "number" attribute of this ClassThree. - */ -int -ClassThree::unsetNumber() -{ - mNumber = TEST_ENUM_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "name" attribute of this ClassThree. - */ -int -ClassThree::unsetName() -{ - mName = TEST_FRED_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "badName" attribute of this ClassThree. - */ -int -ClassThree::unsetBadName() -{ - mBadName = TEST_FRED_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "otherNum" attribute of this ClassThree. - */ -int -ClassThree::unsetOtherNum() -{ - mOtherNum = TEST_ENUM_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "longEnum" attribute of this ClassThree. - */ -int -ClassThree::unsetLongEnum() -{ - mLongEnum = TEST_EXTRALONG_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this ClassThree object. - */ -const std::string& -ClassThree::getElementName() const -{ - static const string name = "classThree"; - return name; -} - - -/* - * Returns the libSBML type code for this ClassThree object. - */ -int -ClassThree::getTypeCode() const -{ - return SBML_TEST_CLASSTHREE; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * ClassThree object have been set. - */ -bool -ClassThree::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetNumber() == false) - { - allPresent = false; - } - - if (isSetName() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ClassThree::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ClassThree::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ClassThree::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ClassThree::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "number") - { - value = getNumberAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "name") - { - value = getNameAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "badName") - { - value = getBadNameAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "otherNum") - { - value = getOtherNumAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "longEnum") - { - value = getLongEnumAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ClassThree's attribute "attributeName" - * is set. - */ -bool -ClassThree::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "number") - { - value = isSetNumber(); - } - else if (attributeName == "name") - { - value = isSetName(); - } - else if (attributeName == "badName") - { - value = isSetBadName(); - } - else if (attributeName == "otherNum") - { - value = isSetOtherNum(); - } - else if (attributeName == "longEnum") - { - value = isSetLongEnum(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "number") - { - return_value = setNumber(value); - } - else if (attributeName == "name") - { - return_value = setName(value); - } - else if (attributeName == "badName") - { - return_value = setBadName(value); - } - else if (attributeName == "otherNum") - { - return_value = setOtherNum(value); - } - else if (attributeName == "longEnum") - { - return_value = setLongEnum(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this ClassThree. - */ -int -ClassThree::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "number") - { - value = unsetNumber(); - } - else if (attributeName == "name") - { - value = unsetName(); - } - else if (attributeName == "badName") - { - value = unsetBadName(); - } - else if (attributeName == "otherNum") - { - value = unsetOtherNum(); - } - else if (attributeName == "longEnum") - { - value = unsetLongEnum(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -ClassThree::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("number"); - - attributes.add("name"); - - attributes.add("badName"); - - attributes.add("otherNum"); - - attributes.add("longEnum"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassThree::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("test", TestClassThreeAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("test", TestClassThreeAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // number enum (use = "required" ) - // - - std::string number; - assigned = attributes.readInto("number", number); - - if (assigned == true) - { - if (number.empty() == true) - { - logEmptyString(number, level, version, ""); - } - else - { - mNumber = Enum_fromString(number.c_str()); - - if (log && Enum_isValid(mNumber) == 0) - { - std::string msg = "The number on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + number + "', which is not a valid option."; - - log->logPackageError("test", TestClassThreeNumberMustBeEnumEnum, - pkgVersion, level, version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Test attribute 'number' is missing."; - log->logPackageError("test", TestClassThreeAllowedAttributes, pkgVersion, - level, version, message, getLine(), getColumn()); - } - } - - // - // name enum (use = "required" ) - // - - std::string name; - assigned = attributes.readInto("name", name); - - if (assigned == true) - { - if (name.empty() == true) - { - logEmptyString(name, level, version, ""); - } - else - { - mName = Fred_fromString(name.c_str()); - - if (log && Fred_isValid(mName) == 0) - { - std::string msg = "The name on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + name + "', which is not a valid option."; - - log->logPackageError("test", TestClassThreeNameMustBeFredEnum, - pkgVersion, level, version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Test attribute 'name' is missing."; - log->logPackageError("test", TestClassThreeAllowedAttributes, pkgVersion, - level, version, message, getLine(), getColumn()); - } - } - - // - // badName enum (use = "optional" ) - // - - std::string badName; - assigned = attributes.readInto("badName", badName); - - if (assigned == true) - { - if (badName.empty() == true) - { - logEmptyString(badName, level, version, ""); - } - else - { - mBadName = Fred_fromString(badName.c_str()); - - if (log && Fred_isValid(mBadName) == 0) - { - std::string msg = "The badName on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + badName + "', which is not a valid option."; - - log->logPackageError("test", TestClassThreeBadNameMustBeFredEnum, - pkgVersion, level, version, msg, getLine(), getColumn()); - } - } - } - - // - // otherNum enum (use = "optional" ) - // - - std::string otherNum; - assigned = attributes.readInto("otherNum", otherNum); - - if (assigned == true) - { - if (otherNum.empty() == true) - { - logEmptyString(otherNum, level, version, ""); - } - else - { - mOtherNum = Enum_fromString(otherNum.c_str()); - - if (log && Enum_isValid(mOtherNum) == 0) - { - std::string msg = "The otherNum on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + otherNum + "', which is not a valid option."; - - log->logPackageError("test", TestClassThreeOtherNumMustBeEnumEnum, - pkgVersion, level, version, msg, getLine(), getColumn()); - } - } - } - - // - // longEnum enum (use = "optional" ) - // - - std::string longEnum; - assigned = attributes.readInto("longEnum", longEnum); - - if (assigned == true) - { - if (longEnum.empty() == true) - { - logEmptyString(longEnum, level, version, ""); - } - else - { - mLongEnum = ExtraLong_fromString(longEnum.c_str()); - - if (log && ExtraLong_isValid(mLongEnum) == 0) - { - std::string msg = "The longEnum on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + longEnum + "', which is not a valid option."; - - log->logPackageError("test", TestClassThreeLongEnumMustBeExtraLongEnum, - pkgVersion, level, version, msg, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassThree::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetNumber() == true) - { - stream.writeAttribute("number", getPrefix(), Enum_toString(mNumber)); - } - - if (isSetName() == true) - { - stream.writeAttribute("name", getPrefix(), Fred_toString(mName)); - } - - if (isSetBadName() == true) - { - stream.writeAttribute("badName", getPrefix(), Fred_toString(mBadName)); - } - - if (isSetOtherNum() == true) - { - stream.writeAttribute("otherNum", getPrefix(), Enum_toString(mOtherNum)); - } - - if (isSetLongEnum() == true) - { - stream.writeAttribute("longEnum", getPrefix(), - ExtraLong_toString(mLongEnum)); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ClassThree_t using the given SBML Level, Version and - * “test” package version. - */ -LIBSBML_EXTERN -ClassThree_t * -ClassThree_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ClassThree(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ClassThree_t object. - */ -LIBSBML_EXTERN -ClassThree_t* -ClassThree_clone(const ClassThree_t* ct) -{ - if (ct != NULL) - { - return static_cast(ct->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ClassThree_t object. - */ -LIBSBML_EXTERN -void -ClassThree_free(ClassThree_t* ct) -{ - if (ct != NULL) - { - delete ct; - } -} - - -/* - * Returns the value of the "number" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -Enum_t -ClassThree_getNumber(const ClassThree_t * ct) -{ - if (ct == NULL) - { - return TEST_ENUM_INVALID; - } - - return ct->getNumber(); -} - - -/* - * Returns the value of the "number" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -char * -ClassThree_getNumberAsString(const ClassThree_t * ct) -{ - return (char*)(Enum_toString(ct->getNumber())); -} - - -/* - * Returns the value of the "name" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -Fred_t -ClassThree_getName(const ClassThree_t * ct) -{ - if (ct == NULL) - { - return TEST_FRED_INVALID; - } - - return ct->getName(); -} - - -/* - * Returns the value of the "name" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -char * -ClassThree_getNameAsString(const ClassThree_t * ct) -{ - return (char*)(Fred_toString(ct->getName())); -} - - -/* - * Returns the value of the "badName" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -Fred_t -ClassThree_getBadName(const ClassThree_t * ct) -{ - if (ct == NULL) - { - return TEST_FRED_INVALID; - } - - return ct->getBadName(); -} - - -/* - * Returns the value of the "badName" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -char * -ClassThree_getBadNameAsString(const ClassThree_t * ct) -{ - return (char*)(Fred_toString(ct->getBadName())); -} - - -/* - * Returns the value of the "otherNum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -Enum_t -ClassThree_getOtherNum(const ClassThree_t * ct) -{ - if (ct == NULL) - { - return TEST_ENUM_INVALID; - } - - return ct->getOtherNum(); -} - - -/* - * Returns the value of the "otherNum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -char * -ClassThree_getOtherNumAsString(const ClassThree_t * ct) -{ - return (char*)(Enum_toString(ct->getOtherNum())); -} - - -/* - * Returns the value of the "longEnum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -ExtraLong_t -ClassThree_getLongEnum(const ClassThree_t * ct) -{ - if (ct == NULL) - { - return TEST_EXTRALONG_INVALID; - } - - return ct->getLongEnum(); -} - - -/* - * Returns the value of the "longEnum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -char * -ClassThree_getLongEnumAsString(const ClassThree_t * ct) -{ - return (char*)(ExtraLong_toString(ct->getLongEnum())); -} - - -/* - * Predicate returning @c 1 (true) if this ClassThree_t's "number" attribute is - * set. - */ -LIBSBML_EXTERN -int -ClassThree_isSetNumber(const ClassThree_t * ct) -{ - return (ct != NULL) ? static_cast(ct->isSetNumber()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassThree_t's "name" attribute is - * set. - */ -LIBSBML_EXTERN -int -ClassThree_isSetName(const ClassThree_t * ct) -{ - return (ct != NULL) ? static_cast(ct->isSetName()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassThree_t's "badName" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassThree_isSetBadName(const ClassThree_t * ct) -{ - return (ct != NULL) ? static_cast(ct->isSetBadName()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassThree_t's "otherNum" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassThree_isSetOtherNum(const ClassThree_t * ct) -{ - return (ct != NULL) ? static_cast(ct->isSetOtherNum()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassThree_t's "longEnum" attribute - * is set. - */ -LIBSBML_EXTERN -int -ClassThree_isSetLongEnum(const ClassThree_t * ct) -{ - return (ct != NULL) ? static_cast(ct->isSetLongEnum()) : 0; -} - - -/* - * Sets the value of the "number" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setNumber(ClassThree_t * ct, Enum_t number) -{ - return (ct != NULL) ? ct->setNumber(number) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "number" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setNumberAsString(ClassThree_t * ct, const char * number) -{ - return (ct != NULL) ? ct->setNumber(number): LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "name" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setName(ClassThree_t * ct, Fred_t name) -{ - return (ct != NULL) ? ct->setName(name) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "name" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setNameAsString(ClassThree_t * ct, const char * name) -{ - return (ct != NULL) ? ct->setName(name): LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "badName" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setBadName(ClassThree_t * ct, Fred_t badName) -{ - return (ct != NULL) ? ct->setBadName(badName) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "badName" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setBadNameAsString(ClassThree_t * ct, const char * badName) -{ - return (ct != NULL) ? ct->setBadName(badName): LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "otherNum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setOtherNum(ClassThree_t * ct, Enum_t otherNum) -{ - return (ct != NULL) ? ct->setOtherNum(otherNum) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "otherNum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setOtherNumAsString(ClassThree_t * ct, const char * otherNum) -{ - return (ct != NULL) ? ct->setOtherNum(otherNum): LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "longEnum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setLongEnum(ClassThree_t * ct, ExtraLong_t longEnum) -{ - return (ct != NULL) ? ct->setLongEnum(longEnum) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "longEnum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_setLongEnumAsString(ClassThree_t * ct, const char * longEnum) -{ - return (ct != NULL) ? ct->setLongEnum(longEnum): LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "number" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_unsetNumber(ClassThree_t * ct) -{ - return (ct != NULL) ? ct->unsetNumber() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "name" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_unsetName(ClassThree_t * ct) -{ - return (ct != NULL) ? ct->unsetName() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "badName" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_unsetBadName(ClassThree_t * ct) -{ - return (ct != NULL) ? ct->unsetBadName() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "otherNum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_unsetOtherNum(ClassThree_t * ct) -{ - return (ct != NULL) ? ct->unsetOtherNum() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "longEnum" attribute of this ClassThree_t. - */ -LIBSBML_EXTERN -int -ClassThree_unsetLongEnum(ClassThree_t * ct) -{ - return (ct != NULL) ? ct->unsetLongEnum() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassThree_t object have been set. - */ -LIBSBML_EXTERN -int -ClassThree_hasRequiredAttributes(const ClassThree_t * ct) -{ - return (ct != NULL) ? static_cast(ct->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ClassThree.cpp + * @brief Implementation of the ClassThree class. + * @author SBMLTeam + * + * + */ +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ClassThree using the given SBML Level, Version and + * “test” package version. + */ +ClassThree::ClassThree(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mNumber (TEST_ENUM_INVALID) + , mBadName (TEST_FRED_INVALID) + , mOtherNum (TEST_ENUM_INVALID) + , mLongEnum (TEST_EXTRALONG_INVALID) +{ + setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); +} + + +/* + * Creates a new ClassThree using the given TestPkgNamespaces object. + */ +ClassThree::ClassThree(TestPkgNamespaces *testns) + : SBase(testns) + , mNumber (TEST_ENUM_INVALID) + , mBadName (TEST_FRED_INVALID) + , mOtherNum (TEST_ENUM_INVALID) + , mLongEnum (TEST_EXTRALONG_INVALID) +{ + setElementNamespace(testns->getURI()); + loadPlugins(testns); +} + + +/* + * Copy constructor for ClassThree. + */ +ClassThree::ClassThree(const ClassThree& orig) + : SBase( orig ) + , mNumber ( orig.mNumber ) + , mBadName ( orig.mBadName ) + , mOtherNum ( orig.mOtherNum ) + , mLongEnum ( orig.mLongEnum ) +{ +} + + +/* + * Assignment operator for ClassThree. + */ +ClassThree& +ClassThree::operator=(const ClassThree& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mNumber = rhs.mNumber; + mBadName = rhs.mBadName; + mOtherNum = rhs.mOtherNum; + mLongEnum = rhs.mLongEnum; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ClassThree object. + */ +ClassThree* +ClassThree::clone() const +{ + return new ClassThree(*this); +} + + +/* + * Destructor for ClassThree. + */ +ClassThree::~ClassThree() +{ +} + + +/* + * Returns the value of the "number" attribute of this ClassThree. + */ +Enum_t +ClassThree::getNumber() const +{ + return mNumber; +} + + +/* + * Returns the value of the "number" attribute of this ClassThree. + */ +std::string +ClassThree::getNumberAsString() const +{ + std::string code_str = Enum_toString(mNumber); + return code_str; +} + + +/* + * Returns the value of the "name" attribute of this ClassThree. + */ +Fred_t +ClassThree::getName() const +{ + return mName; +} + + +/* + * Returns the value of the "name" attribute of this ClassThree. + */ +std::string +ClassThree::getNameAsString() const +{ + std::string code_str = Fred_toString(mName); + return code_str; +} + + +/* + * Returns the value of the "badName" attribute of this ClassThree. + */ +Fred_t +ClassThree::getBadName() const +{ + return mBadName; +} + + +/* + * Returns the value of the "badName" attribute of this ClassThree. + */ +std::string +ClassThree::getBadNameAsString() const +{ + std::string code_str = Fred_toString(mBadName); + return code_str; +} + + +/* + * Returns the value of the "otherNum" attribute of this ClassThree. + */ +Enum_t +ClassThree::getOtherNum() const +{ + return mOtherNum; +} + + +/* + * Returns the value of the "otherNum" attribute of this ClassThree. + */ +std::string +ClassThree::getOtherNumAsString() const +{ + std::string code_str = Enum_toString(mOtherNum); + return code_str; +} + + +/* + * Returns the value of the "longEnum" attribute of this ClassThree. + */ +ExtraLong_t +ClassThree::getLongEnum() const +{ + return mLongEnum; +} + + +/* + * Returns the value of the "longEnum" attribute of this ClassThree. + */ +std::string +ClassThree::getLongEnumAsString() const +{ + std::string code_str = ExtraLong_toString(mLongEnum); + return code_str; +} + + +/* + * Predicate returning @c true if this ClassThree's "number" attribute is set. + */ +bool +ClassThree::isSetNumber() const +{ + return (mNumber != TEST_ENUM_INVALID); +} + + +/* + * Predicate returning @c true if this ClassThree's "name" attribute is set. + */ +bool +ClassThree::isSetName() const +{ + return (mName != TEST_FRED_INVALID); +} + + +/* + * Predicate returning @c true if this ClassThree's "badName" attribute is set. + */ +bool +ClassThree::isSetBadName() const +{ + return (mBadName != TEST_FRED_INVALID); +} + + +/* + * Predicate returning @c true if this ClassThree's "otherNum" attribute is + * set. + */ +bool +ClassThree::isSetOtherNum() const +{ + return (mOtherNum != TEST_ENUM_INVALID); +} + + +/* + * Predicate returning @c true if this ClassThree's "longEnum" attribute is + * set. + */ +bool +ClassThree::isSetLongEnum() const +{ + return (mLongEnum != TEST_EXTRALONG_INVALID); +} + + +/* + * Sets the value of the "number" attribute of this ClassThree. + */ +int +ClassThree::setNumber(const Enum_t number) +{ + if (Enum_isValid(number) == 0) + { + mNumber = TEST_ENUM_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mNumber = number; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "number" attribute of this ClassThree. + */ +int +ClassThree::setNumber(const std::string& number) +{ + mNumber = Enum_fromString(number.c_str()); + + if (mNumber == TEST_ENUM_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "name" attribute of this ClassThree. + */ +int +ClassThree::setName(const Fred_t name) +{ + if (Fred_isValid(name) == 0) + { + mName = TEST_FRED_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mName = name; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "name" attribute of this ClassThree. + */ +int +ClassThree::setName(const std::string& name) +{ + mName = Fred_fromString(name.c_str()); + + if (mName == TEST_FRED_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "badName" attribute of this ClassThree. + */ +int +ClassThree::setBadName(const Fred_t badName) +{ + if (Fred_isValid(badName) == 0) + { + mBadName = TEST_FRED_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mBadName = badName; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "badName" attribute of this ClassThree. + */ +int +ClassThree::setBadName(const std::string& badName) +{ + mBadName = Fred_fromString(badName.c_str()); + + if (mBadName == TEST_FRED_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "otherNum" attribute of this ClassThree. + */ +int +ClassThree::setOtherNum(const Enum_t otherNum) +{ + if (Enum_isValid(otherNum) == 0) + { + mOtherNum = TEST_ENUM_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mOtherNum = otherNum; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "otherNum" attribute of this ClassThree. + */ +int +ClassThree::setOtherNum(const std::string& otherNum) +{ + mOtherNum = Enum_fromString(otherNum.c_str()); + + if (mOtherNum == TEST_ENUM_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "longEnum" attribute of this ClassThree. + */ +int +ClassThree::setLongEnum(const ExtraLong_t longEnum) +{ + if (ExtraLong_isValid(longEnum) == 0) + { + mLongEnum = TEST_EXTRALONG_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mLongEnum = longEnum; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "longEnum" attribute of this ClassThree. + */ +int +ClassThree::setLongEnum(const std::string& longEnum) +{ + mLongEnum = ExtraLong_fromString(longEnum.c_str()); + + if (mLongEnum == TEST_EXTRALONG_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "number" attribute of this ClassThree. + */ +int +ClassThree::unsetNumber() +{ + mNumber = TEST_ENUM_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "name" attribute of this ClassThree. + */ +int +ClassThree::unsetName() +{ + mName = TEST_FRED_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "badName" attribute of this ClassThree. + */ +int +ClassThree::unsetBadName() +{ + mBadName = TEST_FRED_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "otherNum" attribute of this ClassThree. + */ +int +ClassThree::unsetOtherNum() +{ + mOtherNum = TEST_ENUM_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "longEnum" attribute of this ClassThree. + */ +int +ClassThree::unsetLongEnum() +{ + mLongEnum = TEST_EXTRALONG_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this ClassThree object. + */ +const std::string& +ClassThree::getElementName() const +{ + static const string name = "classThree"; + return name; +} + + +/* + * Returns the libSBML type code for this ClassThree object. + */ +int +ClassThree::getTypeCode() const +{ + return SBML_TEST_CLASSTHREE; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * ClassThree object have been set. + */ +bool +ClassThree::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetNumber() == false) + { + allPresent = false; + } + + if (isSetName() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ClassThree::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ClassThree::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ClassThree::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ClassThree::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "number") + { + value = getNumberAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "name") + { + value = getNameAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "badName") + { + value = getBadNameAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "otherNum") + { + value = getOtherNumAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "longEnum") + { + value = getLongEnumAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ClassThree's attribute "attributeName" + * is set. + */ +bool +ClassThree::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "number") + { + value = isSetNumber(); + } + else if (attributeName == "name") + { + value = isSetName(); + } + else if (attributeName == "badName") + { + value = isSetBadName(); + } + else if (attributeName == "otherNum") + { + value = isSetOtherNum(); + } + else if (attributeName == "longEnum") + { + value = isSetLongEnum(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "number") + { + return_value = setNumber(value); + } + else if (attributeName == "name") + { + return_value = setName(value); + } + else if (attributeName == "badName") + { + return_value = setBadName(value); + } + else if (attributeName == "otherNum") + { + return_value = setOtherNum(value); + } + else if (attributeName == "longEnum") + { + return_value = setLongEnum(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this ClassThree. + */ +int +ClassThree::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "number") + { + value = unsetNumber(); + } + else if (attributeName == "name") + { + value = unsetName(); + } + else if (attributeName == "badName") + { + value = unsetBadName(); + } + else if (attributeName == "otherNum") + { + value = unsetOtherNum(); + } + else if (attributeName == "longEnum") + { + value = unsetLongEnum(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +ClassThree::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("number"); + + attributes.add("name"); + + attributes.add("badName"); + + attributes.add("otherNum"); + + attributes.add("longEnum"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassThree::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("test", TestClassThreeAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("test", TestClassThreeAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // number enum (use = "required" ) + // + + std::string number; + assigned = attributes.readInto("number", number); + + if (assigned == true) + { + if (number.empty() == true) + { + logEmptyString(number, level, version, ""); + } + else + { + mNumber = Enum_fromString(number.c_str()); + + if (log && Enum_isValid(mNumber) == 0) + { + std::string msg = "The number on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + number + "', which is not a valid option."; + + log->logPackageError("test", TestClassThreeNumberMustBeEnumEnum, + pkgVersion, level, version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Test attribute 'number' is missing."; + log->logPackageError("test", TestClassThreeAllowedAttributes, pkgVersion, + level, version, message, getLine(), getColumn()); + } + } + + // + // name enum (use = "required" ) + // + + std::string name; + assigned = attributes.readInto("name", name); + + if (assigned == true) + { + if (name.empty() == true) + { + logEmptyString(name, level, version, ""); + } + else + { + mName = Fred_fromString(name.c_str()); + + if (log && Fred_isValid(mName) == 0) + { + std::string msg = "The name on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + name + "', which is not a valid option."; + + log->logPackageError("test", TestClassThreeNameMustBeFredEnum, + pkgVersion, level, version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Test attribute 'name' is missing."; + log->logPackageError("test", TestClassThreeAllowedAttributes, pkgVersion, + level, version, message, getLine(), getColumn()); + } + } + + // + // badName enum (use = "optional" ) + // + + std::string badName; + assigned = attributes.readInto("badName", badName); + + if (assigned == true) + { + if (badName.empty() == true) + { + logEmptyString(badName, level, version, ""); + } + else + { + mBadName = Fred_fromString(badName.c_str()); + + if (log && Fred_isValid(mBadName) == 0) + { + std::string msg = "The badName on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + badName + "', which is not a valid option."; + + log->logPackageError("test", TestClassThreeBadNameMustBeFredEnum, + pkgVersion, level, version, msg, getLine(), getColumn()); + } + } + } + + // + // otherNum enum (use = "optional" ) + // + + std::string otherNum; + assigned = attributes.readInto("otherNum", otherNum); + + if (assigned == true) + { + if (otherNum.empty() == true) + { + logEmptyString(otherNum, level, version, ""); + } + else + { + mOtherNum = Enum_fromString(otherNum.c_str()); + + if (log && Enum_isValid(mOtherNum) == 0) + { + std::string msg = "The otherNum on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + otherNum + "', which is not a valid option."; + + log->logPackageError("test", TestClassThreeOtherNumMustBeEnumEnum, + pkgVersion, level, version, msg, getLine(), getColumn()); + } + } + } + + // + // longEnum enum (use = "optional" ) + // + + std::string longEnum; + assigned = attributes.readInto("longEnum", longEnum); + + if (assigned == true) + { + if (longEnum.empty() == true) + { + logEmptyString(longEnum, level, version, ""); + } + else + { + mLongEnum = ExtraLong_fromString(longEnum.c_str()); + + if (log && ExtraLong_isValid(mLongEnum) == 0) + { + std::string msg = "The longEnum on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + longEnum + "', which is not a valid option."; + + log->logPackageError("test", TestClassThreeLongEnumMustBeExtraLongEnum, + pkgVersion, level, version, msg, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassThree::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetNumber() == true) + { + stream.writeAttribute("number", getPrefix(), Enum_toString(mNumber)); + } + + if (isSetName() == true) + { + stream.writeAttribute("name", getPrefix(), Fred_toString(mName)); + } + + if (isSetBadName() == true) + { + stream.writeAttribute("badName", getPrefix(), Fred_toString(mBadName)); + } + + if (isSetOtherNum() == true) + { + stream.writeAttribute("otherNum", getPrefix(), Enum_toString(mOtherNum)); + } + + if (isSetLongEnum() == true) + { + stream.writeAttribute("longEnum", getPrefix(), + ExtraLong_toString(mLongEnum)); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ClassThree_t using the given SBML Level, Version and + * “test” package version. + */ +LIBSBML_EXTERN +ClassThree_t * +ClassThree_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ClassThree(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ClassThree_t object. + */ +LIBSBML_EXTERN +ClassThree_t* +ClassThree_clone(const ClassThree_t* ct) +{ + if (ct != NULL) + { + return static_cast(ct->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ClassThree_t object. + */ +LIBSBML_EXTERN +void +ClassThree_free(ClassThree_t* ct) +{ + if (ct != NULL) + { + delete ct; + } +} + + +/* + * Returns the value of the "number" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +Enum_t +ClassThree_getNumber(const ClassThree_t * ct) +{ + if (ct == NULL) + { + return TEST_ENUM_INVALID; + } + + return ct->getNumber(); +} + + +/* + * Returns the value of the "number" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +char * +ClassThree_getNumberAsString(const ClassThree_t * ct) +{ + return (char*)(Enum_toString(ct->getNumber())); +} + + +/* + * Returns the value of the "name" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +Fred_t +ClassThree_getName(const ClassThree_t * ct) +{ + if (ct == NULL) + { + return TEST_FRED_INVALID; + } + + return ct->getName(); +} + + +/* + * Returns the value of the "name" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +char * +ClassThree_getNameAsString(const ClassThree_t * ct) +{ + return (char*)(Fred_toString(ct->getName())); +} + + +/* + * Returns the value of the "badName" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +Fred_t +ClassThree_getBadName(const ClassThree_t * ct) +{ + if (ct == NULL) + { + return TEST_FRED_INVALID; + } + + return ct->getBadName(); +} + + +/* + * Returns the value of the "badName" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +char * +ClassThree_getBadNameAsString(const ClassThree_t * ct) +{ + return (char*)(Fred_toString(ct->getBadName())); +} + + +/* + * Returns the value of the "otherNum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +Enum_t +ClassThree_getOtherNum(const ClassThree_t * ct) +{ + if (ct == NULL) + { + return TEST_ENUM_INVALID; + } + + return ct->getOtherNum(); +} + + +/* + * Returns the value of the "otherNum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +char * +ClassThree_getOtherNumAsString(const ClassThree_t * ct) +{ + return (char*)(Enum_toString(ct->getOtherNum())); +} + + +/* + * Returns the value of the "longEnum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +ExtraLong_t +ClassThree_getLongEnum(const ClassThree_t * ct) +{ + if (ct == NULL) + { + return TEST_EXTRALONG_INVALID; + } + + return ct->getLongEnum(); +} + + +/* + * Returns the value of the "longEnum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +char * +ClassThree_getLongEnumAsString(const ClassThree_t * ct) +{ + return (char*)(ExtraLong_toString(ct->getLongEnum())); +} + + +/* + * Predicate returning @c 1 (true) if this ClassThree_t's "number" attribute is + * set. + */ +LIBSBML_EXTERN +int +ClassThree_isSetNumber(const ClassThree_t * ct) +{ + return (ct != NULL) ? static_cast(ct->isSetNumber()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassThree_t's "name" attribute is + * set. + */ +LIBSBML_EXTERN +int +ClassThree_isSetName(const ClassThree_t * ct) +{ + return (ct != NULL) ? static_cast(ct->isSetName()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassThree_t's "badName" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassThree_isSetBadName(const ClassThree_t * ct) +{ + return (ct != NULL) ? static_cast(ct->isSetBadName()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassThree_t's "otherNum" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassThree_isSetOtherNum(const ClassThree_t * ct) +{ + return (ct != NULL) ? static_cast(ct->isSetOtherNum()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassThree_t's "longEnum" attribute + * is set. + */ +LIBSBML_EXTERN +int +ClassThree_isSetLongEnum(const ClassThree_t * ct) +{ + return (ct != NULL) ? static_cast(ct->isSetLongEnum()) : 0; +} + + +/* + * Sets the value of the "number" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setNumber(ClassThree_t * ct, Enum_t number) +{ + return (ct != NULL) ? ct->setNumber(number) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "number" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setNumberAsString(ClassThree_t * ct, const char * number) +{ + return (ct != NULL) ? ct->setNumber(number): LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "name" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setName(ClassThree_t * ct, Fred_t name) +{ + return (ct != NULL) ? ct->setName(name) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "name" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setNameAsString(ClassThree_t * ct, const char * name) +{ + return (ct != NULL) ? ct->setName(name): LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "badName" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setBadName(ClassThree_t * ct, Fred_t badName) +{ + return (ct != NULL) ? ct->setBadName(badName) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "badName" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setBadNameAsString(ClassThree_t * ct, const char * badName) +{ + return (ct != NULL) ? ct->setBadName(badName): LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "otherNum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setOtherNum(ClassThree_t * ct, Enum_t otherNum) +{ + return (ct != NULL) ? ct->setOtherNum(otherNum) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "otherNum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setOtherNumAsString(ClassThree_t * ct, const char * otherNum) +{ + return (ct != NULL) ? ct->setOtherNum(otherNum): LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "longEnum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setLongEnum(ClassThree_t * ct, ExtraLong_t longEnum) +{ + return (ct != NULL) ? ct->setLongEnum(longEnum) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "longEnum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_setLongEnumAsString(ClassThree_t * ct, const char * longEnum) +{ + return (ct != NULL) ? ct->setLongEnum(longEnum): LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "number" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_unsetNumber(ClassThree_t * ct) +{ + return (ct != NULL) ? ct->unsetNumber() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "name" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_unsetName(ClassThree_t * ct) +{ + return (ct != NULL) ? ct->unsetName() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "badName" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_unsetBadName(ClassThree_t * ct) +{ + return (ct != NULL) ? ct->unsetBadName() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "otherNum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_unsetOtherNum(ClassThree_t * ct) +{ + return (ct != NULL) ? ct->unsetOtherNum() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "longEnum" attribute of this ClassThree_t. + */ +LIBSBML_EXTERN +int +ClassThree_unsetLongEnum(ClassThree_t * ct) +{ + return (ct != NULL) ? ct->unsetLongEnum() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassThree_t object have been set. + */ +LIBSBML_EXTERN +int +ClassThree_hasRequiredAttributes(const ClassThree_t * ct) +{ + return (ct != NULL) ? static_cast(ct->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ClassThree.h b/generator/tests/test_cpp_code/test-code/ClassThree.h index fe895f98..00958288 100644 --- a/generator/tests/test_cpp_code/test-code/ClassThree.h +++ b/generator/tests/test_cpp_code/test-code/ClassThree.h @@ -1,1750 +1,1750 @@ -/** - * @file ClassThree.h - * @brief Definition of the ClassThree class. - * @author SBMLTeam - * - * - * - * @class ClassThree - * @sbmlbrief{test} TODO:Definition of the ClassThree class. - */ - -/** - * - * - * - * @class doc_classthree_number - * - * @par - * The attribute "number" on a ClassThree object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Test specification, the following are the - * allowable values for "number": - *
    - *
  • @c "One", TODO:add description - * - *
  • @c "Two", TODO:add description - * - *
- * - * @class doc_classthree_name - * - * @par - * The attribute "name" on a ClassThree object is used to TODO:add explanation - * - * In the SBML - * Level 3 Version 1 Test specification, the following are the - * allowable values for "name": - *
    - *
  • @c "tom", TODO:add description - * - *
  • @c "dick", TODO:add description - * - *
- * - * @class doc_classthree_badName - * - * @par - * The attribute "badName" on a ClassThree object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Test specification, the following are the - * allowable values for "badName": - *
    - *
  • @c "tom", TODO:add description - * - *
  • @c "dick", TODO:add description - * - *
- * - * @class doc_classthree_otherNum - * - * @par - * The attribute "otherNum" on a ClassThree object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Test specification, the following are the - * allowable values for "otherNum": - *
    - *
  • @c "One", TODO:add description - * - *
  • @c "Two", TODO:add description - * - *
- * - * @class doc_classthree_longEnum - * - * @par - * The attribute "longEnum" on a ClassThree object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Test specification, the following are the - * allowable values for "longEnum": - *
    - *
  • @c "http://identifiers.org/combine.specifications/sbgn.pd.level-1.version-1.3", TODO:add description - * - *
  • @c "sarahasdfghjklkjhgfdsasdfghjhjklqwertyqwrtyhgfdssfghkjakakalkalklpoiutytrewhhhhhhhsshshshshshhshshhshhshhsssssssssssaaevenlongerlongerlongeraZ", TODO:add description - * - *
- */ - - -#ifndef ClassThree_H__ -#define ClassThree_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ClassThree : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - Enum_t mNumber; - Fred_t mBadName; - Enum_t mOtherNum; - ExtraLong_t mLongEnum; - - /** @endcond */ - -public: - - /** - * Creates a new ClassThree using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ClassThree. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassThree. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * ClassThree. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassThree(unsigned int level = TestExtension::getDefaultLevel(), - unsigned int version = TestExtension::getDefaultVersion(), - unsigned int pkgVersion = - TestExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ClassThree using the given TestPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param testns the TestPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassThree(TestPkgNamespaces *testns); - - - /** - * Copy constructor for ClassThree. - * - * @param orig the ClassThree instance to copy. - */ - ClassThree(const ClassThree& orig); - - - /** - * Assignment operator for ClassThree. - * - * @param rhs the ClassThree object whose values are to be used as the basis - * of the assignment. - */ - ClassThree& operator=(const ClassThree& rhs); - - - /** - * Creates and returns a deep copy of this ClassThree object. - * - * @return a (deep) copy of this ClassThree object. - */ - virtual ClassThree* clone() const; - - - /** - * Destructor for ClassThree. - */ - virtual ~ClassThree(); - - - /** - * Returns the value of the "number" attribute of this ClassThree. - * - * @return the value of the "number" attribute of this ClassThree as a - * Enum_t. - * - * @copydetails doc_classthree_number - * @if clike The value is drawn from the enumeration @ref Enum_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} - * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} - * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} - */ - Enum_t getNumber() const; - - - /** - * Returns the value of the "number" attribute of this ClassThree. - * - * @return the value of the "number" attribute of this ClassThree as a - * string. - * - * @copydetails doc_classthree_number - * The possible values returned by this method are: - * @li @c "One" - * @li @c "Two" - * @li @c "invalid Enum value" - */ - std::string getNumberAsString() const; - - - /** - * Returns the value of the "name" attribute of this ClassThree. - * - * @return the value of the "name" attribute of this ClassThree as a Fred_t. - * - * @copydetails doc_classthree_name - * @if clike The value is drawn from the enumeration @ref Fred_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} - * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} - * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} - */ - virtual Fred_t getName() const; - - - /** - * Returns the value of the "name" attribute of this ClassThree. - * - * @return the value of the "name" attribute of this ClassThree as a string. - * - * @copydetails doc_classthree_name - * The possible values returned by this method are: - * @li @c "tom" - * @li @c "dick" - * @li @c "invalid Fred value" - */ - std::string getNameAsString() const; - - - /** - * Returns the value of the "badName" attribute of this ClassThree. - * - * @return the value of the "badName" attribute of this ClassThree as a - * Fred_t. - * - * @copydetails doc_classthree_badName - * @if clike The value is drawn from the enumeration @ref Fred_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} - * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} - * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} - */ - Fred_t getBadName() const; - - - /** - * Returns the value of the "badName" attribute of this ClassThree. - * - * @return the value of the "badName" attribute of this ClassThree as a - * string. - * - * @copydetails doc_classthree_badName - * The possible values returned by this method are: - * @li @c "tom" - * @li @c "dick" - * @li @c "invalid Fred value" - */ - std::string getBadNameAsString() const; - - - /** - * Returns the value of the "otherNum" attribute of this ClassThree. - * - * @return the value of the "otherNum" attribute of this ClassThree as a - * Enum_t. - * - * @copydetails doc_classthree_otherNum - * @if clike The value is drawn from the enumeration @ref Enum_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} - * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} - * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} - */ - Enum_t getOtherNum() const; - - - /** - * Returns the value of the "otherNum" attribute of this ClassThree. - * - * @return the value of the "otherNum" attribute of this ClassThree as a - * string. - * - * @copydetails doc_classthree_otherNum - * The possible values returned by this method are: - * @li @c "One" - * @li @c "Two" - * @li @c "invalid Enum value" - */ - std::string getOtherNumAsString() const; - - - /** - * Returns the value of the "longEnum" attribute of this ClassThree. - * - * @return the value of the "longEnum" attribute of this ClassThree as a - * ExtraLong_t. - * - * @copydetails doc_classthree_longEnum - * @if clike The value is drawn from the enumeration @ref ExtraLong_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_EXTRALONG_FRANK, ExtraLong_t} - * @li @sbmlconstant{TEST_EXTRALONG_SARAH, ExtraLong_t} - * @li @sbmlconstant{TEST_EXTRALONG_INVALID, ExtraLong_t} - */ - ExtraLong_t getLongEnum() const; - - - /** - * Returns the value of the "longEnum" attribute of this ClassThree. - * - * @return the value of the "longEnum" attribute of this ClassThree as a - * string. - * - * @copydetails doc_classthree_longEnum - * The possible values returned by this method are: - * @li @c "http://identifiers.org/combine.specifications/sbgn.pd.level-1.version-1.3" - * @li @c "sarahasdfghjklkjhgfdsasdfghjhjklqwertyqwrtyhgfdssfghkjakakalkalklpoiutytrewhhhhhhhsshshshshshhshshhshhshhsssssssssssaaevenlongerlongerlongeraZ" - * @li @c "invalid ExtraLong value" - */ - std::string getLongEnumAsString() const; - - - /** - * Predicate returning @c true if this ClassThree's "number" attribute is - * set. - * - * @return @c true if this ClassThree's "number" attribute has been set, - * otherwise @c false is returned. - * - * @copydetails doc_classthree_number - */ - bool isSetNumber() const; - - - /** - * Predicate returning @c true if this ClassThree's "name" attribute is set. - * - * @return @c true if this ClassThree's "name" attribute has been set, - * otherwise @c false is returned. - * - * @copydetails doc_classthree_name - */ - virtual bool isSetName() const; - - - /** - * Predicate returning @c true if this ClassThree's "badName" attribute is - * set. - * - * @return @c true if this ClassThree's "badName" attribute has been set, - * otherwise @c false is returned. - * - * @copydetails doc_classthree_badName - */ - bool isSetBadName() const; - - - /** - * Predicate returning @c true if this ClassThree's "otherNum" attribute is - * set. - * - * @return @c true if this ClassThree's "otherNum" attribute has been set, - * otherwise @c false is returned. - * - * @copydetails doc_classthree_otherNum - */ - bool isSetOtherNum() const; - - - /** - * Predicate returning @c true if this ClassThree's "longEnum" attribute is - * set. - * - * @return @c true if this ClassThree's "longEnum" attribute has been set, - * otherwise @c false is returned. - * - * @copydetails doc_classthree_longEnum - */ - bool isSetLongEnum() const; - - - /** - * Sets the value of the "number" attribute of this ClassThree. - * - * @param number @if clike Enum_t@else int@endif value of the "number" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_number - */ - int setNumber(const Enum_t number); - - - /** - * Sets the value of the "number" attribute of this ClassThree. - * - * @param number std::string& of the "number" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_number - */ - int setNumber(const std::string& number); - - - /** - * Sets the value of the "name" attribute of this ClassThree. - * - * @param name @if clike Fred_t@else int@endif value of the "name" attribute - * to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_name - */ - virtual int setName(const Fred_t name); - - - /** - * Sets the value of the "name" attribute of this ClassThree. - * - * @param name std::string& of the "name" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_name - */ - int setName(const std::string& name); - - - /** - * Sets the value of the "badName" attribute of this ClassThree. - * - * @param badName @if clike Fred_t@else int@endif value of the "badName" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_badName - */ - int setBadName(const Fred_t badName); - - - /** - * Sets the value of the "badName" attribute of this ClassThree. - * - * @param badName std::string& of the "badName" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_badName - */ - int setBadName(const std::string& badName); - - - /** - * Sets the value of the "otherNum" attribute of this ClassThree. - * - * @param otherNum @if clike Enum_t@else int@endif value of the "otherNum" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_otherNum - */ - int setOtherNum(const Enum_t otherNum); - - - /** - * Sets the value of the "otherNum" attribute of this ClassThree. - * - * @param otherNum std::string& of the "otherNum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_otherNum - */ - int setOtherNum(const std::string& otherNum); - - - /** - * Sets the value of the "longEnum" attribute of this ClassThree. - * - * @param longEnum @if clike ExtraLong_t@else int@endif value of the - * "longEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_longEnum - */ - int setLongEnum(const ExtraLong_t longEnum); - - - /** - * Sets the value of the "longEnum" attribute of this ClassThree. - * - * @param longEnum std::string& of the "longEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_classthree_longEnum - */ - int setLongEnum(const std::string& longEnum); - - - /** - * Unsets the value of the "number" attribute of this ClassThree. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_classthree_number - */ - int unsetNumber(); - - - /** - * Unsets the value of the "name" attribute of this ClassThree. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_classthree_name - */ - virtual int unsetName(); - - - /** - * Unsets the value of the "badName" attribute of this ClassThree. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_classthree_badName - */ - int unsetBadName(); - - - /** - * Unsets the value of the "otherNum" attribute of this ClassThree. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_classthree_otherNum - */ - int unsetOtherNum(); - - - /** - * Unsets the value of the "longEnum" attribute of this ClassThree. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_classthree_longEnum - */ - int unsetLongEnum(); - - - /** - * Returns the XML element name of this ClassThree object. - * - * For ClassThree, the XML element name is always @c "classThree". - * - * @return the name of this element, i.e. @c "classThree". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ClassThree object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_TEST_CLASSTHREE, SBMLTestTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * ClassThree object have been set. - * - * @return @c true to indicate that all the required attributes of this - * ClassThree have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the ClassThree object are: - * @li "number" - * @li "name" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ClassThree's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ClassThree's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this ClassThree. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ClassThree_t using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ClassThree_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassThree_t. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * ClassThree_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -ClassThree_t * -ClassThree_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ClassThree_t object. - * - * @param ct the ClassThree_t structure. - * - * @return a (deep) copy of this ClassThree_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -ClassThree_t* -ClassThree_clone(const ClassThree_t* ct); - - -/** - * Frees this ClassThree_t object. - * - * @param ct the ClassThree_t structure. - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -void -ClassThree_free(ClassThree_t* ct); - - -/** - * Returns the value of the "number" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose number is sought. - * - * @return the value of the "number" attribute of this ClassThree_t as a - * Enum_t. - * - * @copydetails doc_classthree_number - * @if clike The value is drawn from the enumeration @ref Enum_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} - * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} - * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -Enum_t -ClassThree_getNumber(const ClassThree_t * ct); - - -/** - * Returns the value of the "number" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose number is sought. - * - * @return the value of the "number" attribute of this ClassThree_t as a const - * char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_classthree_number - * The possible values returned by this method are: - * @li @c "One" - * @li @c "Two" - * @li @c "invalid Enum value" - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -char * -ClassThree_getNumberAsString(const ClassThree_t * ct); - - -/** - * Returns the value of the "name" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose name is sought. - * - * @return the value of the "name" attribute of this ClassThree_t as a Fred_t. - * - * @copydetails doc_classthree_name - * @if clike The value is drawn from the enumeration @ref Fred_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} - * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} - * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -Fred_t -ClassThree_getName(const ClassThree_t * ct); - - -/** - * Returns the value of the "name" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose name is sought. - * - * @return the value of the "name" attribute of this ClassThree_t as a const - * char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_classthree_name - * The possible values returned by this method are: - * @li @c "tom" - * @li @c "dick" - * @li @c "invalid Fred value" - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -char * -ClassThree_getNameAsString(const ClassThree_t * ct); - - -/** - * Returns the value of the "badName" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose badName is sought. - * - * @return the value of the "badName" attribute of this ClassThree_t as a - * Fred_t. - * - * @copydetails doc_classthree_badName - * @if clike The value is drawn from the enumeration @ref Fred_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} - * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} - * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -Fred_t -ClassThree_getBadName(const ClassThree_t * ct); - - -/** - * Returns the value of the "badName" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose badName is sought. - * - * @return the value of the "badName" attribute of this ClassThree_t as a const - * char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_classthree_badName - * The possible values returned by this method are: - * @li @c "tom" - * @li @c "dick" - * @li @c "invalid Fred value" - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -char * -ClassThree_getBadNameAsString(const ClassThree_t * ct); - - -/** - * Returns the value of the "otherNum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose otherNum is sought. - * - * @return the value of the "otherNum" attribute of this ClassThree_t as a - * Enum_t. - * - * @copydetails doc_classthree_otherNum - * @if clike The value is drawn from the enumeration @ref Enum_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} - * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} - * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -Enum_t -ClassThree_getOtherNum(const ClassThree_t * ct); - - -/** - * Returns the value of the "otherNum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose otherNum is sought. - * - * @return the value of the "otherNum" attribute of this ClassThree_t as a - * const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_classthree_otherNum - * The possible values returned by this method are: - * @li @c "One" - * @li @c "Two" - * @li @c "invalid Enum value" - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -char * -ClassThree_getOtherNumAsString(const ClassThree_t * ct); - - -/** - * Returns the value of the "longEnum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose longEnum is sought. - * - * @return the value of the "longEnum" attribute of this ClassThree_t as a - * ExtraLong_t. - * - * @copydetails doc_classthree_longEnum - * @if clike The value is drawn from the enumeration @ref ExtraLong_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{TEST_EXTRALONG_FRANK, ExtraLong_t} - * @li @sbmlconstant{TEST_EXTRALONG_SARAH, ExtraLong_t} - * @li @sbmlconstant{TEST_EXTRALONG_INVALID, ExtraLong_t} - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -ExtraLong_t -ClassThree_getLongEnum(const ClassThree_t * ct); - - -/** - * Returns the value of the "longEnum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure whose longEnum is sought. - * - * @return the value of the "longEnum" attribute of this ClassThree_t as a - * const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_classthree_longEnum - * The possible values returned by this method are: - * @li @c "http://identifiers.org/combine.specifications/sbgn.pd.level-1.version-1.3" - * @li @c "sarahasdfghjklkjhgfdsasdfghjhjklqwertyqwrtyhgfdssfghkjakakalkalklpoiutytrewhhhhhhhsshshshshshhshshhshhshhsssssssssssaaevenlongerlongerlongeraZ" - * @li @c "invalid ExtraLong value" - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -char * -ClassThree_getLongEnumAsString(const ClassThree_t * ct); - - -/** - * Predicate returning @c 1 (true) if this ClassThree_t's "number" attribute is - * set. - * - * @param ct the ClassThree_t structure. - * - * @return @c 1 (true) if this ClassThree_t's "number" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @copydetails doc_classthree_number - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_isSetNumber(const ClassThree_t * ct); - - -/** - * Predicate returning @c 1 (true) if this ClassThree_t's "name" attribute is - * set. - * - * @param ct the ClassThree_t structure. - * - * @return @c 1 (true) if this ClassThree_t's "name" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @copydetails doc_classthree_name - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_isSetName(const ClassThree_t * ct); - - -/** - * Predicate returning @c 1 (true) if this ClassThree_t's "badName" attribute - * is set. - * - * @param ct the ClassThree_t structure. - * - * @return @c 1 (true) if this ClassThree_t's "badName" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @copydetails doc_classthree_badName - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_isSetBadName(const ClassThree_t * ct); - - -/** - * Predicate returning @c 1 (true) if this ClassThree_t's "otherNum" attribute - * is set. - * - * @param ct the ClassThree_t structure. - * - * @return @c 1 (true) if this ClassThree_t's "otherNum" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @copydetails doc_classthree_otherNum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_isSetOtherNum(const ClassThree_t * ct); - - -/** - * Predicate returning @c 1 (true) if this ClassThree_t's "longEnum" attribute - * is set. - * - * @param ct the ClassThree_t structure. - * - * @return @c 1 (true) if this ClassThree_t's "longEnum" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @copydetails doc_classthree_longEnum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_isSetLongEnum(const ClassThree_t * ct); - - -/** - * Sets the value of the "number" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param number Enum_t value of the "number" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_number - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setNumber(ClassThree_t * ct, Enum_t number); - - -/** - * Sets the value of the "number" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param number const char * of the "number" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_number - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setNumberAsString(ClassThree_t * ct, const char * number); - - -/** - * Sets the value of the "name" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param name Fred_t value of the "name" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_name - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setName(ClassThree_t * ct, Fred_t name); - - -/** - * Sets the value of the "name" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param name const char * of the "name" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_name - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setNameAsString(ClassThree_t * ct, const char * name); - - -/** - * Sets the value of the "badName" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param badName Fred_t value of the "badName" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_badName - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setBadName(ClassThree_t * ct, Fred_t badName); - - -/** - * Sets the value of the "badName" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param badName const char * of the "badName" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_badName - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setBadNameAsString(ClassThree_t * ct, const char * badName); - - -/** - * Sets the value of the "otherNum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param otherNum Enum_t value of the "otherNum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_otherNum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setOtherNum(ClassThree_t * ct, Enum_t otherNum); - - -/** - * Sets the value of the "otherNum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param otherNum const char * of the "otherNum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_otherNum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setOtherNumAsString(ClassThree_t * ct, const char * otherNum); - - -/** - * Sets the value of the "longEnum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param longEnum ExtraLong_t value of the "longEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_longEnum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setLongEnum(ClassThree_t * ct, ExtraLong_t longEnum); - - -/** - * Sets the value of the "longEnum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @param longEnum const char * of the "longEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_longEnum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_setLongEnumAsString(ClassThree_t * ct, const char * longEnum); - - -/** - * Unsets the value of the "number" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_number - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_unsetNumber(ClassThree_t * ct); - - -/** - * Unsets the value of the "name" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_name - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_unsetName(ClassThree_t * ct); - - -/** - * Unsets the value of the "badName" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_badName - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_unsetBadName(ClassThree_t * ct); - - -/** - * Unsets the value of the "otherNum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_otherNum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_unsetOtherNum(ClassThree_t * ct); - - -/** - * Unsets the value of the "longEnum" attribute of this ClassThree_t. - * - * @param ct the ClassThree_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_classthree_longEnum - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_unsetLongEnum(ClassThree_t * ct); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassThree_t object have been set. - * - * @param ct the ClassThree_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * ClassThree_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the ClassThree_t object are: - * @li "number" - * @li "name" - * - * @memberof ClassThree_t - */ -LIBSBML_EXTERN -int -ClassThree_hasRequiredAttributes(const ClassThree_t * ct); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ClassThree_H__ */ - - +/** + * @file ClassThree.h + * @brief Definition of the ClassThree class. + * @author SBMLTeam + * + * + * + * @class ClassThree + * @sbmlbrief{test} TODO:Definition of the ClassThree class. + */ + +/** + * + * + * + * @class doc_classthree_number + * + * @par + * The attribute "number" on a ClassThree object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Test specification, the following are the + * allowable values for "number": + *
    + *
  • @c "One", TODO:add description + * + *
  • @c "Two", TODO:add description + * + *
+ * + * @class doc_classthree_name + * + * @par + * The attribute "name" on a ClassThree object is used to TODO:add explanation + * + * In the SBML + * Level 3 Version 1 Test specification, the following are the + * allowable values for "name": + *
    + *
  • @c "tom", TODO:add description + * + *
  • @c "dick", TODO:add description + * + *
+ * + * @class doc_classthree_badName + * + * @par + * The attribute "badName" on a ClassThree object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Test specification, the following are the + * allowable values for "badName": + *
    + *
  • @c "tom", TODO:add description + * + *
  • @c "dick", TODO:add description + * + *
+ * + * @class doc_classthree_otherNum + * + * @par + * The attribute "otherNum" on a ClassThree object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Test specification, the following are the + * allowable values for "otherNum": + *
    + *
  • @c "One", TODO:add description + * + *
  • @c "Two", TODO:add description + * + *
+ * + * @class doc_classthree_longEnum + * + * @par + * The attribute "longEnum" on a ClassThree object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Test specification, the following are the + * allowable values for "longEnum": + *
    + *
  • @c "http://identifiers.org/combine.specifications/sbgn.pd.level-1.version-1.3", TODO:add description + * + *
  • @c "sarahasdfghjklkjhgfdsasdfghjhjklqwertyqwrtyhgfdssfghkjakakalkalklpoiutytrewhhhhhhhsshshshshshhshshhshhshhsssssssssssaaevenlongerlongerlongeraZ", TODO:add description + * + *
+ */ + + +#ifndef ClassThree_H__ +#define ClassThree_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ClassThree : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + Enum_t mNumber; + Fred_t mBadName; + Enum_t mOtherNum; + ExtraLong_t mLongEnum; + + /** @endcond */ + +public: + + /** + * Creates a new ClassThree using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ClassThree. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassThree. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * ClassThree. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassThree(unsigned int level = TestExtension::getDefaultLevel(), + unsigned int version = TestExtension::getDefaultVersion(), + unsigned int pkgVersion = + TestExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ClassThree using the given TestPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param testns the TestPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassThree(TestPkgNamespaces *testns); + + + /** + * Copy constructor for ClassThree. + * + * @param orig the ClassThree instance to copy. + */ + ClassThree(const ClassThree& orig); + + + /** + * Assignment operator for ClassThree. + * + * @param rhs the ClassThree object whose values are to be used as the basis + * of the assignment. + */ + ClassThree& operator=(const ClassThree& rhs); + + + /** + * Creates and returns a deep copy of this ClassThree object. + * + * @return a (deep) copy of this ClassThree object. + */ + virtual ClassThree* clone() const; + + + /** + * Destructor for ClassThree. + */ + virtual ~ClassThree(); + + + /** + * Returns the value of the "number" attribute of this ClassThree. + * + * @return the value of the "number" attribute of this ClassThree as a + * Enum_t. + * + * @copydetails doc_classthree_number + * @if clike The value is drawn from the enumeration @ref Enum_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} + * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} + * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} + */ + Enum_t getNumber() const; + + + /** + * Returns the value of the "number" attribute of this ClassThree. + * + * @return the value of the "number" attribute of this ClassThree as a + * string. + * + * @copydetails doc_classthree_number + * The possible values returned by this method are: + * @li @c "One" + * @li @c "Two" + * @li @c "invalid Enum value" + */ + std::string getNumberAsString() const; + + + /** + * Returns the value of the "name" attribute of this ClassThree. + * + * @return the value of the "name" attribute of this ClassThree as a Fred_t. + * + * @copydetails doc_classthree_name + * @if clike The value is drawn from the enumeration @ref Fred_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} + * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} + * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} + */ + virtual Fred_t getName() const; + + + /** + * Returns the value of the "name" attribute of this ClassThree. + * + * @return the value of the "name" attribute of this ClassThree as a string. + * + * @copydetails doc_classthree_name + * The possible values returned by this method are: + * @li @c "tom" + * @li @c "dick" + * @li @c "invalid Fred value" + */ + std::string getNameAsString() const; + + + /** + * Returns the value of the "badName" attribute of this ClassThree. + * + * @return the value of the "badName" attribute of this ClassThree as a + * Fred_t. + * + * @copydetails doc_classthree_badName + * @if clike The value is drawn from the enumeration @ref Fred_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} + * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} + * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} + */ + Fred_t getBadName() const; + + + /** + * Returns the value of the "badName" attribute of this ClassThree. + * + * @return the value of the "badName" attribute of this ClassThree as a + * string. + * + * @copydetails doc_classthree_badName + * The possible values returned by this method are: + * @li @c "tom" + * @li @c "dick" + * @li @c "invalid Fred value" + */ + std::string getBadNameAsString() const; + + + /** + * Returns the value of the "otherNum" attribute of this ClassThree. + * + * @return the value of the "otherNum" attribute of this ClassThree as a + * Enum_t. + * + * @copydetails doc_classthree_otherNum + * @if clike The value is drawn from the enumeration @ref Enum_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} + * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} + * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} + */ + Enum_t getOtherNum() const; + + + /** + * Returns the value of the "otherNum" attribute of this ClassThree. + * + * @return the value of the "otherNum" attribute of this ClassThree as a + * string. + * + * @copydetails doc_classthree_otherNum + * The possible values returned by this method are: + * @li @c "One" + * @li @c "Two" + * @li @c "invalid Enum value" + */ + std::string getOtherNumAsString() const; + + + /** + * Returns the value of the "longEnum" attribute of this ClassThree. + * + * @return the value of the "longEnum" attribute of this ClassThree as a + * ExtraLong_t. + * + * @copydetails doc_classthree_longEnum + * @if clike The value is drawn from the enumeration @ref ExtraLong_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_EXTRALONG_FRANK, ExtraLong_t} + * @li @sbmlconstant{TEST_EXTRALONG_SARAH, ExtraLong_t} + * @li @sbmlconstant{TEST_EXTRALONG_INVALID, ExtraLong_t} + */ + ExtraLong_t getLongEnum() const; + + + /** + * Returns the value of the "longEnum" attribute of this ClassThree. + * + * @return the value of the "longEnum" attribute of this ClassThree as a + * string. + * + * @copydetails doc_classthree_longEnum + * The possible values returned by this method are: + * @li @c "http://identifiers.org/combine.specifications/sbgn.pd.level-1.version-1.3" + * @li @c "sarahasdfghjklkjhgfdsasdfghjhjklqwertyqwrtyhgfdssfghkjakakalkalklpoiutytrewhhhhhhhsshshshshshhshshhshhshhsssssssssssaaevenlongerlongerlongeraZ" + * @li @c "invalid ExtraLong value" + */ + std::string getLongEnumAsString() const; + + + /** + * Predicate returning @c true if this ClassThree's "number" attribute is + * set. + * + * @return @c true if this ClassThree's "number" attribute has been set, + * otherwise @c false is returned. + * + * @copydetails doc_classthree_number + */ + bool isSetNumber() const; + + + /** + * Predicate returning @c true if this ClassThree's "name" attribute is set. + * + * @return @c true if this ClassThree's "name" attribute has been set, + * otherwise @c false is returned. + * + * @copydetails doc_classthree_name + */ + virtual bool isSetName() const; + + + /** + * Predicate returning @c true if this ClassThree's "badName" attribute is + * set. + * + * @return @c true if this ClassThree's "badName" attribute has been set, + * otherwise @c false is returned. + * + * @copydetails doc_classthree_badName + */ + bool isSetBadName() const; + + + /** + * Predicate returning @c true if this ClassThree's "otherNum" attribute is + * set. + * + * @return @c true if this ClassThree's "otherNum" attribute has been set, + * otherwise @c false is returned. + * + * @copydetails doc_classthree_otherNum + */ + bool isSetOtherNum() const; + + + /** + * Predicate returning @c true if this ClassThree's "longEnum" attribute is + * set. + * + * @return @c true if this ClassThree's "longEnum" attribute has been set, + * otherwise @c false is returned. + * + * @copydetails doc_classthree_longEnum + */ + bool isSetLongEnum() const; + + + /** + * Sets the value of the "number" attribute of this ClassThree. + * + * @param number @if clike Enum_t@else int@endif value of the "number" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_number + */ + int setNumber(const Enum_t number); + + + /** + * Sets the value of the "number" attribute of this ClassThree. + * + * @param number std::string& of the "number" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_number + */ + int setNumber(const std::string& number); + + + /** + * Sets the value of the "name" attribute of this ClassThree. + * + * @param name @if clike Fred_t@else int@endif value of the "name" attribute + * to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_name + */ + virtual int setName(const Fred_t name); + + + /** + * Sets the value of the "name" attribute of this ClassThree. + * + * @param name std::string& of the "name" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_name + */ + int setName(const std::string& name); + + + /** + * Sets the value of the "badName" attribute of this ClassThree. + * + * @param badName @if clike Fred_t@else int@endif value of the "badName" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_badName + */ + int setBadName(const Fred_t badName); + + + /** + * Sets the value of the "badName" attribute of this ClassThree. + * + * @param badName std::string& of the "badName" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_badName + */ + int setBadName(const std::string& badName); + + + /** + * Sets the value of the "otherNum" attribute of this ClassThree. + * + * @param otherNum @if clike Enum_t@else int@endif value of the "otherNum" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_otherNum + */ + int setOtherNum(const Enum_t otherNum); + + + /** + * Sets the value of the "otherNum" attribute of this ClassThree. + * + * @param otherNum std::string& of the "otherNum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_otherNum + */ + int setOtherNum(const std::string& otherNum); + + + /** + * Sets the value of the "longEnum" attribute of this ClassThree. + * + * @param longEnum @if clike ExtraLong_t@else int@endif value of the + * "longEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_longEnum + */ + int setLongEnum(const ExtraLong_t longEnum); + + + /** + * Sets the value of the "longEnum" attribute of this ClassThree. + * + * @param longEnum std::string& of the "longEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_classthree_longEnum + */ + int setLongEnum(const std::string& longEnum); + + + /** + * Unsets the value of the "number" attribute of this ClassThree. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_classthree_number + */ + int unsetNumber(); + + + /** + * Unsets the value of the "name" attribute of this ClassThree. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_classthree_name + */ + virtual int unsetName(); + + + /** + * Unsets the value of the "badName" attribute of this ClassThree. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_classthree_badName + */ + int unsetBadName(); + + + /** + * Unsets the value of the "otherNum" attribute of this ClassThree. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_classthree_otherNum + */ + int unsetOtherNum(); + + + /** + * Unsets the value of the "longEnum" attribute of this ClassThree. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_classthree_longEnum + */ + int unsetLongEnum(); + + + /** + * Returns the XML element name of this ClassThree object. + * + * For ClassThree, the XML element name is always @c "classThree". + * + * @return the name of this element, i.e. @c "classThree". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ClassThree object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_TEST_CLASSTHREE, SBMLTestTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * ClassThree object have been set. + * + * @return @c true to indicate that all the required attributes of this + * ClassThree have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the ClassThree object are: + * @li "number" + * @li "name" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ClassThree's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ClassThree's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this ClassThree. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ClassThree_t using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ClassThree_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassThree_t. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * ClassThree_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +ClassThree_t * +ClassThree_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ClassThree_t object. + * + * @param ct the ClassThree_t structure. + * + * @return a (deep) copy of this ClassThree_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +ClassThree_t* +ClassThree_clone(const ClassThree_t* ct); + + +/** + * Frees this ClassThree_t object. + * + * @param ct the ClassThree_t structure. + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +void +ClassThree_free(ClassThree_t* ct); + + +/** + * Returns the value of the "number" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose number is sought. + * + * @return the value of the "number" attribute of this ClassThree_t as a + * Enum_t. + * + * @copydetails doc_classthree_number + * @if clike The value is drawn from the enumeration @ref Enum_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} + * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} + * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +Enum_t +ClassThree_getNumber(const ClassThree_t * ct); + + +/** + * Returns the value of the "number" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose number is sought. + * + * @return the value of the "number" attribute of this ClassThree_t as a const + * char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_classthree_number + * The possible values returned by this method are: + * @li @c "One" + * @li @c "Two" + * @li @c "invalid Enum value" + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +char * +ClassThree_getNumberAsString(const ClassThree_t * ct); + + +/** + * Returns the value of the "name" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose name is sought. + * + * @return the value of the "name" attribute of this ClassThree_t as a Fred_t. + * + * @copydetails doc_classthree_name + * @if clike The value is drawn from the enumeration @ref Fred_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} + * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} + * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +Fred_t +ClassThree_getName(const ClassThree_t * ct); + + +/** + * Returns the value of the "name" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose name is sought. + * + * @return the value of the "name" attribute of this ClassThree_t as a const + * char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_classthree_name + * The possible values returned by this method are: + * @li @c "tom" + * @li @c "dick" + * @li @c "invalid Fred value" + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +char * +ClassThree_getNameAsString(const ClassThree_t * ct); + + +/** + * Returns the value of the "badName" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose badName is sought. + * + * @return the value of the "badName" attribute of this ClassThree_t as a + * Fred_t. + * + * @copydetails doc_classthree_badName + * @if clike The value is drawn from the enumeration @ref Fred_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_FRED_T_TOM, Fred_t} + * @li @sbmlconstant{TEST_FRED_T_DICK, Fred_t} + * @li @sbmlconstant{TEST_FRED_INVALID, Fred_t} + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +Fred_t +ClassThree_getBadName(const ClassThree_t * ct); + + +/** + * Returns the value of the "badName" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose badName is sought. + * + * @return the value of the "badName" attribute of this ClassThree_t as a const + * char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_classthree_badName + * The possible values returned by this method are: + * @li @c "tom" + * @li @c "dick" + * @li @c "invalid Fred value" + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +char * +ClassThree_getBadNameAsString(const ClassThree_t * ct); + + +/** + * Returns the value of the "otherNum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose otherNum is sought. + * + * @return the value of the "otherNum" attribute of this ClassThree_t as a + * Enum_t. + * + * @copydetails doc_classthree_otherNum + * @if clike The value is drawn from the enumeration @ref Enum_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_ENUM_ONE, Enum_t} + * @li @sbmlconstant{TEST_ENUM_TWO, Enum_t} + * @li @sbmlconstant{TEST_ENUM_INVALID, Enum_t} + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +Enum_t +ClassThree_getOtherNum(const ClassThree_t * ct); + + +/** + * Returns the value of the "otherNum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose otherNum is sought. + * + * @return the value of the "otherNum" attribute of this ClassThree_t as a + * const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_classthree_otherNum + * The possible values returned by this method are: + * @li @c "One" + * @li @c "Two" + * @li @c "invalid Enum value" + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +char * +ClassThree_getOtherNumAsString(const ClassThree_t * ct); + + +/** + * Returns the value of the "longEnum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose longEnum is sought. + * + * @return the value of the "longEnum" attribute of this ClassThree_t as a + * ExtraLong_t. + * + * @copydetails doc_classthree_longEnum + * @if clike The value is drawn from the enumeration @ref ExtraLong_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{TEST_EXTRALONG_FRANK, ExtraLong_t} + * @li @sbmlconstant{TEST_EXTRALONG_SARAH, ExtraLong_t} + * @li @sbmlconstant{TEST_EXTRALONG_INVALID, ExtraLong_t} + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +ExtraLong_t +ClassThree_getLongEnum(const ClassThree_t * ct); + + +/** + * Returns the value of the "longEnum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure whose longEnum is sought. + * + * @return the value of the "longEnum" attribute of this ClassThree_t as a + * const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_classthree_longEnum + * The possible values returned by this method are: + * @li @c "http://identifiers.org/combine.specifications/sbgn.pd.level-1.version-1.3" + * @li @c "sarahasdfghjklkjhgfdsasdfghjhjklqwertyqwrtyhgfdssfghkjakakalkalklpoiutytrewhhhhhhhsshshshshshhshshhshhshhsssssssssssaaevenlongerlongerlongeraZ" + * @li @c "invalid ExtraLong value" + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +char * +ClassThree_getLongEnumAsString(const ClassThree_t * ct); + + +/** + * Predicate returning @c 1 (true) if this ClassThree_t's "number" attribute is + * set. + * + * @param ct the ClassThree_t structure. + * + * @return @c 1 (true) if this ClassThree_t's "number" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @copydetails doc_classthree_number + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_isSetNumber(const ClassThree_t * ct); + + +/** + * Predicate returning @c 1 (true) if this ClassThree_t's "name" attribute is + * set. + * + * @param ct the ClassThree_t structure. + * + * @return @c 1 (true) if this ClassThree_t's "name" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @copydetails doc_classthree_name + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_isSetName(const ClassThree_t * ct); + + +/** + * Predicate returning @c 1 (true) if this ClassThree_t's "badName" attribute + * is set. + * + * @param ct the ClassThree_t structure. + * + * @return @c 1 (true) if this ClassThree_t's "badName" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @copydetails doc_classthree_badName + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_isSetBadName(const ClassThree_t * ct); + + +/** + * Predicate returning @c 1 (true) if this ClassThree_t's "otherNum" attribute + * is set. + * + * @param ct the ClassThree_t structure. + * + * @return @c 1 (true) if this ClassThree_t's "otherNum" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @copydetails doc_classthree_otherNum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_isSetOtherNum(const ClassThree_t * ct); + + +/** + * Predicate returning @c 1 (true) if this ClassThree_t's "longEnum" attribute + * is set. + * + * @param ct the ClassThree_t structure. + * + * @return @c 1 (true) if this ClassThree_t's "longEnum" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @copydetails doc_classthree_longEnum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_isSetLongEnum(const ClassThree_t * ct); + + +/** + * Sets the value of the "number" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param number Enum_t value of the "number" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_number + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setNumber(ClassThree_t * ct, Enum_t number); + + +/** + * Sets the value of the "number" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param number const char * of the "number" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_number + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setNumberAsString(ClassThree_t * ct, const char * number); + + +/** + * Sets the value of the "name" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param name Fred_t value of the "name" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_name + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setName(ClassThree_t * ct, Fred_t name); + + +/** + * Sets the value of the "name" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param name const char * of the "name" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_name + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setNameAsString(ClassThree_t * ct, const char * name); + + +/** + * Sets the value of the "badName" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param badName Fred_t value of the "badName" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_badName + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setBadName(ClassThree_t * ct, Fred_t badName); + + +/** + * Sets the value of the "badName" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param badName const char * of the "badName" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_badName + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setBadNameAsString(ClassThree_t * ct, const char * badName); + + +/** + * Sets the value of the "otherNum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param otherNum Enum_t value of the "otherNum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_otherNum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setOtherNum(ClassThree_t * ct, Enum_t otherNum); + + +/** + * Sets the value of the "otherNum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param otherNum const char * of the "otherNum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_otherNum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setOtherNumAsString(ClassThree_t * ct, const char * otherNum); + + +/** + * Sets the value of the "longEnum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param longEnum ExtraLong_t value of the "longEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_longEnum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setLongEnum(ClassThree_t * ct, ExtraLong_t longEnum); + + +/** + * Sets the value of the "longEnum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @param longEnum const char * of the "longEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_longEnum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_setLongEnumAsString(ClassThree_t * ct, const char * longEnum); + + +/** + * Unsets the value of the "number" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_number + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_unsetNumber(ClassThree_t * ct); + + +/** + * Unsets the value of the "name" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_name + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_unsetName(ClassThree_t * ct); + + +/** + * Unsets the value of the "badName" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_badName + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_unsetBadName(ClassThree_t * ct); + + +/** + * Unsets the value of the "otherNum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_otherNum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_unsetOtherNum(ClassThree_t * ct); + + +/** + * Unsets the value of the "longEnum" attribute of this ClassThree_t. + * + * @param ct the ClassThree_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_classthree_longEnum + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_unsetLongEnum(ClassThree_t * ct); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassThree_t object have been set. + * + * @param ct the ClassThree_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * ClassThree_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the ClassThree_t object are: + * @li "number" + * @li "name" + * + * @memberof ClassThree_t + */ +LIBSBML_EXTERN +int +ClassThree_hasRequiredAttributes(const ClassThree_t * ct); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ClassThree_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ClassTwo.cpp b/generator/tests/test_cpp_code/test-code/ClassTwo.cpp index a6fcb8ba..5ccb5a39 100644 --- a/generator/tests/test_cpp_code/test-code/ClassTwo.cpp +++ b/generator/tests/test_cpp_code/test-code/ClassTwo.cpp @@ -1,468 +1,468 @@ -/** - * @file ClassTwo.cpp - * @brief Implementation of the ClassTwo class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ClassTwo using the given SBML Level, Version and - * “test” package version. - */ -ClassTwo::ClassTwo(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) -{ - setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); -} - - -/* - * Creates a new ClassTwo using the given TestPkgNamespaces object. - */ -ClassTwo::ClassTwo(TestPkgNamespaces *testns) - : SBase(testns) -{ - setElementNamespace(testns->getURI()); - loadPlugins(testns); -} - - -/* - * Copy constructor for ClassTwo. - */ -ClassTwo::ClassTwo(const ClassTwo& orig) - : SBase( orig ) -{ -} - - -/* - * Assignment operator for ClassTwo. - */ -ClassTwo& -ClassTwo::operator=(const ClassTwo& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ClassTwo object. - */ -ClassTwo* -ClassTwo::clone() const -{ - return new ClassTwo(*this); -} - - -/* - * Destructor for ClassTwo. - */ -ClassTwo::~ClassTwo() -{ -} - - -/* - * Returns the XML element name of this ClassTwo object. - */ -const std::string& -ClassTwo::getElementName() const -{ - static const string name = "classTwo"; - return name; -} - - -/* - * Returns the libSBML type code for this ClassTwo object. - */ -int -ClassTwo::getTypeCode() const -{ - return SBML_TEST_CLASSTWO; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ClassTwo::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ClassTwo::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ClassTwo::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ClassTwo::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ClassTwo's attribute "attributeName" is - * set. - */ -bool -ClassTwo::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this ClassTwo. - */ -int -ClassTwo::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ClassTwo_t using the given SBML Level, Version and - * “test” package version. - */ -LIBSBML_EXTERN -ClassTwo_t * -ClassTwo_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ClassTwo(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ClassTwo_t object. - */ -LIBSBML_EXTERN -ClassTwo_t* -ClassTwo_clone(const ClassTwo_t* ct) -{ - if (ct != NULL) - { - return static_cast(ct->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ClassTwo_t object. - */ -LIBSBML_EXTERN -void -ClassTwo_free(ClassTwo_t* ct) -{ - if (ct != NULL) - { - delete ct; - } -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ClassTwo.cpp + * @brief Implementation of the ClassTwo class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ClassTwo using the given SBML Level, Version and + * “test” package version. + */ +ClassTwo::ClassTwo(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) +{ + setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); +} + + +/* + * Creates a new ClassTwo using the given TestPkgNamespaces object. + */ +ClassTwo::ClassTwo(TestPkgNamespaces *testns) + : SBase(testns) +{ + setElementNamespace(testns->getURI()); + loadPlugins(testns); +} + + +/* + * Copy constructor for ClassTwo. + */ +ClassTwo::ClassTwo(const ClassTwo& orig) + : SBase( orig ) +{ +} + + +/* + * Assignment operator for ClassTwo. + */ +ClassTwo& +ClassTwo::operator=(const ClassTwo& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ClassTwo object. + */ +ClassTwo* +ClassTwo::clone() const +{ + return new ClassTwo(*this); +} + + +/* + * Destructor for ClassTwo. + */ +ClassTwo::~ClassTwo() +{ +} + + +/* + * Returns the XML element name of this ClassTwo object. + */ +const std::string& +ClassTwo::getElementName() const +{ + static const string name = "classTwo"; + return name; +} + + +/* + * Returns the libSBML type code for this ClassTwo object. + */ +int +ClassTwo::getTypeCode() const +{ + return SBML_TEST_CLASSTWO; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ClassTwo::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ClassTwo::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ClassTwo::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ClassTwo::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ClassTwo's attribute "attributeName" is + * set. + */ +bool +ClassTwo::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this ClassTwo. + */ +int +ClassTwo::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ClassTwo_t using the given SBML Level, Version and + * “test” package version. + */ +LIBSBML_EXTERN +ClassTwo_t * +ClassTwo_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ClassTwo(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ClassTwo_t object. + */ +LIBSBML_EXTERN +ClassTwo_t* +ClassTwo_clone(const ClassTwo_t* ct) +{ + if (ct != NULL) + { + return static_cast(ct->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ClassTwo_t object. + */ +LIBSBML_EXTERN +void +ClassTwo_free(ClassTwo_t* ct) +{ + if (ct != NULL) + { + delete ct; + } +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ClassTwo.h b/generator/tests/test_cpp_code/test-code/ClassTwo.h index 644aafc9..84eea32b 100644 --- a/generator/tests/test_cpp_code/test-code/ClassTwo.h +++ b/generator/tests/test_cpp_code/test-code/ClassTwo.h @@ -1,545 +1,545 @@ -/** - * @file ClassTwo.h - * @brief Definition of the ClassTwo class. - * @author SBMLTeam - * - * - * - * @class ClassTwo - * @sbmlbrief{test} TODO:Definition of the ClassTwo class. - */ - - -#ifndef ClassTwo_H__ -#define ClassTwo_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ClassTwo : public SBase -{ - -public: - - /** - * Creates a new ClassTwo using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ClassTwo. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassTwo. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * ClassTwo. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassTwo(unsigned int level = TestExtension::getDefaultLevel(), - unsigned int version = TestExtension::getDefaultVersion(), - unsigned int pkgVersion = - TestExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ClassTwo using the given TestPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param testns the TestPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassTwo(TestPkgNamespaces *testns); - - - /** - * Copy constructor for ClassTwo. - * - * @param orig the ClassTwo instance to copy. - */ - ClassTwo(const ClassTwo& orig); - - - /** - * Assignment operator for ClassTwo. - * - * @param rhs the ClassTwo object whose values are to be used as the basis of - * the assignment. - */ - ClassTwo& operator=(const ClassTwo& rhs); - - - /** - * Creates and returns a deep copy of this ClassTwo object. - * - * @return a (deep) copy of this ClassTwo object. - */ - virtual ClassTwo* clone() const; - - - /** - * Destructor for ClassTwo. - */ - virtual ~ClassTwo(); - - - /** - * Returns the XML element name of this ClassTwo object. - * - * For ClassTwo, the XML element name is always @c "classTwo". - * - * @return the name of this element, i.e. @c "classTwo". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ClassTwo object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_TEST_CLASSTWO, SBMLTestTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ClassTwo's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ClassTwo's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this ClassTwo. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ClassTwo_t using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ClassTwo_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassTwo_t. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * ClassTwo_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassTwo_t - */ -LIBSBML_EXTERN -ClassTwo_t * -ClassTwo_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ClassTwo_t object. - * - * @param ct the ClassTwo_t structure. - * - * @return a (deep) copy of this ClassTwo_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassTwo_t - */ -LIBSBML_EXTERN -ClassTwo_t* -ClassTwo_clone(const ClassTwo_t* ct); - - -/** - * Frees this ClassTwo_t object. - * - * @param ct the ClassTwo_t structure. - * - * @memberof ClassTwo_t - */ -LIBSBML_EXTERN -void -ClassTwo_free(ClassTwo_t* ct); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ClassTwo_H__ */ - - +/** + * @file ClassTwo.h + * @brief Definition of the ClassTwo class. + * @author SBMLTeam + * + * + * + * @class ClassTwo + * @sbmlbrief{test} TODO:Definition of the ClassTwo class. + */ + + +#ifndef ClassTwo_H__ +#define ClassTwo_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ClassTwo : public SBase +{ + +public: + + /** + * Creates a new ClassTwo using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ClassTwo. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassTwo. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * ClassTwo. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassTwo(unsigned int level = TestExtension::getDefaultLevel(), + unsigned int version = TestExtension::getDefaultVersion(), + unsigned int pkgVersion = + TestExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ClassTwo using the given TestPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param testns the TestPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassTwo(TestPkgNamespaces *testns); + + + /** + * Copy constructor for ClassTwo. + * + * @param orig the ClassTwo instance to copy. + */ + ClassTwo(const ClassTwo& orig); + + + /** + * Assignment operator for ClassTwo. + * + * @param rhs the ClassTwo object whose values are to be used as the basis of + * the assignment. + */ + ClassTwo& operator=(const ClassTwo& rhs); + + + /** + * Creates and returns a deep copy of this ClassTwo object. + * + * @return a (deep) copy of this ClassTwo object. + */ + virtual ClassTwo* clone() const; + + + /** + * Destructor for ClassTwo. + */ + virtual ~ClassTwo(); + + + /** + * Returns the XML element name of this ClassTwo object. + * + * For ClassTwo, the XML element name is always @c "classTwo". + * + * @return the name of this element, i.e. @c "classTwo". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ClassTwo object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_TEST_CLASSTWO, SBMLTestTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ClassTwo's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ClassTwo's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this ClassTwo. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ClassTwo_t using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ClassTwo_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassTwo_t. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * ClassTwo_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassTwo_t + */ +LIBSBML_EXTERN +ClassTwo_t * +ClassTwo_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ClassTwo_t object. + * + * @param ct the ClassTwo_t structure. + * + * @return a (deep) copy of this ClassTwo_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassTwo_t + */ +LIBSBML_EXTERN +ClassTwo_t* +ClassTwo_clone(const ClassTwo_t* ct); + + +/** + * Frees this ClassTwo_t object. + * + * @param ct the ClassTwo_t structure. + * + * @memberof ClassTwo_t + */ +LIBSBML_EXTERN +void +ClassTwo_free(ClassTwo_t* ct); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ClassTwo_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.cpp b/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.cpp index 916c597b..66ddf040 100644 --- a/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.cpp +++ b/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.cpp @@ -1,1030 +1,1030 @@ -/** - * @file ClassWithRequiredID.cpp - * @brief Implementation of the ClassWithRequiredID class. - * @author SBMLTeam - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ClassWithRequiredID using the given SBML Level, Version and - * “twoatonce” package version. - */ -ClassWithRequiredID::ClassWithRequiredID(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) -{ - setSBMLNamespacesAndOwn(new TwoatoncePkgNamespaces(level, version, - pkgVersion)); -} - - -/* - * Creates a new ClassWithRequiredID using the given TwoatoncePkgNamespaces - * object. - */ -ClassWithRequiredID::ClassWithRequiredID(TwoatoncePkgNamespaces *twoatoncens) - : SBase(twoatoncens) -{ - setElementNamespace(twoatoncens->getURI()); - loadPlugins(twoatoncens); -} - - -/* - * Copy constructor for ClassWithRequiredID. - */ -ClassWithRequiredID::ClassWithRequiredID(const ClassWithRequiredID& orig) - : SBase( orig ) -{ -} - - -/* - * Assignment operator for ClassWithRequiredID. - */ -ClassWithRequiredID& -ClassWithRequiredID::operator=(const ClassWithRequiredID& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ClassWithRequiredID object. - */ -ClassWithRequiredID* -ClassWithRequiredID::clone() const -{ - return new ClassWithRequiredID(*this); -} - - -/* - * Destructor for ClassWithRequiredID. - */ -ClassWithRequiredID::~ClassWithRequiredID() -{ -} - - -/* - * Returns the value of the "id" attribute of this ClassWithRequiredID. - */ -const std::string& -ClassWithRequiredID::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "name" attribute of this ClassWithRequiredID. - */ -const std::string& -ClassWithRequiredID::getName() const -{ - return mName; -} - - -/* - * Predicate returning @c true if this ClassWithRequiredID's "id" attribute is - * set. - */ -bool -ClassWithRequiredID::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this ClassWithRequiredID's "name" attribute - * is set. - */ -bool -ClassWithRequiredID::isSetName() const -{ - return (mName.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "name" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::setName(const std::string& name) -{ - mName = name; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "name" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::unsetName() -{ - mName.erase(); - - if (mName.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the XML element name of this ClassWithRequiredID object. - */ -const std::string& -ClassWithRequiredID::getElementName() const -{ - static const string name = "classWithRequiredID"; - return name; -} - - -/* - * Returns the libSBML type code for this ClassWithRequiredID object. - */ -int -ClassWithRequiredID::getTypeCode() const -{ - return SBML_TWOATONCE_CLASSWITHREQUIREDID; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * ClassWithRequiredID object have been set. - */ -bool -ClassWithRequiredID::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ClassWithRequiredID::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ClassWithRequiredID::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ClassWithRequiredID::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ClassWithRequiredID::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "name") - { - value = getName(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ClassWithRequiredID's attribute - * "attributeName" is set. - */ -bool -ClassWithRequiredID::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "name") - { - value = isSetName(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. - */ -int -ClassWithRequiredID::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "name") - { - return_value = setName(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - */ -int -ClassWithRequiredID::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "name") - { - value = unsetName(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -ClassWithRequiredID::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - unsigned int level = getLevel(); - unsigned int coreVersion = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && coreVersion == 1 && pkgVersion == 1) - { - attributes.add("id"); - attributes.add("name"); - } - - if (level == 3 && coreVersion == 2 && pkgVersion == 1) - { - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassWithRequiredID::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("twoatonce", - TwoatonceClassWithRequiredIDAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("twoatonce", - TwoatonceClassWithRequiredIDAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - if (level == 3 && version == 1 && pkgVersion == 1) - { - readL3V1V1Attributes(attributes); - } - - if (level == 3 && version == 2 && pkgVersion == 1) - { - readL3V2V1Attributes(attributes); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassWithRequiredID::readL3V1V1Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - - // - // id SId (use = "required" ) - // - - XMLTriple tripleID("id", mURI, getPrefix()); - assigned = attributes.readInto(tripleID, mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("twoatonce", TwoatonceIdSyntaxRule, pkgVersion, - level, version, "The id on the <" + getElementName() + "> is '" + mId + - "', which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Twoatonce attribute 'id' is missing from the " - " element."; - log->logPackageError("twoatonce", - TwoatonceClassWithRequiredIDAllowedAttributes, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } - - // - // name string (use = "optional" ) - // - - XMLTriple tripleNAME("name", mURI, getPrefix()); - assigned = attributes.readInto(tripleNAME, mName); - - if (assigned == true) - { - if (mName.empty() == true) - { - logEmptyString(mName, level, version, ""); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ClassWithRequiredID::readL3V2V1Attributes(const XMLAttributes& attributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - bool assigned = false; - unsigned int pkgVersion = getPackageVersion(); - SBMLErrorLog* log = getErrorLog(); - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("twoatonce", TwoatonceIdSyntaxRule, pkgVersion, - level, version, "The id on the <" + getElementName() + "> is '" + mId + - "', which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Twoatonce attribute 'id' is missing from the " - " element."; - log->logPackageError("twoatonce", - TwoatonceClassWithRequiredIDAllowedAttributes, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } - - // - // name string (use = "optional" ) - // - - // read by SBase; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassWithRequiredID::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - - if (level == 3 && version == 1 && pkgVersion == 1) - { - writeL3V1V1Attributes(stream); - } - - if (level == 3 && version == 2 && pkgVersion == 1) - { - writeL3V2V1Attributes(stream); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassWithRequiredID::writeL3V1V1Attributes(XMLOutputStream& stream) const -{ - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetName() == true) - { - stream.writeAttribute("name", getPrefix(), mName); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ClassWithRequiredID::writeL3V2V1Attributes(XMLOutputStream& stream) const -{ -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ClassWithRequiredID_t using the given SBML Level, Version and - * “twoatonce” package version. - */ -LIBSBML_EXTERN -ClassWithRequiredID_t * -ClassWithRequiredID_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ClassWithRequiredID(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ClassWithRequiredID_t object. - */ -LIBSBML_EXTERN -ClassWithRequiredID_t* -ClassWithRequiredID_clone(const ClassWithRequiredID_t* cwrid) -{ - if (cwrid != NULL) - { - return static_cast(cwrid->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ClassWithRequiredID_t object. - */ -LIBSBML_EXTERN -void -ClassWithRequiredID_free(ClassWithRequiredID_t* cwrid) -{ - if (cwrid != NULL) - { - delete cwrid; - } -} - - -/* - * Returns the value of the "id" attribute of this ClassWithRequiredID_t. - */ -LIBSBML_EXTERN -char * -ClassWithRequiredID_getId(const ClassWithRequiredID_t * cwrid) -{ - if (cwrid == NULL) - { - return NULL; - } - - return cwrid->getId().empty() ? NULL : safe_strdup(cwrid->getId().c_str()); -} - - -/* - * Returns the value of the "name" attribute of this ClassWithRequiredID_t. - */ -LIBSBML_EXTERN -char * -ClassWithRequiredID_getName(const ClassWithRequiredID_t * cwrid) -{ - if (cwrid == NULL) - { - return NULL; - } - - return cwrid->getName().empty() ? NULL : - safe_strdup(cwrid->getName().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "id" - * attribute is set. - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_isSetId(const ClassWithRequiredID_t * cwrid) -{ - return (cwrid != NULL) ? static_cast(cwrid->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "name" - * attribute is set. - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_isSetName(const ClassWithRequiredID_t * cwrid) -{ - return (cwrid != NULL) ? static_cast(cwrid->isSetName()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this ClassWithRequiredID_t. - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_setId(ClassWithRequiredID_t * cwrid, const char * id) -{ - return (cwrid != NULL) ? cwrid->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "name" attribute of this ClassWithRequiredID_t. - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_setName(ClassWithRequiredID_t * cwrid, const char * name) -{ - return (cwrid != NULL) ? cwrid->setName(name) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this ClassWithRequiredID_t. - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_unsetId(ClassWithRequiredID_t * cwrid) -{ - return (cwrid != NULL) ? cwrid->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "name" attribute of this ClassWithRequiredID_t. - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_unsetName(ClassWithRequiredID_t * cwrid) -{ - return (cwrid != NULL) ? cwrid->unsetName() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassWithRequiredID_t object have been set. - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_hasRequiredAttributes(const ClassWithRequiredID_t * cwrid) -{ - return (cwrid != NULL) ? static_cast(cwrid->hasRequiredAttributes()) : - 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ClassWithRequiredID.cpp + * @brief Implementation of the ClassWithRequiredID class. + * @author SBMLTeam + * + * + */ +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ClassWithRequiredID using the given SBML Level, Version and + * “twoatonce” package version. + */ +ClassWithRequiredID::ClassWithRequiredID(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) +{ + setSBMLNamespacesAndOwn(new TwoatoncePkgNamespaces(level, version, + pkgVersion)); +} + + +/* + * Creates a new ClassWithRequiredID using the given TwoatoncePkgNamespaces + * object. + */ +ClassWithRequiredID::ClassWithRequiredID(TwoatoncePkgNamespaces *twoatoncens) + : SBase(twoatoncens) +{ + setElementNamespace(twoatoncens->getURI()); + loadPlugins(twoatoncens); +} + + +/* + * Copy constructor for ClassWithRequiredID. + */ +ClassWithRequiredID::ClassWithRequiredID(const ClassWithRequiredID& orig) + : SBase( orig ) +{ +} + + +/* + * Assignment operator for ClassWithRequiredID. + */ +ClassWithRequiredID& +ClassWithRequiredID::operator=(const ClassWithRequiredID& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ClassWithRequiredID object. + */ +ClassWithRequiredID* +ClassWithRequiredID::clone() const +{ + return new ClassWithRequiredID(*this); +} + + +/* + * Destructor for ClassWithRequiredID. + */ +ClassWithRequiredID::~ClassWithRequiredID() +{ +} + + +/* + * Returns the value of the "id" attribute of this ClassWithRequiredID. + */ +const std::string& +ClassWithRequiredID::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "name" attribute of this ClassWithRequiredID. + */ +const std::string& +ClassWithRequiredID::getName() const +{ + return mName; +} + + +/* + * Predicate returning @c true if this ClassWithRequiredID's "id" attribute is + * set. + */ +bool +ClassWithRequiredID::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this ClassWithRequiredID's "name" attribute + * is set. + */ +bool +ClassWithRequiredID::isSetName() const +{ + return (mName.empty() == false); +} + + +/* + * Sets the value of the "id" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "name" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::setName(const std::string& name) +{ + mName = name; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "id" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "name" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::unsetName() +{ + mName.erase(); + + if (mName.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the XML element name of this ClassWithRequiredID object. + */ +const std::string& +ClassWithRequiredID::getElementName() const +{ + static const string name = "classWithRequiredID"; + return name; +} + + +/* + * Returns the libSBML type code for this ClassWithRequiredID object. + */ +int +ClassWithRequiredID::getTypeCode() const +{ + return SBML_TWOATONCE_CLASSWITHREQUIREDID; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * ClassWithRequiredID object have been set. + */ +bool +ClassWithRequiredID::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ClassWithRequiredID::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ClassWithRequiredID::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ClassWithRequiredID::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ClassWithRequiredID::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "name") + { + value = getName(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ClassWithRequiredID's attribute + * "attributeName" is set. + */ +bool +ClassWithRequiredID::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "name") + { + value = isSetName(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ClassWithRequiredID. + */ +int +ClassWithRequiredID::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "name") + { + return_value = setName(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + */ +int +ClassWithRequiredID::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "name") + { + value = unsetName(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +ClassWithRequiredID::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + unsigned int level = getLevel(); + unsigned int coreVersion = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && coreVersion == 1 && pkgVersion == 1) + { + attributes.add("id"); + attributes.add("name"); + } + + if (level == 3 && coreVersion == 2 && pkgVersion == 1) + { + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassWithRequiredID::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("twoatonce", + TwoatonceClassWithRequiredIDAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("twoatonce", + TwoatonceClassWithRequiredIDAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + if (level == 3 && version == 1 && pkgVersion == 1) + { + readL3V1V1Attributes(attributes); + } + + if (level == 3 && version == 2 && pkgVersion == 1) + { + readL3V2V1Attributes(attributes); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassWithRequiredID::readL3V1V1Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + + // + // id SId (use = "required" ) + // + + XMLTriple tripleID("id", mURI, getPrefix()); + assigned = attributes.readInto(tripleID, mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("twoatonce", TwoatonceIdSyntaxRule, pkgVersion, + level, version, "The id on the <" + getElementName() + "> is '" + mId + + "', which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Twoatonce attribute 'id' is missing from the " + " element."; + log->logPackageError("twoatonce", + TwoatonceClassWithRequiredIDAllowedAttributes, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } + + // + // name string (use = "optional" ) + // + + XMLTriple tripleNAME("name", mURI, getPrefix()); + assigned = attributes.readInto(tripleNAME, mName); + + if (assigned == true) + { + if (mName.empty() == true) + { + logEmptyString(mName, level, version, ""); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ClassWithRequiredID::readL3V2V1Attributes(const XMLAttributes& attributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + bool assigned = false; + unsigned int pkgVersion = getPackageVersion(); + SBMLErrorLog* log = getErrorLog(); + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("twoatonce", TwoatonceIdSyntaxRule, pkgVersion, + level, version, "The id on the <" + getElementName() + "> is '" + mId + + "', which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Twoatonce attribute 'id' is missing from the " + " element."; + log->logPackageError("twoatonce", + TwoatonceClassWithRequiredIDAllowedAttributes, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } + + // + // name string (use = "optional" ) + // + + // read by SBase; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassWithRequiredID::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + + if (level == 3 && version == 1 && pkgVersion == 1) + { + writeL3V1V1Attributes(stream); + } + + if (level == 3 && version == 2 && pkgVersion == 1) + { + writeL3V2V1Attributes(stream); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassWithRequiredID::writeL3V1V1Attributes(XMLOutputStream& stream) const +{ + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetName() == true) + { + stream.writeAttribute("name", getPrefix(), mName); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ClassWithRequiredID::writeL3V2V1Attributes(XMLOutputStream& stream) const +{ +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ClassWithRequiredID_t using the given SBML Level, Version and + * “twoatonce” package version. + */ +LIBSBML_EXTERN +ClassWithRequiredID_t * +ClassWithRequiredID_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ClassWithRequiredID(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ClassWithRequiredID_t object. + */ +LIBSBML_EXTERN +ClassWithRequiredID_t* +ClassWithRequiredID_clone(const ClassWithRequiredID_t* cwrid) +{ + if (cwrid != NULL) + { + return static_cast(cwrid->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ClassWithRequiredID_t object. + */ +LIBSBML_EXTERN +void +ClassWithRequiredID_free(ClassWithRequiredID_t* cwrid) +{ + if (cwrid != NULL) + { + delete cwrid; + } +} + + +/* + * Returns the value of the "id" attribute of this ClassWithRequiredID_t. + */ +LIBSBML_EXTERN +char * +ClassWithRequiredID_getId(const ClassWithRequiredID_t * cwrid) +{ + if (cwrid == NULL) + { + return NULL; + } + + return cwrid->getId().empty() ? NULL : safe_strdup(cwrid->getId().c_str()); +} + + +/* + * Returns the value of the "name" attribute of this ClassWithRequiredID_t. + */ +LIBSBML_EXTERN +char * +ClassWithRequiredID_getName(const ClassWithRequiredID_t * cwrid) +{ + if (cwrid == NULL) + { + return NULL; + } + + return cwrid->getName().empty() ? NULL : + safe_strdup(cwrid->getName().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "id" + * attribute is set. + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_isSetId(const ClassWithRequiredID_t * cwrid) +{ + return (cwrid != NULL) ? static_cast(cwrid->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "name" + * attribute is set. + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_isSetName(const ClassWithRequiredID_t * cwrid) +{ + return (cwrid != NULL) ? static_cast(cwrid->isSetName()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this ClassWithRequiredID_t. + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_setId(ClassWithRequiredID_t * cwrid, const char * id) +{ + return (cwrid != NULL) ? cwrid->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "name" attribute of this ClassWithRequiredID_t. + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_setName(ClassWithRequiredID_t * cwrid, const char * name) +{ + return (cwrid != NULL) ? cwrid->setName(name) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this ClassWithRequiredID_t. + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_unsetId(ClassWithRequiredID_t * cwrid) +{ + return (cwrid != NULL) ? cwrid->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "name" attribute of this ClassWithRequiredID_t. + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_unsetName(ClassWithRequiredID_t * cwrid) +{ + return (cwrid != NULL) ? cwrid->unsetName() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassWithRequiredID_t object have been set. + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_hasRequiredAttributes(const ClassWithRequiredID_t * cwrid) +{ + return (cwrid != NULL) ? static_cast(cwrid->hasRequiredAttributes()) : + 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.h b/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.h index 3ec22082..d4a03c5a 100644 --- a/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.h +++ b/generator/tests/test_cpp_code/test-code/ClassWithRequiredID.h @@ -1,912 +1,912 @@ -/** - * @file ClassWithRequiredID.h - * @brief Definition of the ClassWithRequiredID class. - * @author SBMLTeam - * - * - * - * @class ClassWithRequiredID - * @sbmlbrief{twoatonce} TODO:Definition of the ClassWithRequiredID class. - */ - - -#ifndef ClassWithRequiredID_H__ -#define ClassWithRequiredID_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ClassWithRequiredID : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - - /** @endcond */ - -public: - - /** - * Creates a new ClassWithRequiredID using the given SBML Level, Version and - * “twoatonce” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ClassWithRequiredID. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassWithRequiredID. - * - * @param pkgVersion an unsigned int, the SBML Twoatonce Version to assign to - * this ClassWithRequiredID. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassWithRequiredID(unsigned int level = - TwoatonceExtension::getDefaultLevel(), - unsigned int version = - TwoatonceExtension::getDefaultVersion(), - unsigned int pkgVersion = - TwoatonceExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ClassWithRequiredID using the given TwoatoncePkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param twoatoncens the TwoatoncePkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ClassWithRequiredID(TwoatoncePkgNamespaces *twoatoncens); - - - /** - * Copy constructor for ClassWithRequiredID. - * - * @param orig the ClassWithRequiredID instance to copy. - */ - ClassWithRequiredID(const ClassWithRequiredID& orig); - - - /** - * Assignment operator for ClassWithRequiredID. - * - * @param rhs the ClassWithRequiredID object whose values are to be used as - * the basis of the assignment. - */ - ClassWithRequiredID& operator=(const ClassWithRequiredID& rhs); - - - /** - * Creates and returns a deep copy of this ClassWithRequiredID object. - * - * @return a (deep) copy of this ClassWithRequiredID object. - */ - virtual ClassWithRequiredID* clone() const; - - - /** - * Destructor for ClassWithRequiredID. - */ - virtual ~ClassWithRequiredID(); - - - /** - * Returns the value of the "id" attribute of this ClassWithRequiredID. - * - * @return the value of the "id" attribute of this ClassWithRequiredID as a - * string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "name" attribute of this ClassWithRequiredID. - * - * @return the value of the "name" attribute of this ClassWithRequiredID as a - * string. - */ - virtual const std::string& getName() const; - - - /** - * Predicate returning @c true if this ClassWithRequiredID's "id" attribute - * is set. - * - * @return @c true if this ClassWithRequiredID's "id" attribute has been set, - * otherwise @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this ClassWithRequiredID's "name" attribute - * is set. - * - * @return @c true if this ClassWithRequiredID's "name" attribute has been - * set, otherwise @c false is returned. - */ - virtual bool isSetName() const; - - - /** - * Sets the value of the "id" attribute of this ClassWithRequiredID. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "name" attribute of this ClassWithRequiredID. - * - * @param name std::string& value of the "name" attribute to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p name = @c NULL or an empty string is - * equivalent to calling unsetName(). - */ - virtual int setName(const std::string& name); - - - /** - * Unsets the value of the "id" attribute of this ClassWithRequiredID. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "name" attribute of this ClassWithRequiredID. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetName(); - - - /** - * Returns the XML element name of this ClassWithRequiredID object. - * - * For ClassWithRequiredID, the XML element name is always - * @c "classWithRequiredID". - * - * @return the name of this element, i.e. @c "classWithRequiredID". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ClassWithRequiredID object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_TWOATONCE_CLASSWITHREQUIREDID, - * SBMLTwoatonceTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * ClassWithRequiredID object have been set. - * - * @return @c true to indicate that all the required attributes of this - * ClassWithRequiredID have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the ClassWithRequiredID object are: - * @li "id" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ClassWithRequiredID's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ClassWithRequiredID's attribute "attributeName" - * has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * ClassWithRequiredID. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V1V1Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - void readL3V2V1Attributes(const XMLAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V1V1Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - void writeL3V2V1Attributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ClassWithRequiredID_t using the given SBML Level, Version and - * “twoatonce” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ClassWithRequiredID_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ClassWithRequiredID_t. - * - * @param pkgVersion an unsigned int, the SBML Twoatonce Version to assign to - * this ClassWithRequiredID_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -ClassWithRequiredID_t * -ClassWithRequiredID_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ClassWithRequiredID_t object. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @return a (deep) copy of this ClassWithRequiredID_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -ClassWithRequiredID_t* -ClassWithRequiredID_clone(const ClassWithRequiredID_t* cwrid); - - -/** - * Frees this ClassWithRequiredID_t object. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -void -ClassWithRequiredID_free(ClassWithRequiredID_t* cwrid); - - -/** - * Returns the value of the "id" attribute of this ClassWithRequiredID_t. - * - * @param cwrid the ClassWithRequiredID_t structure whose id is sought. - * - * @return the value of the "id" attribute of this ClassWithRequiredID_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -char * -ClassWithRequiredID_getId(const ClassWithRequiredID_t * cwrid); - - -/** - * Returns the value of the "name" attribute of this ClassWithRequiredID_t. - * - * @param cwrid the ClassWithRequiredID_t structure whose name is sought. - * - * @return the value of the "name" attribute of this ClassWithRequiredID_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -char * -ClassWithRequiredID_getName(const ClassWithRequiredID_t * cwrid); - - -/** - * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "id" - * attribute is set. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @return @c 1 (true) if this ClassWithRequiredID_t's "id" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_isSetId(const ClassWithRequiredID_t * cwrid); - - -/** - * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "name" - * attribute is set. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @return @c 1 (true) if this ClassWithRequiredID_t's "name" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_isSetName(const ClassWithRequiredID_t * cwrid); - - -/** - * Sets the value of the "id" attribute of this ClassWithRequiredID_t. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling ClassWithRequiredID_unsetId(). - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_setId(ClassWithRequiredID_t * cwrid, const char * id); - - -/** - * Sets the value of the "name" attribute of this ClassWithRequiredID_t. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @param name const char * value of the "name" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p name = @c NULL or an empty string is - * equivalent to calling ClassWithRequiredID_unsetName(). - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_setName(ClassWithRequiredID_t * cwrid, const char * name); - - -/** - * Unsets the value of the "id" attribute of this ClassWithRequiredID_t. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_unsetId(ClassWithRequiredID_t * cwrid); - - -/** - * Unsets the value of the "name" attribute of this ClassWithRequiredID_t. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_unsetName(ClassWithRequiredID_t * cwrid); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * ClassWithRequiredID_t object have been set. - * - * @param cwrid the ClassWithRequiredID_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * ClassWithRequiredID_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the ClassWithRequiredID_t object are: - * @li "id" - * - * @memberof ClassWithRequiredID_t - */ -LIBSBML_EXTERN -int -ClassWithRequiredID_hasRequiredAttributes(const ClassWithRequiredID_t * cwrid); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ClassWithRequiredID_H__ */ - - +/** + * @file ClassWithRequiredID.h + * @brief Definition of the ClassWithRequiredID class. + * @author SBMLTeam + * + * + * + * @class ClassWithRequiredID + * @sbmlbrief{twoatonce} TODO:Definition of the ClassWithRequiredID class. + */ + + +#ifndef ClassWithRequiredID_H__ +#define ClassWithRequiredID_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ClassWithRequiredID : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + + /** @endcond */ + +public: + + /** + * Creates a new ClassWithRequiredID using the given SBML Level, Version and + * “twoatonce” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ClassWithRequiredID. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassWithRequiredID. + * + * @param pkgVersion an unsigned int, the SBML Twoatonce Version to assign to + * this ClassWithRequiredID. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassWithRequiredID(unsigned int level = + TwoatonceExtension::getDefaultLevel(), + unsigned int version = + TwoatonceExtension::getDefaultVersion(), + unsigned int pkgVersion = + TwoatonceExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ClassWithRequiredID using the given TwoatoncePkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param twoatoncens the TwoatoncePkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ClassWithRequiredID(TwoatoncePkgNamespaces *twoatoncens); + + + /** + * Copy constructor for ClassWithRequiredID. + * + * @param orig the ClassWithRequiredID instance to copy. + */ + ClassWithRequiredID(const ClassWithRequiredID& orig); + + + /** + * Assignment operator for ClassWithRequiredID. + * + * @param rhs the ClassWithRequiredID object whose values are to be used as + * the basis of the assignment. + */ + ClassWithRequiredID& operator=(const ClassWithRequiredID& rhs); + + + /** + * Creates and returns a deep copy of this ClassWithRequiredID object. + * + * @return a (deep) copy of this ClassWithRequiredID object. + */ + virtual ClassWithRequiredID* clone() const; + + + /** + * Destructor for ClassWithRequiredID. + */ + virtual ~ClassWithRequiredID(); + + + /** + * Returns the value of the "id" attribute of this ClassWithRequiredID. + * + * @return the value of the "id" attribute of this ClassWithRequiredID as a + * string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "name" attribute of this ClassWithRequiredID. + * + * @return the value of the "name" attribute of this ClassWithRequiredID as a + * string. + */ + virtual const std::string& getName() const; + + + /** + * Predicate returning @c true if this ClassWithRequiredID's "id" attribute + * is set. + * + * @return @c true if this ClassWithRequiredID's "id" attribute has been set, + * otherwise @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this ClassWithRequiredID's "name" attribute + * is set. + * + * @return @c true if this ClassWithRequiredID's "name" attribute has been + * set, otherwise @c false is returned. + */ + virtual bool isSetName() const; + + + /** + * Sets the value of the "id" attribute of this ClassWithRequiredID. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "name" attribute of this ClassWithRequiredID. + * + * @param name std::string& value of the "name" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p name = @c NULL or an empty string is + * equivalent to calling unsetName(). + */ + virtual int setName(const std::string& name); + + + /** + * Unsets the value of the "id" attribute of this ClassWithRequiredID. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "name" attribute of this ClassWithRequiredID. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetName(); + + + /** + * Returns the XML element name of this ClassWithRequiredID object. + * + * For ClassWithRequiredID, the XML element name is always + * @c "classWithRequiredID". + * + * @return the name of this element, i.e. @c "classWithRequiredID". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ClassWithRequiredID object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_TWOATONCE_CLASSWITHREQUIREDID, + * SBMLTwoatonceTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * ClassWithRequiredID object have been set. + * + * @return @c true to indicate that all the required attributes of this + * ClassWithRequiredID have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the ClassWithRequiredID object are: + * @li "id" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ClassWithRequiredID's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ClassWithRequiredID's attribute "attributeName" + * has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * ClassWithRequiredID. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V1V1Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + void readL3V2V1Attributes(const XMLAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V1V1Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + void writeL3V2V1Attributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ClassWithRequiredID_t using the given SBML Level, Version and + * “twoatonce” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ClassWithRequiredID_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ClassWithRequiredID_t. + * + * @param pkgVersion an unsigned int, the SBML Twoatonce Version to assign to + * this ClassWithRequiredID_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +ClassWithRequiredID_t * +ClassWithRequiredID_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ClassWithRequiredID_t object. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @return a (deep) copy of this ClassWithRequiredID_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +ClassWithRequiredID_t* +ClassWithRequiredID_clone(const ClassWithRequiredID_t* cwrid); + + +/** + * Frees this ClassWithRequiredID_t object. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +void +ClassWithRequiredID_free(ClassWithRequiredID_t* cwrid); + + +/** + * Returns the value of the "id" attribute of this ClassWithRequiredID_t. + * + * @param cwrid the ClassWithRequiredID_t structure whose id is sought. + * + * @return the value of the "id" attribute of this ClassWithRequiredID_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +char * +ClassWithRequiredID_getId(const ClassWithRequiredID_t * cwrid); + + +/** + * Returns the value of the "name" attribute of this ClassWithRequiredID_t. + * + * @param cwrid the ClassWithRequiredID_t structure whose name is sought. + * + * @return the value of the "name" attribute of this ClassWithRequiredID_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +char * +ClassWithRequiredID_getName(const ClassWithRequiredID_t * cwrid); + + +/** + * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "id" + * attribute is set. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @return @c 1 (true) if this ClassWithRequiredID_t's "id" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_isSetId(const ClassWithRequiredID_t * cwrid); + + +/** + * Predicate returning @c 1 (true) if this ClassWithRequiredID_t's "name" + * attribute is set. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @return @c 1 (true) if this ClassWithRequiredID_t's "name" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_isSetName(const ClassWithRequiredID_t * cwrid); + + +/** + * Sets the value of the "id" attribute of this ClassWithRequiredID_t. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling ClassWithRequiredID_unsetId(). + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_setId(ClassWithRequiredID_t * cwrid, const char * id); + + +/** + * Sets the value of the "name" attribute of this ClassWithRequiredID_t. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @param name const char * value of the "name" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p name = @c NULL or an empty string is + * equivalent to calling ClassWithRequiredID_unsetName(). + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_setName(ClassWithRequiredID_t * cwrid, const char * name); + + +/** + * Unsets the value of the "id" attribute of this ClassWithRequiredID_t. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_unsetId(ClassWithRequiredID_t * cwrid); + + +/** + * Unsets the value of the "name" attribute of this ClassWithRequiredID_t. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_unsetName(ClassWithRequiredID_t * cwrid); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * ClassWithRequiredID_t object have been set. + * + * @param cwrid the ClassWithRequiredID_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * ClassWithRequiredID_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the ClassWithRequiredID_t object are: + * @li "id" + * + * @memberof ClassWithRequiredID_t + */ +LIBSBML_EXTERN +int +ClassWithRequiredID_hasRequiredAttributes(const ClassWithRequiredID_t * cwrid); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ClassWithRequiredID_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Compartment.cpp b/generator/tests/test_cpp_code/test-code/Compartment.cpp index a0054d6d..ae924bc0 100644 --- a/generator/tests/test_cpp_code/test-code/Compartment.cpp +++ b/generator/tests/test_cpp_code/test-code/Compartment.cpp @@ -1,1716 +1,1716 @@ -/** - * @file Compartment.cpp - * @brief Implementation of the Compartment class. - * @author DEVISER - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Compartment using the given SBML Level and @ p version values. - */ -Compartment::Compartment(unsigned int level, unsigned int version) - : SBase(level, version) - , mSize (util_NaN()) - , mIsSetSize (false) - , mVolume (util_NaN()) - , mIsSetVolume (false) - , mUnits ("") - , mSpatialDimensions (SBML_INT_MAX) - , mIsSetSpatialDimensions (false) - , mConstant (false) - , mIsSetConstant (false) - , mOutside ("") - , mCompartmentType ("") -{ - setSBMLNamespacesAndOwn(new SBMLNamespaces(level, version)); -} - - -/* - * Creates a new Compartment using the given SBMLNamespaces object @p sbmlns. - */ -Compartment::Compartment(SBMLNamespaces *sbmlns) - : SBase(sbmlns) - , mSize (util_NaN()) - , mIsSetSize (false) - , mVolume (util_NaN()) - , mIsSetVolume (false) - , mUnits ("") - , mSpatialDimensions (SBML_INT_MAX) - , mIsSetSpatialDimensions (false) - , mConstant (false) - , mIsSetConstant (false) - , mOutside ("") - , mCompartmentType ("") -{ - setElementNamespace(sbmlns->getURI()); -} - - -/* - * Copy constructor for Compartment. - */ -Compartment::Compartment(const Compartment& orig) - : SBase( orig ) - , mSize ( orig.mSize ) - , mIsSetSize ( orig.mIsSetSize ) - , mVolume ( orig.mVolume ) - , mIsSetVolume ( orig.mIsSetVolume ) - , mUnits ( orig.mUnits ) - , mSpatialDimensions ( orig.mSpatialDimensions ) - , mIsSetSpatialDimensions ( orig.mIsSetSpatialDimensions ) - , mConstant ( orig.mConstant ) - , mIsSetConstant ( orig.mIsSetConstant ) - , mOutside ( orig.mOutside ) - , mCompartmentType ( orig.mCompartmentType ) -{ -} - - -/* - * Assignment operator for Compartment. - */ -Compartment& -Compartment::operator=(const Compartment& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mSize = rhs.mSize; - mIsSetSize = rhs.mIsSetSize; - mVolume = rhs.mVolume; - mIsSetVolume = rhs.mIsSetVolume; - mUnits = rhs.mUnits; - mSpatialDimensions = rhs.mSpatialDimensions; - mIsSetSpatialDimensions = rhs.mIsSetSpatialDimensions; - mConstant = rhs.mConstant; - mIsSetConstant = rhs.mIsSetConstant; - mOutside = rhs.mOutside; - mCompartmentType = rhs.mCompartmentType; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Compartment object. - */ -Compartment* -Compartment::clone() const -{ - return new Compartment(*this); -} - - -/* - * Destructor for Compartment. - */ -Compartment::~Compartment() -{ -} - - -/* - * Returns the value of the "size" attribute of this Compartment. - */ -double -Compartment::getSize() const -{ - return mSize; -} - - -/* - * Returns the value of the "volume" attribute of this Compartment. - */ -double -Compartment::getVolume() const -{ - return mVolume; -} - - -/* - * Returns the value of the "units" attribute of this Compartment. - */ -const std::string& -Compartment::getUnits() const -{ - return mUnits; -} - - -/* - * Returns the value of the "spatialDimensions" attribute of this Compartment. - */ -unsigned int -Compartment::getSpatialDimensions() const -{ - return mSpatialDimensions; -} - - -/* - * Returns the value of the "constant" attribute of this Compartment. - */ -bool -Compartment::getConstant() const -{ - return mConstant; -} - - -/* - * Returns the value of the "outside" attribute of this Compartment. - */ -const std::string& -Compartment::getOutside() const -{ - return mOutside; -} - - -/* - * Returns the value of the "compartmentType" attribute of this Compartment. - */ -const std::string& -Compartment::getCompartmentType() const -{ - return mCompartmentType; -} - - -/* - * Predicate returning @c true if this Compartment's "size" attribute is set. - */ -bool -Compartment::isSetSize() const -{ - return mIsSetSize; -} - - -/* - * Predicate returning @c true if this Compartment's "volume" attribute is set. - */ -bool -Compartment::isSetVolume() const -{ - return mIsSetVolume; -} - - -/* - * Predicate returning @c true if this Compartment's "units" attribute is set. - */ -bool -Compartment::isSetUnits() const -{ - return (mUnits.empty() == false); -} - - -/* - * Predicate returning @c true if this Compartment's "spatialDimensions" - * attribute is set. - */ -bool -Compartment::isSetSpatialDimensions() const -{ - return mIsSetSpatialDimensions; -} - - -/* - * Predicate returning @c true if this Compartment's "constant" attribute is - * set. - */ -bool -Compartment::isSetConstant() const -{ - return mIsSetConstant; -} - - -/* - * Predicate returning @c true if this Compartment's "outside" attribute is - * set. - */ -bool -Compartment::isSetOutside() const -{ - return (mOutside.empty() == false); -} - - -/* - * Predicate returning @c true if this Compartment's "compartmentType" - * attribute is set. - */ -bool -Compartment::isSetCompartmentType() const -{ - return (mCompartmentType.empty() == false); -} - - -/* - * Sets the value of the "size" attribute of this Compartment. - */ -int -Compartment::setSize(double size) -{ - mSize = size; - mIsSetSize = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "volume" attribute of this Compartment. - */ -int -Compartment::setVolume(double volume) -{ - mVolume = volume; - mIsSetVolume = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "units" attribute of this Compartment. - */ -int -Compartment::setUnits(const std::string& units) -{ - if (!(SyntaxChecker::isValidInternalUnitSId(units))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mUnits = units; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "spatialDimensions" attribute of this Compartment. - */ -int -Compartment::setSpatialDimensions(unsigned int spatialDimensions) -{ - mSpatialDimensions = spatialDimensions; - mIsSetSpatialDimensions = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "constant" attribute of this Compartment. - */ -int -Compartment::setConstant(bool constant) -{ - mConstant = constant; - mIsSetConstant = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "outside" attribute of this Compartment. - */ -int -Compartment::setOutside(const std::string& outside) -{ - if (!(SyntaxChecker::isValidInternalSId(outside))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mOutside = outside; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "compartmentType" attribute of this Compartment. - */ -int -Compartment::setCompartmentType(const std::string& compartmentType) -{ - if (!(SyntaxChecker::isValidInternalSId(compartmentType))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mCompartmentType = compartmentType; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "size" attribute of this Compartment. - */ -int -Compartment::unsetSize() -{ - mSize = util_NaN(); - mIsSetSize = false; - - if (isSetSize() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "volume" attribute of this Compartment. - */ -int -Compartment::unsetVolume() -{ - mVolume = util_NaN(); - mIsSetVolume = false; - - if (isSetVolume() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "units" attribute of this Compartment. - */ -int -Compartment::unsetUnits() -{ - mUnits.erase(); - - if (mUnits.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "spatialDimensions" attribute of this Compartment. - */ -int -Compartment::unsetSpatialDimensions() -{ - mSpatialDimensions = SBML_INT_MAX; - mIsSetSpatialDimensions = false; - - if (isSetSpatialDimensions() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "constant" attribute of this Compartment. - */ -int -Compartment::unsetConstant() -{ - mConstant = false; - mIsSetConstant = false; - - if (isSetConstant() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "outside" attribute of this Compartment. - */ -int -Compartment::unsetOutside() -{ - mOutside.erase(); - - if (mOutside.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "compartmentType" attribute of this Compartment. - */ -int -Compartment::unsetCompartmentType() -{ - mCompartmentType.erase(); - - if (mCompartmentType.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -Compartment::renameSIdRefs(const std::string& oldid, const std::string& newid) -{ - if (isSetOutside() && mOutside == oldid) - { - setOutside(newid); - } - - if (isSetCompartmentType() && mCompartmentType == oldid) - { - setCompartmentType(newid); - } - - if (isSetUnits() && mUnits == oldid) - { - setUnits(newid); - } -} - - -/* - * Returns the XML element name of this Compartment object. - */ -const std::string& -Compartment::getElementName() const -{ - static const string name = ""; - return name; -} - - -/* - * Returns the libSBML type code for this Compartment object. - */ -int -Compartment::getTypeCode() const -{ - return CORE_COMPARTMENT; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * Compartment object have been set. - */ -bool -Compartment::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetConstant() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Compartment::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const -{ - SBase::writeElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Compartment::accept(SBMLVisitor& v) const -{ - return false; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Compartment::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "constant") - { - value = getConstant(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "size") - { - value = getSize(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "volume") - { - value = getVolume(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "spatialDimensions") - { - value = getSpatialDimensions(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "units") - { - value = getUnits(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "outside") - { - value = getOutside(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "compartmentType") - { - value = getCompartmentType(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Compartment's attribute "attributeName" - * is set. - */ -bool -Compartment::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "size") - { - value = isSetSize(); - } - else if (attributeName == "volume") - { - value = isSetVolume(); - } - else if (attributeName == "units") - { - value = isSetUnits(); - } - else if (attributeName == "spatialDimensions") - { - value = isSetSpatialDimensions(); - } - else if (attributeName == "constant") - { - value = isSetConstant(); - } - else if (attributeName == "outside") - { - value = isSetOutside(); - } - else if (attributeName == "compartmentType") - { - value = isSetCompartmentType(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "constant") - { - return_value = setConstant(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "size") - { - return_value = setSize(value); - } - else if (attributeName == "volume") - { - return_value = setVolume(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "spatialDimensions") - { - return_value = setSpatialDimensions(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "units") - { - return_value = setUnits(value); - } - else if (attributeName == "outside") - { - return_value = setOutside(value); - } - else if (attributeName == "compartmentType") - { - return_value = setCompartmentType(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Compartment. - */ -int -Compartment::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "size") - { - value = unsetSize(); - } - else if (attributeName == "volume") - { - value = unsetVolume(); - } - else if (attributeName == "units") - { - value = unsetUnits(); - } - else if (attributeName == "spatialDimensions") - { - value = unsetSpatialDimensions(); - } - else if (attributeName == "constant") - { - value = unsetConstant(); - } - else if (attributeName == "outside") - { - value = unsetOutside(); - } - else if (attributeName == "compartmentType") - { - value = unsetCompartmentType(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Compartment::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("size"); - - attributes.add("volume"); - - attributes.add("units"); - - attributes.add("spatialDimensions"); - - attributes.add("constant"); - - attributes.add("outside"); - - attributes.add("compartmentType"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Compartment::readAttributes( - const LIBSBML_CPP_NAMESPACE_QUALIFIER - XMLAttributes& attributes, - const LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(SBMLUnknownCoreAttribute); - log->logError(CoreModelLOCompartmentsAllowedCoreAttributes, level, - version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(SBMLUnknownCoreAttribute); - log->logError(CoreCompartmentAllowedAttributes, level, version, - details, getLine(), getColumn()); - } - } - } - - // - // size double (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetSize = attributes.readInto("size", mSize); - - if ( mIsSetSize == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Core attribute 'size' from the " - "element must be an integer."; - log->logError(CoreCompartmentSizeMustBeDouble, level, version, message, - getLine(), getColumn()); - } - } - - // - // volume double (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetVolume = attributes.readInto("volume", mVolume); - - if ( mIsSetVolume == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Core attribute 'volume' from the " - "element must be an integer."; - log->logError(CoreCompartmentVolumeMustBeDouble, level, version, message, - getLine(), getColumn()); - } - } - - // - // units UnitSIdRef (use = "optional" ) - // - - assigned = attributes.readInto("units", mUnits); - - if (assigned == true) - { - if (mUnits.empty() == true) - { - logEmptyString(mUnits, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mUnits) == false) - { - std::string msg = "The units attribute on the <" + getElementName() + - ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mUnits + "', which does not conform to the syntax."; - logError(CoreCompartmentUnitsMustBeUnitSId, level, version, msg, - getLine(), getColumn()); - } - } - - // - // spatialDimensions uint (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetSpatialDimensions = attributes.readInto("spatialDimensions", - mSpatialDimensions); - - if ( mIsSetSpatialDimensions == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Core attribute 'spatialDimensions' from the " - " element must be an integer."; - log->logError(CoreCompartmentSpatialDimensionsMustBeNonNegativeInteger, - level, version, message, getLine(), getColumn()); - } - } - - // - // constant bool (use = "required" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetConstant = attributes.readInto("constant", mConstant); - - if (mIsSetConstant == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logError(CoreCompartmentConstantMustBeBoolean, level, version); - } - else - { - std::string message = "Core attribute 'constant' is missing from the " - " element."; - log->logError(CoreCompartmentAllowedAttributes, level, version, message); - } - } - - // - // outside SIdRef (use = "optional" ) - // - - assigned = attributes.readInto("outside", mOutside); - - if (assigned == true) - { - if (mOutside.empty() == true) - { - logEmptyString(mOutside, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mOutside) == false) - { - std::string msg = "The outside attribute on the <" + getElementName() + - ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mOutside + "', which does not conform to the syntax."; - logError(CoreCompartmentOutsideMustBeCompartment, level, version, msg, - getLine(), getColumn()); - } - } - - // - // compartmentType SIdRef (use = "optional" ) - // - - assigned = attributes.readInto("compartmentType", mCompartmentType); - - if (assigned == true) - { - if (mCompartmentType.empty() == true) - { - logEmptyString(mCompartmentType, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mCompartmentType) == false) - { - std::string msg = "The compartmentType attribute on the <" + - getElementName() + ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mCompartmentType + "', which does not conform to the " - "syntax."; - logError(CoreCompartmentCompartmentTypeMustBeCompartmentType, level, - version, msg, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Compartment::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const -{ - SBase::writeAttributes(stream); - - if (isSetSize() == true) - { - stream.writeAttribute("size", getPrefix(), mSize); - } - - if (isSetVolume() == true) - { - stream.writeAttribute("volume", getPrefix(), mVolume); - } - - if (isSetUnits() == true) - { - stream.writeAttribute("units", getPrefix(), mUnits); - } - - if (isSetSpatialDimensions() == true) - { - stream.writeAttribute("spatialDimensions", getPrefix(), - mSpatialDimensions); - } - - if (isSetConstant() == true) - { - stream.writeAttribute("constant", getPrefix(), mConstant); - } - - if (isSetOutside() == true) - { - stream.writeAttribute("outside", getPrefix(), mOutside); - } - - if (isSetCompartmentType() == true) - { - stream.writeAttribute("compartmentType", getPrefix(), mCompartmentType); - } -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Compartment_t using the given SBML Level and @ p version - * values. - */ -LIBSBML_EXTERN -Compartment_t * -Compartment_create(unsigned int level, unsigned int version) -{ - return new Compartment(level, version); -} - - -/* - * Creates and returns a deep copy of this Compartment_t object. - */ -LIBSBML_EXTERN -Compartment_t* -Compartment_clone(const Compartment_t* c) -{ - if (c != NULL) - { - return static_cast(c->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Compartment_t object. - */ -LIBSBML_EXTERN -void -Compartment_free(Compartment_t* c) -{ - if (c != NULL) - { - delete c; - } -} - - -/* - * Returns the value of the "size" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -double -Compartment_getSize(const Compartment_t * c) -{ - return (c != NULL) ? c->getSize() : util_NaN(); -} - - -/* - * Returns the value of the "volume" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -double -Compartment_getVolume(const Compartment_t * c) -{ - return (c != NULL) ? c->getVolume() : util_NaN(); -} - - -/* - * Returns the value of the "units" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -char * -Compartment_getUnits(const Compartment_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return c->getUnits().empty() ? NULL : safe_strdup(c->getUnits().c_str()); -} - - -/* - * Returns the value of the "spatialDimensions" attribute of this - * Compartment_t. - */ -LIBSBML_EXTERN -unsigned int -Compartment_getSpatialDimensions(const Compartment_t * c) -{ - return (c != NULL) ? c->getSpatialDimensions() : SBML_INT_MAX; -} - - -/* - * Returns the value of the "constant" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_getConstant(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->getConstant()) : 0; -} - - -/* - * Returns the value of the "outside" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -char * -Compartment_getOutside(const Compartment_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return c->getOutside().empty() ? NULL : safe_strdup(c->getOutside().c_str()); -} - - -/* - * Returns the value of the "compartmentType" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -char * -Compartment_getCompartmentType(const Compartment_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return c->getCompartmentType().empty() ? NULL : - safe_strdup(c->getCompartmentType().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this Compartment_t's "size" attribute is - * set. - */ -LIBSBML_EXTERN -int -Compartment_isSetSize(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->isSetSize()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Compartment_t's "volume" attribute - * is set. - */ -LIBSBML_EXTERN -int -Compartment_isSetVolume(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->isSetVolume()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Compartment_t's "units" attribute is - * set. - */ -LIBSBML_EXTERN -int -Compartment_isSetUnits(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->isSetUnits()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Compartment_t's "spatialDimensions" - * attribute is set. - */ -LIBSBML_EXTERN -int -Compartment_isSetSpatialDimensions(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->isSetSpatialDimensions()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Compartment_t's "constant" attribute - * is set. - */ -LIBSBML_EXTERN -int -Compartment_isSetConstant(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->isSetConstant()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Compartment_t's "outside" attribute - * is set. - */ -LIBSBML_EXTERN -int -Compartment_isSetOutside(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->isSetOutside()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Compartment_t's "compartmentType" - * attribute is set. - */ -LIBSBML_EXTERN -int -Compartment_isSetCompartmentType(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->isSetCompartmentType()) : 0; -} - - -/* - * Sets the value of the "size" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_setSize(Compartment_t * c, double size) -{ - return (c != NULL) ? c->setSize(size) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "volume" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_setVolume(Compartment_t * c, double volume) -{ - return (c != NULL) ? c->setVolume(volume) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "units" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_setUnits(Compartment_t * c, const char * units) -{ - return (c != NULL) ? c->setUnits(units) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "spatialDimensions" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_setSpatialDimensions(Compartment_t * c, - unsigned int spatialDimensions) -{ - return (c != NULL) ? c->setSpatialDimensions(spatialDimensions) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "constant" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_setConstant(Compartment_t * c, int constant) -{ - return (c != NULL) ? c->setConstant(constant) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "outside" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_setOutside(Compartment_t * c, const char * outside) -{ - return (c != NULL) ? c->setOutside(outside) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "compartmentType" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_setCompartmentType(Compartment_t * c, - const char * compartmentType) -{ - return (c != NULL) ? c->setCompartmentType(compartmentType) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "size" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_unsetSize(Compartment_t * c) -{ - return (c != NULL) ? c->unsetSize() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "volume" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_unsetVolume(Compartment_t * c) -{ - return (c != NULL) ? c->unsetVolume() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "units" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_unsetUnits(Compartment_t * c) -{ - return (c != NULL) ? c->unsetUnits() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "spatialDimensions" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_unsetSpatialDimensions(Compartment_t * c) -{ - return (c != NULL) ? c->unsetSpatialDimensions() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "constant" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_unsetConstant(Compartment_t * c) -{ - return (c != NULL) ? c->unsetConstant() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "outside" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_unsetOutside(Compartment_t * c) -{ - return (c != NULL) ? c->unsetOutside() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "compartmentType" attribute of this Compartment_t. - */ -LIBSBML_EXTERN -int -Compartment_unsetCompartmentType(Compartment_t * c) -{ - return (c != NULL) ? c->unsetCompartmentType() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Compartment_t object have been set. - */ -LIBSBML_EXTERN -int -Compartment_hasRequiredAttributes(const Compartment_t * c) -{ - return (c != NULL) ? static_cast(c->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Compartment.cpp + * @brief Implementation of the Compartment class. + * @author DEVISER + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Compartment using the given SBML Level and @ p version values. + */ +Compartment::Compartment(unsigned int level, unsigned int version) + : SBase(level, version) + , mSize (util_NaN()) + , mIsSetSize (false) + , mVolume (util_NaN()) + , mIsSetVolume (false) + , mUnits ("") + , mSpatialDimensions (SBML_INT_MAX) + , mIsSetSpatialDimensions (false) + , mConstant (false) + , mIsSetConstant (false) + , mOutside ("") + , mCompartmentType ("") +{ + setSBMLNamespacesAndOwn(new SBMLNamespaces(level, version)); +} + + +/* + * Creates a new Compartment using the given SBMLNamespaces object @p sbmlns. + */ +Compartment::Compartment(SBMLNamespaces *sbmlns) + : SBase(sbmlns) + , mSize (util_NaN()) + , mIsSetSize (false) + , mVolume (util_NaN()) + , mIsSetVolume (false) + , mUnits ("") + , mSpatialDimensions (SBML_INT_MAX) + , mIsSetSpatialDimensions (false) + , mConstant (false) + , mIsSetConstant (false) + , mOutside ("") + , mCompartmentType ("") +{ + setElementNamespace(sbmlns->getURI()); +} + + +/* + * Copy constructor for Compartment. + */ +Compartment::Compartment(const Compartment& orig) + : SBase( orig ) + , mSize ( orig.mSize ) + , mIsSetSize ( orig.mIsSetSize ) + , mVolume ( orig.mVolume ) + , mIsSetVolume ( orig.mIsSetVolume ) + , mUnits ( orig.mUnits ) + , mSpatialDimensions ( orig.mSpatialDimensions ) + , mIsSetSpatialDimensions ( orig.mIsSetSpatialDimensions ) + , mConstant ( orig.mConstant ) + , mIsSetConstant ( orig.mIsSetConstant ) + , mOutside ( orig.mOutside ) + , mCompartmentType ( orig.mCompartmentType ) +{ +} + + +/* + * Assignment operator for Compartment. + */ +Compartment& +Compartment::operator=(const Compartment& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mSize = rhs.mSize; + mIsSetSize = rhs.mIsSetSize; + mVolume = rhs.mVolume; + mIsSetVolume = rhs.mIsSetVolume; + mUnits = rhs.mUnits; + mSpatialDimensions = rhs.mSpatialDimensions; + mIsSetSpatialDimensions = rhs.mIsSetSpatialDimensions; + mConstant = rhs.mConstant; + mIsSetConstant = rhs.mIsSetConstant; + mOutside = rhs.mOutside; + mCompartmentType = rhs.mCompartmentType; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Compartment object. + */ +Compartment* +Compartment::clone() const +{ + return new Compartment(*this); +} + + +/* + * Destructor for Compartment. + */ +Compartment::~Compartment() +{ +} + + +/* + * Returns the value of the "size" attribute of this Compartment. + */ +double +Compartment::getSize() const +{ + return mSize; +} + + +/* + * Returns the value of the "volume" attribute of this Compartment. + */ +double +Compartment::getVolume() const +{ + return mVolume; +} + + +/* + * Returns the value of the "units" attribute of this Compartment. + */ +const std::string& +Compartment::getUnits() const +{ + return mUnits; +} + + +/* + * Returns the value of the "spatialDimensions" attribute of this Compartment. + */ +unsigned int +Compartment::getSpatialDimensions() const +{ + return mSpatialDimensions; +} + + +/* + * Returns the value of the "constant" attribute of this Compartment. + */ +bool +Compartment::getConstant() const +{ + return mConstant; +} + + +/* + * Returns the value of the "outside" attribute of this Compartment. + */ +const std::string& +Compartment::getOutside() const +{ + return mOutside; +} + + +/* + * Returns the value of the "compartmentType" attribute of this Compartment. + */ +const std::string& +Compartment::getCompartmentType() const +{ + return mCompartmentType; +} + + +/* + * Predicate returning @c true if this Compartment's "size" attribute is set. + */ +bool +Compartment::isSetSize() const +{ + return mIsSetSize; +} + + +/* + * Predicate returning @c true if this Compartment's "volume" attribute is set. + */ +bool +Compartment::isSetVolume() const +{ + return mIsSetVolume; +} + + +/* + * Predicate returning @c true if this Compartment's "units" attribute is set. + */ +bool +Compartment::isSetUnits() const +{ + return (mUnits.empty() == false); +} + + +/* + * Predicate returning @c true if this Compartment's "spatialDimensions" + * attribute is set. + */ +bool +Compartment::isSetSpatialDimensions() const +{ + return mIsSetSpatialDimensions; +} + + +/* + * Predicate returning @c true if this Compartment's "constant" attribute is + * set. + */ +bool +Compartment::isSetConstant() const +{ + return mIsSetConstant; +} + + +/* + * Predicate returning @c true if this Compartment's "outside" attribute is + * set. + */ +bool +Compartment::isSetOutside() const +{ + return (mOutside.empty() == false); +} + + +/* + * Predicate returning @c true if this Compartment's "compartmentType" + * attribute is set. + */ +bool +Compartment::isSetCompartmentType() const +{ + return (mCompartmentType.empty() == false); +} + + +/* + * Sets the value of the "size" attribute of this Compartment. + */ +int +Compartment::setSize(double size) +{ + mSize = size; + mIsSetSize = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "volume" attribute of this Compartment. + */ +int +Compartment::setVolume(double volume) +{ + mVolume = volume; + mIsSetVolume = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "units" attribute of this Compartment. + */ +int +Compartment::setUnits(const std::string& units) +{ + if (!(SyntaxChecker::isValidInternalUnitSId(units))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mUnits = units; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "spatialDimensions" attribute of this Compartment. + */ +int +Compartment::setSpatialDimensions(unsigned int spatialDimensions) +{ + mSpatialDimensions = spatialDimensions; + mIsSetSpatialDimensions = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "constant" attribute of this Compartment. + */ +int +Compartment::setConstant(bool constant) +{ + mConstant = constant; + mIsSetConstant = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "outside" attribute of this Compartment. + */ +int +Compartment::setOutside(const std::string& outside) +{ + if (!(SyntaxChecker::isValidInternalSId(outside))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mOutside = outside; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "compartmentType" attribute of this Compartment. + */ +int +Compartment::setCompartmentType(const std::string& compartmentType) +{ + if (!(SyntaxChecker::isValidInternalSId(compartmentType))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mCompartmentType = compartmentType; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "size" attribute of this Compartment. + */ +int +Compartment::unsetSize() +{ + mSize = util_NaN(); + mIsSetSize = false; + + if (isSetSize() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "volume" attribute of this Compartment. + */ +int +Compartment::unsetVolume() +{ + mVolume = util_NaN(); + mIsSetVolume = false; + + if (isSetVolume() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "units" attribute of this Compartment. + */ +int +Compartment::unsetUnits() +{ + mUnits.erase(); + + if (mUnits.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "spatialDimensions" attribute of this Compartment. + */ +int +Compartment::unsetSpatialDimensions() +{ + mSpatialDimensions = SBML_INT_MAX; + mIsSetSpatialDimensions = false; + + if (isSetSpatialDimensions() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "constant" attribute of this Compartment. + */ +int +Compartment::unsetConstant() +{ + mConstant = false; + mIsSetConstant = false; + + if (isSetConstant() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "outside" attribute of this Compartment. + */ +int +Compartment::unsetOutside() +{ + mOutside.erase(); + + if (mOutside.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "compartmentType" attribute of this Compartment. + */ +int +Compartment::unsetCompartmentType() +{ + mCompartmentType.erase(); + + if (mCompartmentType.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +Compartment::renameSIdRefs(const std::string& oldid, const std::string& newid) +{ + if (isSetOutside() && mOutside == oldid) + { + setOutside(newid); + } + + if (isSetCompartmentType() && mCompartmentType == oldid) + { + setCompartmentType(newid); + } + + if (isSetUnits() && mUnits == oldid) + { + setUnits(newid); + } +} + + +/* + * Returns the XML element name of this Compartment object. + */ +const std::string& +Compartment::getElementName() const +{ + static const string name = ""; + return name; +} + + +/* + * Returns the libSBML type code for this Compartment object. + */ +int +Compartment::getTypeCode() const +{ + return CORE_COMPARTMENT; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * Compartment object have been set. + */ +bool +Compartment::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetConstant() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Compartment::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + SBase::writeElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Compartment::accept(SBMLVisitor& v) const +{ + return false; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Compartment::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "constant") + { + value = getConstant(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "size") + { + value = getSize(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "volume") + { + value = getVolume(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "spatialDimensions") + { + value = getSpatialDimensions(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "units") + { + value = getUnits(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "outside") + { + value = getOutside(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "compartmentType") + { + value = getCompartmentType(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Compartment's attribute "attributeName" + * is set. + */ +bool +Compartment::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "size") + { + value = isSetSize(); + } + else if (attributeName == "volume") + { + value = isSetVolume(); + } + else if (attributeName == "units") + { + value = isSetUnits(); + } + else if (attributeName == "spatialDimensions") + { + value = isSetSpatialDimensions(); + } + else if (attributeName == "constant") + { + value = isSetConstant(); + } + else if (attributeName == "outside") + { + value = isSetOutside(); + } + else if (attributeName == "compartmentType") + { + value = isSetCompartmentType(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "constant") + { + return_value = setConstant(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "size") + { + return_value = setSize(value); + } + else if (attributeName == "volume") + { + return_value = setVolume(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "spatialDimensions") + { + return_value = setSpatialDimensions(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "units") + { + return_value = setUnits(value); + } + else if (attributeName == "outside") + { + return_value = setOutside(value); + } + else if (attributeName == "compartmentType") + { + return_value = setCompartmentType(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Compartment. + */ +int +Compartment::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "size") + { + value = unsetSize(); + } + else if (attributeName == "volume") + { + value = unsetVolume(); + } + else if (attributeName == "units") + { + value = unsetUnits(); + } + else if (attributeName == "spatialDimensions") + { + value = unsetSpatialDimensions(); + } + else if (attributeName == "constant") + { + value = unsetConstant(); + } + else if (attributeName == "outside") + { + value = unsetOutside(); + } + else if (attributeName == "compartmentType") + { + value = unsetCompartmentType(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Compartment::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("size"); + + attributes.add("volume"); + + attributes.add("units"); + + attributes.add("spatialDimensions"); + + attributes.add("constant"); + + attributes.add("outside"); + + attributes.add("compartmentType"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Compartment::readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER + XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(SBMLUnknownCoreAttribute); + log->logError(CoreModelLOCompartmentsAllowedCoreAttributes, level, + version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(SBMLUnknownCoreAttribute); + log->logError(CoreCompartmentAllowedAttributes, level, version, + details, getLine(), getColumn()); + } + } + } + + // + // size double (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetSize = attributes.readInto("size", mSize); + + if ( mIsSetSize == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Core attribute 'size' from the " + "element must be an integer."; + log->logError(CoreCompartmentSizeMustBeDouble, level, version, message, + getLine(), getColumn()); + } + } + + // + // volume double (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetVolume = attributes.readInto("volume", mVolume); + + if ( mIsSetVolume == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Core attribute 'volume' from the " + "element must be an integer."; + log->logError(CoreCompartmentVolumeMustBeDouble, level, version, message, + getLine(), getColumn()); + } + } + + // + // units UnitSIdRef (use = "optional" ) + // + + assigned = attributes.readInto("units", mUnits); + + if (assigned == true) + { + if (mUnits.empty() == true) + { + logEmptyString(mUnits, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mUnits) == false) + { + std::string msg = "The units attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mUnits + "', which does not conform to the syntax."; + logError(CoreCompartmentUnitsMustBeUnitSId, level, version, msg, + getLine(), getColumn()); + } + } + + // + // spatialDimensions uint (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetSpatialDimensions = attributes.readInto("spatialDimensions", + mSpatialDimensions); + + if ( mIsSetSpatialDimensions == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Core attribute 'spatialDimensions' from the " + " element must be an integer."; + log->logError(CoreCompartmentSpatialDimensionsMustBeNonNegativeInteger, + level, version, message, getLine(), getColumn()); + } + } + + // + // constant bool (use = "required" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetConstant = attributes.readInto("constant", mConstant); + + if (mIsSetConstant == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logError(CoreCompartmentConstantMustBeBoolean, level, version); + } + else + { + std::string message = "Core attribute 'constant' is missing from the " + " element."; + log->logError(CoreCompartmentAllowedAttributes, level, version, message); + } + } + + // + // outside SIdRef (use = "optional" ) + // + + assigned = attributes.readInto("outside", mOutside); + + if (assigned == true) + { + if (mOutside.empty() == true) + { + logEmptyString(mOutside, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mOutside) == false) + { + std::string msg = "The outside attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mOutside + "', which does not conform to the syntax."; + logError(CoreCompartmentOutsideMustBeCompartment, level, version, msg, + getLine(), getColumn()); + } + } + + // + // compartmentType SIdRef (use = "optional" ) + // + + assigned = attributes.readInto("compartmentType", mCompartmentType); + + if (assigned == true) + { + if (mCompartmentType.empty() == true) + { + logEmptyString(mCompartmentType, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mCompartmentType) == false) + { + std::string msg = "The compartmentType attribute on the <" + + getElementName() + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mCompartmentType + "', which does not conform to the " + "syntax."; + logError(CoreCompartmentCompartmentTypeMustBeCompartmentType, level, + version, msg, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Compartment::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + SBase::writeAttributes(stream); + + if (isSetSize() == true) + { + stream.writeAttribute("size", getPrefix(), mSize); + } + + if (isSetVolume() == true) + { + stream.writeAttribute("volume", getPrefix(), mVolume); + } + + if (isSetUnits() == true) + { + stream.writeAttribute("units", getPrefix(), mUnits); + } + + if (isSetSpatialDimensions() == true) + { + stream.writeAttribute("spatialDimensions", getPrefix(), + mSpatialDimensions); + } + + if (isSetConstant() == true) + { + stream.writeAttribute("constant", getPrefix(), mConstant); + } + + if (isSetOutside() == true) + { + stream.writeAttribute("outside", getPrefix(), mOutside); + } + + if (isSetCompartmentType() == true) + { + stream.writeAttribute("compartmentType", getPrefix(), mCompartmentType); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Compartment_t using the given SBML Level and @ p version + * values. + */ +LIBSBML_EXTERN +Compartment_t * +Compartment_create(unsigned int level, unsigned int version) +{ + return new Compartment(level, version); +} + + +/* + * Creates and returns a deep copy of this Compartment_t object. + */ +LIBSBML_EXTERN +Compartment_t* +Compartment_clone(const Compartment_t* c) +{ + if (c != NULL) + { + return static_cast(c->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Compartment_t object. + */ +LIBSBML_EXTERN +void +Compartment_free(Compartment_t* c) +{ + if (c != NULL) + { + delete c; + } +} + + +/* + * Returns the value of the "size" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +double +Compartment_getSize(const Compartment_t * c) +{ + return (c != NULL) ? c->getSize() : util_NaN(); +} + + +/* + * Returns the value of the "volume" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +double +Compartment_getVolume(const Compartment_t * c) +{ + return (c != NULL) ? c->getVolume() : util_NaN(); +} + + +/* + * Returns the value of the "units" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +char * +Compartment_getUnits(const Compartment_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return c->getUnits().empty() ? NULL : safe_strdup(c->getUnits().c_str()); +} + + +/* + * Returns the value of the "spatialDimensions" attribute of this + * Compartment_t. + */ +LIBSBML_EXTERN +unsigned int +Compartment_getSpatialDimensions(const Compartment_t * c) +{ + return (c != NULL) ? c->getSpatialDimensions() : SBML_INT_MAX; +} + + +/* + * Returns the value of the "constant" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_getConstant(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->getConstant()) : 0; +} + + +/* + * Returns the value of the "outside" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +char * +Compartment_getOutside(const Compartment_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return c->getOutside().empty() ? NULL : safe_strdup(c->getOutside().c_str()); +} + + +/* + * Returns the value of the "compartmentType" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +char * +Compartment_getCompartmentType(const Compartment_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return c->getCompartmentType().empty() ? NULL : + safe_strdup(c->getCompartmentType().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this Compartment_t's "size" attribute is + * set. + */ +LIBSBML_EXTERN +int +Compartment_isSetSize(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->isSetSize()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Compartment_t's "volume" attribute + * is set. + */ +LIBSBML_EXTERN +int +Compartment_isSetVolume(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->isSetVolume()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Compartment_t's "units" attribute is + * set. + */ +LIBSBML_EXTERN +int +Compartment_isSetUnits(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->isSetUnits()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Compartment_t's "spatialDimensions" + * attribute is set. + */ +LIBSBML_EXTERN +int +Compartment_isSetSpatialDimensions(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->isSetSpatialDimensions()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Compartment_t's "constant" attribute + * is set. + */ +LIBSBML_EXTERN +int +Compartment_isSetConstant(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->isSetConstant()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Compartment_t's "outside" attribute + * is set. + */ +LIBSBML_EXTERN +int +Compartment_isSetOutside(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->isSetOutside()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Compartment_t's "compartmentType" + * attribute is set. + */ +LIBSBML_EXTERN +int +Compartment_isSetCompartmentType(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->isSetCompartmentType()) : 0; +} + + +/* + * Sets the value of the "size" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_setSize(Compartment_t * c, double size) +{ + return (c != NULL) ? c->setSize(size) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "volume" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_setVolume(Compartment_t * c, double volume) +{ + return (c != NULL) ? c->setVolume(volume) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "units" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_setUnits(Compartment_t * c, const char * units) +{ + return (c != NULL) ? c->setUnits(units) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "spatialDimensions" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_setSpatialDimensions(Compartment_t * c, + unsigned int spatialDimensions) +{ + return (c != NULL) ? c->setSpatialDimensions(spatialDimensions) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "constant" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_setConstant(Compartment_t * c, int constant) +{ + return (c != NULL) ? c->setConstant(constant) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "outside" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_setOutside(Compartment_t * c, const char * outside) +{ + return (c != NULL) ? c->setOutside(outside) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "compartmentType" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_setCompartmentType(Compartment_t * c, + const char * compartmentType) +{ + return (c != NULL) ? c->setCompartmentType(compartmentType) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "size" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_unsetSize(Compartment_t * c) +{ + return (c != NULL) ? c->unsetSize() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "volume" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_unsetVolume(Compartment_t * c) +{ + return (c != NULL) ? c->unsetVolume() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "units" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_unsetUnits(Compartment_t * c) +{ + return (c != NULL) ? c->unsetUnits() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "spatialDimensions" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_unsetSpatialDimensions(Compartment_t * c) +{ + return (c != NULL) ? c->unsetSpatialDimensions() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "constant" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_unsetConstant(Compartment_t * c) +{ + return (c != NULL) ? c->unsetConstant() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "outside" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_unsetOutside(Compartment_t * c) +{ + return (c != NULL) ? c->unsetOutside() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "compartmentType" attribute of this Compartment_t. + */ +LIBSBML_EXTERN +int +Compartment_unsetCompartmentType(Compartment_t * c) +{ + return (c != NULL) ? c->unsetCompartmentType() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Compartment_t object have been set. + */ +LIBSBML_EXTERN +int +Compartment_hasRequiredAttributes(const Compartment_t * c) +{ + return (c != NULL) ? static_cast(c->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Compartment.h b/generator/tests/test_cpp_code/test-code/Compartment.h index cbe8f2ba..d7f44388 100644 --- a/generator/tests/test_cpp_code/test-code/Compartment.h +++ b/generator/tests/test_cpp_code/test-code/Compartment.h @@ -1,1392 +1,1392 @@ -/** - * @file Compartment.h - * @brief Definition of the Compartment class. - * @author DEVISER - * - * - * - * @class Compartment - * @sbmlbrief{core} TODO:Definition of the Compartment class. - */ - - -#ifndef Compartment_H__ -#define Compartment_H__ - - -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Compartment : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - double mSize; - bool mIsSetSize; - double mVolume; - bool mIsSetVolume; - std::string mUnits; - unsigned int mSpatialDimensions; - bool mIsSetSpatialDimensions; - bool mConstant; - bool mIsSetConstant; - std::string mOutside; - std::string mCompartmentType; - - /** @endcond */ - -public: - - /** - * Creates a new Compartment using the given SBML Level and @ p version - * values. - * - * @param level an unsigned int, the SBML Level to assign to this - * Compartment. - * - * @param version an unsigned int, the SBML Version to assign to this - * Compartment. - * - * @copydetails doc_note_setting_lv_pkg - */ - Compartment(unsigned int level = SBML_DEFAULT_LEVEL, - unsigned int version = SBML_DEFAULT_VERSION); - - - /** - * Creates a new Compartment using the given SBMLNamespaces object @p sbmlns. - * - * @param sbmlns the SBMLNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Compartment(SBMLNamespaces *sbmlns); - - - /** - * Copy constructor for Compartment. - * - * @param orig the Compartment instance to copy. - */ - Compartment(const Compartment& orig); - - - /** - * Assignment operator for Compartment. - * - * @param rhs the Compartment object whose values are to be used as the basis - * of the assignment. - */ - Compartment& operator=(const Compartment& rhs); - - - /** - * Creates and returns a deep copy of this Compartment object. - * - * @return a (deep) copy of this Compartment object. - */ - virtual Compartment* clone() const; - - - /** - * Destructor for Compartment. - */ - virtual ~Compartment(); - - - /** - * Returns the value of the "size" attribute of this Compartment. - * - * @return the value of the "size" attribute of this Compartment as a double. - */ - double getSize() const; - - - /** - * Returns the value of the "volume" attribute of this Compartment. - * - * @return the value of the "volume" attribute of this Compartment as a - * double. - */ - double getVolume() const; - - - /** - * Returns the value of the "units" attribute of this Compartment. - * - * @return the value of the "units" attribute of this Compartment as a - * string. - */ - const std::string& getUnits() const; - - - /** - * Returns the value of the "spatialDimensions" attribute of this - * Compartment. - * - * @return the value of the "spatialDimensions" attribute of this Compartment - * as a unsigned integer. - */ - unsigned int getSpatialDimensions() const; - - - /** - * Returns the value of the "constant" attribute of this Compartment. - * - * @return the value of the "constant" attribute of this Compartment as a - * boolean. - */ - bool getConstant() const; - - - /** - * Returns the value of the "outside" attribute of this Compartment. - * - * @return the value of the "outside" attribute of this Compartment as a - * string. - */ - const std::string& getOutside() const; - - - /** - * Returns the value of the "compartmentType" attribute of this Compartment. - * - * @return the value of the "compartmentType" attribute of this Compartment - * as a string. - */ - const std::string& getCompartmentType() const; - - - /** - * Predicate returning @c true if this Compartment's "size" attribute is set. - * - * @return @c true if this Compartment's "size" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetSize() const; - - - /** - * Predicate returning @c true if this Compartment's "volume" attribute is - * set. - * - * @return @c true if this Compartment's "volume" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetVolume() const; - - - /** - * Predicate returning @c true if this Compartment's "units" attribute is - * set. - * - * @return @c true if this Compartment's "units" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetUnits() const; - - - /** - * Predicate returning @c true if this Compartment's "spatialDimensions" - * attribute is set. - * - * @return @c true if this Compartment's "spatialDimensions" attribute has - * been set, otherwise @c false is returned. - */ - bool isSetSpatialDimensions() const; - - - /** - * Predicate returning @c true if this Compartment's "constant" attribute is - * set. - * - * @return @c true if this Compartment's "constant" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetConstant() const; - - - /** - * Predicate returning @c true if this Compartment's "outside" attribute is - * set. - * - * @return @c true if this Compartment's "outside" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetOutside() const; - - - /** - * Predicate returning @c true if this Compartment's "compartmentType" - * attribute is set. - * - * @return @c true if this Compartment's "compartmentType" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetCompartmentType() const; - - - /** - * Sets the value of the "size" attribute of this Compartment. - * - * @param size double value of the "size" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setSize(double size); - - - /** - * Sets the value of the "volume" attribute of this Compartment. - * - * @param volume double value of the "volume" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setVolume(double volume); - - - /** - * Sets the value of the "units" attribute of this Compartment. - * - * @param units std::string& value of the "units" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setUnits(const std::string& units); - - - /** - * Sets the value of the "spatialDimensions" attribute of this Compartment. - * - * @param spatialDimensions unsigned int value of the "spatialDimensions" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setSpatialDimensions(unsigned int spatialDimensions); - - - /** - * Sets the value of the "constant" attribute of this Compartment. - * - * @param constant bool value of the "constant" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setConstant(bool constant); - - - /** - * Sets the value of the "outside" attribute of this Compartment. - * - * @param outside std::string& value of the "outside" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setOutside(const std::string& outside); - - - /** - * Sets the value of the "compartmentType" attribute of this Compartment. - * - * @param compartmentType std::string& value of the "compartmentType" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setCompartmentType(const std::string& compartmentType); - - - /** - * Unsets the value of the "size" attribute of this Compartment. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetSize(); - - - /** - * Unsets the value of the "volume" attribute of this Compartment. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetVolume(); - - - /** - * Unsets the value of the "units" attribute of this Compartment. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetUnits(); - - - /** - * Unsets the value of the "spatialDimensions" attribute of this Compartment. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetSpatialDimensions(); - - - /** - * Unsets the value of the "constant" attribute of this Compartment. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetConstant(); - - - /** - * Unsets the value of the "outside" attribute of this Compartment. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetOutside(); - - - /** - * Unsets the value of the "compartmentType" attribute of this Compartment. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetCompartmentType(); - - - /** - * @copydoc doc_renamesidref_common - */ - virtual void renameSIdRefs(const std::string& oldid, - const std::string& newid); - - - /** - * Returns the XML element name of this Compartment object. - * - * For Compartment, the XML element name is always @c "". - * - * @return the name of this element, i.e. @c "". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Compartment object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{CORE_COMPARTMENT, SBMLTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * Compartment object have been set. - * - * @return @c true to indicate that all the required attributes of this - * Compartment have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the Compartment object are: - * @li "constant" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Compartment's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Compartment's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Compartment. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes( - const LIBSBML_CPP_NAMESPACE_QUALIFIER - XMLAttributes& attributes, - const LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Compartment_t using the given SBML Level and @ p version - * values. - * - * @param level an unsigned int, the SBML Level to assign to this - * Compartment_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Compartment_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -Compartment_t * -Compartment_create(unsigned int level, unsigned int version); - - -/** - * Creates and returns a deep copy of this Compartment_t object. - * - * @param c the Compartment_t structure. - * - * @return a (deep) copy of this Compartment_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -Compartment_t* -Compartment_clone(const Compartment_t* c); - - -/** - * Frees this Compartment_t object. - * - * @param c the Compartment_t structure. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -void -Compartment_free(Compartment_t* c); - - -/** - * Returns the value of the "size" attribute of this Compartment_t. - * - * @param c the Compartment_t structure whose size is sought. - * - * @return the value of the "size" attribute of this Compartment_t as a double. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -double -Compartment_getSize(const Compartment_t * c); - - -/** - * Returns the value of the "volume" attribute of this Compartment_t. - * - * @param c the Compartment_t structure whose volume is sought. - * - * @return the value of the "volume" attribute of this Compartment_t as a - * double. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -double -Compartment_getVolume(const Compartment_t * c); - - -/** - * Returns the value of the "units" attribute of this Compartment_t. - * - * @param c the Compartment_t structure whose units is sought. - * - * @return the value of the "units" attribute of this Compartment_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -char * -Compartment_getUnits(const Compartment_t * c); - - -/** - * Returns the value of the "spatialDimensions" attribute of this - * Compartment_t. - * - * @param c the Compartment_t structure whose spatialDimensions is sought. - * - * @return the value of the "spatialDimensions" attribute of this Compartment_t - * as a unsigned integer. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -unsigned int -Compartment_getSpatialDimensions(const Compartment_t * c); - - -/** - * Returns the value of the "constant" attribute of this Compartment_t. - * - * @param c the Compartment_t structure whose constant is sought. - * - * @return the value of the "constant" attribute of this Compartment_t as a - * boolean. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_getConstant(const Compartment_t * c); - - -/** - * Returns the value of the "outside" attribute of this Compartment_t. - * - * @param c the Compartment_t structure whose outside is sought. - * - * @return the value of the "outside" attribute of this Compartment_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -char * -Compartment_getOutside(const Compartment_t * c); - - -/** - * Returns the value of the "compartmentType" attribute of this Compartment_t. - * - * @param c the Compartment_t structure whose compartmentType is sought. - * - * @return the value of the "compartmentType" attribute of this Compartment_t - * as a pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -char * -Compartment_getCompartmentType(const Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if this Compartment_t's "size" attribute is - * set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) if this Compartment_t's "size" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_isSetSize(const Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if this Compartment_t's "volume" attribute - * is set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) if this Compartment_t's "volume" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_isSetVolume(const Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if this Compartment_t's "units" attribute is - * set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) if this Compartment_t's "units" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_isSetUnits(const Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if this Compartment_t's "spatialDimensions" - * attribute is set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) if this Compartment_t's "spatialDimensions" attribute - * has been set, otherwise @c 0 (false) is returned. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_isSetSpatialDimensions(const Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if this Compartment_t's "constant" attribute - * is set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) if this Compartment_t's "constant" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_isSetConstant(const Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if this Compartment_t's "outside" attribute - * is set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) if this Compartment_t's "outside" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_isSetOutside(const Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if this Compartment_t's "compartmentType" - * attribute is set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) if this Compartment_t's "compartmentType" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_isSetCompartmentType(const Compartment_t * c); - - -/** - * Sets the value of the "size" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @param size double value of the "size" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_setSize(Compartment_t * c, double size); - - -/** - * Sets the value of the "volume" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @param volume double value of the "volume" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_setVolume(Compartment_t * c, double volume); - - -/** - * Sets the value of the "units" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @param units const char * value of the "units" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_setUnits(Compartment_t * c, const char * units); - - -/** - * Sets the value of the "spatialDimensions" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @param spatialDimensions unsigned int value of the "spatialDimensions" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_setSpatialDimensions(Compartment_t * c, - unsigned int spatialDimensions); - - -/** - * Sets the value of the "constant" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @param constant int value of the "constant" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_setConstant(Compartment_t * c, int constant); - - -/** - * Sets the value of the "outside" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @param outside const char * value of the "outside" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_setOutside(Compartment_t * c, const char * outside); - - -/** - * Sets the value of the "compartmentType" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @param compartmentType const char * value of the "compartmentType" attribute - * to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_setCompartmentType(Compartment_t * c, - const char * compartmentType); - - -/** - * Unsets the value of the "size" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_unsetSize(Compartment_t * c); - - -/** - * Unsets the value of the "volume" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_unsetVolume(Compartment_t * c); - - -/** - * Unsets the value of the "units" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_unsetUnits(Compartment_t * c); - - -/** - * Unsets the value of the "spatialDimensions" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_unsetSpatialDimensions(Compartment_t * c); - - -/** - * Unsets the value of the "constant" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_unsetConstant(Compartment_t * c); - - -/** - * Unsets the value of the "outside" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_unsetOutside(Compartment_t * c); - - -/** - * Unsets the value of the "compartmentType" attribute of this Compartment_t. - * - * @param c the Compartment_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_unsetCompartmentType(Compartment_t * c); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Compartment_t object have been set. - * - * @param c the Compartment_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Compartment_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the Compartment_t object are: - * @li "constant" - * - * @memberof Compartment_t - */ -LIBSBML_EXTERN -int -Compartment_hasRequiredAttributes(const Compartment_t * c); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Compartment_H__ */ - - +/** + * @file Compartment.h + * @brief Definition of the Compartment class. + * @author DEVISER + * + * + * + * @class Compartment + * @sbmlbrief{core} TODO:Definition of the Compartment class. + */ + + +#ifndef Compartment_H__ +#define Compartment_H__ + + +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Compartment : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + double mSize; + bool mIsSetSize; + double mVolume; + bool mIsSetVolume; + std::string mUnits; + unsigned int mSpatialDimensions; + bool mIsSetSpatialDimensions; + bool mConstant; + bool mIsSetConstant; + std::string mOutside; + std::string mCompartmentType; + + /** @endcond */ + +public: + + /** + * Creates a new Compartment using the given SBML Level and @ p version + * values. + * + * @param level an unsigned int, the SBML Level to assign to this + * Compartment. + * + * @param version an unsigned int, the SBML Version to assign to this + * Compartment. + * + * @copydetails doc_note_setting_lv_pkg + */ + Compartment(unsigned int level = SBML_DEFAULT_LEVEL, + unsigned int version = SBML_DEFAULT_VERSION); + + + /** + * Creates a new Compartment using the given SBMLNamespaces object @p sbmlns. + * + * @param sbmlns the SBMLNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Compartment(SBMLNamespaces *sbmlns); + + + /** + * Copy constructor for Compartment. + * + * @param orig the Compartment instance to copy. + */ + Compartment(const Compartment& orig); + + + /** + * Assignment operator for Compartment. + * + * @param rhs the Compartment object whose values are to be used as the basis + * of the assignment. + */ + Compartment& operator=(const Compartment& rhs); + + + /** + * Creates and returns a deep copy of this Compartment object. + * + * @return a (deep) copy of this Compartment object. + */ + virtual Compartment* clone() const; + + + /** + * Destructor for Compartment. + */ + virtual ~Compartment(); + + + /** + * Returns the value of the "size" attribute of this Compartment. + * + * @return the value of the "size" attribute of this Compartment as a double. + */ + double getSize() const; + + + /** + * Returns the value of the "volume" attribute of this Compartment. + * + * @return the value of the "volume" attribute of this Compartment as a + * double. + */ + double getVolume() const; + + + /** + * Returns the value of the "units" attribute of this Compartment. + * + * @return the value of the "units" attribute of this Compartment as a + * string. + */ + const std::string& getUnits() const; + + + /** + * Returns the value of the "spatialDimensions" attribute of this + * Compartment. + * + * @return the value of the "spatialDimensions" attribute of this Compartment + * as a unsigned integer. + */ + unsigned int getSpatialDimensions() const; + + + /** + * Returns the value of the "constant" attribute of this Compartment. + * + * @return the value of the "constant" attribute of this Compartment as a + * boolean. + */ + bool getConstant() const; + + + /** + * Returns the value of the "outside" attribute of this Compartment. + * + * @return the value of the "outside" attribute of this Compartment as a + * string. + */ + const std::string& getOutside() const; + + + /** + * Returns the value of the "compartmentType" attribute of this Compartment. + * + * @return the value of the "compartmentType" attribute of this Compartment + * as a string. + */ + const std::string& getCompartmentType() const; + + + /** + * Predicate returning @c true if this Compartment's "size" attribute is set. + * + * @return @c true if this Compartment's "size" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetSize() const; + + + /** + * Predicate returning @c true if this Compartment's "volume" attribute is + * set. + * + * @return @c true if this Compartment's "volume" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetVolume() const; + + + /** + * Predicate returning @c true if this Compartment's "units" attribute is + * set. + * + * @return @c true if this Compartment's "units" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetUnits() const; + + + /** + * Predicate returning @c true if this Compartment's "spatialDimensions" + * attribute is set. + * + * @return @c true if this Compartment's "spatialDimensions" attribute has + * been set, otherwise @c false is returned. + */ + bool isSetSpatialDimensions() const; + + + /** + * Predicate returning @c true if this Compartment's "constant" attribute is + * set. + * + * @return @c true if this Compartment's "constant" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetConstant() const; + + + /** + * Predicate returning @c true if this Compartment's "outside" attribute is + * set. + * + * @return @c true if this Compartment's "outside" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetOutside() const; + + + /** + * Predicate returning @c true if this Compartment's "compartmentType" + * attribute is set. + * + * @return @c true if this Compartment's "compartmentType" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetCompartmentType() const; + + + /** + * Sets the value of the "size" attribute of this Compartment. + * + * @param size double value of the "size" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setSize(double size); + + + /** + * Sets the value of the "volume" attribute of this Compartment. + * + * @param volume double value of the "volume" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setVolume(double volume); + + + /** + * Sets the value of the "units" attribute of this Compartment. + * + * @param units std::string& value of the "units" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setUnits(const std::string& units); + + + /** + * Sets the value of the "spatialDimensions" attribute of this Compartment. + * + * @param spatialDimensions unsigned int value of the "spatialDimensions" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setSpatialDimensions(unsigned int spatialDimensions); + + + /** + * Sets the value of the "constant" attribute of this Compartment. + * + * @param constant bool value of the "constant" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setConstant(bool constant); + + + /** + * Sets the value of the "outside" attribute of this Compartment. + * + * @param outside std::string& value of the "outside" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setOutside(const std::string& outside); + + + /** + * Sets the value of the "compartmentType" attribute of this Compartment. + * + * @param compartmentType std::string& value of the "compartmentType" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setCompartmentType(const std::string& compartmentType); + + + /** + * Unsets the value of the "size" attribute of this Compartment. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetSize(); + + + /** + * Unsets the value of the "volume" attribute of this Compartment. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetVolume(); + + + /** + * Unsets the value of the "units" attribute of this Compartment. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetUnits(); + + + /** + * Unsets the value of the "spatialDimensions" attribute of this Compartment. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetSpatialDimensions(); + + + /** + * Unsets the value of the "constant" attribute of this Compartment. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetConstant(); + + + /** + * Unsets the value of the "outside" attribute of this Compartment. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetOutside(); + + + /** + * Unsets the value of the "compartmentType" attribute of this Compartment. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetCompartmentType(); + + + /** + * @copydoc doc_renamesidref_common + */ + virtual void renameSIdRefs(const std::string& oldid, + const std::string& newid); + + + /** + * Returns the XML element name of this Compartment object. + * + * For Compartment, the XML element name is always @c "". + * + * @return the name of this element, i.e. @c "". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Compartment object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{CORE_COMPARTMENT, SBMLTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * Compartment object have been set. + * + * @return @c true to indicate that all the required attributes of this + * Compartment have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the Compartment object are: + * @li "constant" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Compartment's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Compartment's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Compartment. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER + XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Compartment_t using the given SBML Level and @ p version + * values. + * + * @param level an unsigned int, the SBML Level to assign to this + * Compartment_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Compartment_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +Compartment_t * +Compartment_create(unsigned int level, unsigned int version); + + +/** + * Creates and returns a deep copy of this Compartment_t object. + * + * @param c the Compartment_t structure. + * + * @return a (deep) copy of this Compartment_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +Compartment_t* +Compartment_clone(const Compartment_t* c); + + +/** + * Frees this Compartment_t object. + * + * @param c the Compartment_t structure. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +void +Compartment_free(Compartment_t* c); + + +/** + * Returns the value of the "size" attribute of this Compartment_t. + * + * @param c the Compartment_t structure whose size is sought. + * + * @return the value of the "size" attribute of this Compartment_t as a double. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +double +Compartment_getSize(const Compartment_t * c); + + +/** + * Returns the value of the "volume" attribute of this Compartment_t. + * + * @param c the Compartment_t structure whose volume is sought. + * + * @return the value of the "volume" attribute of this Compartment_t as a + * double. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +double +Compartment_getVolume(const Compartment_t * c); + + +/** + * Returns the value of the "units" attribute of this Compartment_t. + * + * @param c the Compartment_t structure whose units is sought. + * + * @return the value of the "units" attribute of this Compartment_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +char * +Compartment_getUnits(const Compartment_t * c); + + +/** + * Returns the value of the "spatialDimensions" attribute of this + * Compartment_t. + * + * @param c the Compartment_t structure whose spatialDimensions is sought. + * + * @return the value of the "spatialDimensions" attribute of this Compartment_t + * as a unsigned integer. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +unsigned int +Compartment_getSpatialDimensions(const Compartment_t * c); + + +/** + * Returns the value of the "constant" attribute of this Compartment_t. + * + * @param c the Compartment_t structure whose constant is sought. + * + * @return the value of the "constant" attribute of this Compartment_t as a + * boolean. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_getConstant(const Compartment_t * c); + + +/** + * Returns the value of the "outside" attribute of this Compartment_t. + * + * @param c the Compartment_t structure whose outside is sought. + * + * @return the value of the "outside" attribute of this Compartment_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +char * +Compartment_getOutside(const Compartment_t * c); + + +/** + * Returns the value of the "compartmentType" attribute of this Compartment_t. + * + * @param c the Compartment_t structure whose compartmentType is sought. + * + * @return the value of the "compartmentType" attribute of this Compartment_t + * as a pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +char * +Compartment_getCompartmentType(const Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if this Compartment_t's "size" attribute is + * set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) if this Compartment_t's "size" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_isSetSize(const Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if this Compartment_t's "volume" attribute + * is set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) if this Compartment_t's "volume" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_isSetVolume(const Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if this Compartment_t's "units" attribute is + * set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) if this Compartment_t's "units" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_isSetUnits(const Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if this Compartment_t's "spatialDimensions" + * attribute is set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) if this Compartment_t's "spatialDimensions" attribute + * has been set, otherwise @c 0 (false) is returned. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_isSetSpatialDimensions(const Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if this Compartment_t's "constant" attribute + * is set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) if this Compartment_t's "constant" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_isSetConstant(const Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if this Compartment_t's "outside" attribute + * is set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) if this Compartment_t's "outside" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_isSetOutside(const Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if this Compartment_t's "compartmentType" + * attribute is set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) if this Compartment_t's "compartmentType" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_isSetCompartmentType(const Compartment_t * c); + + +/** + * Sets the value of the "size" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @param size double value of the "size" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_setSize(Compartment_t * c, double size); + + +/** + * Sets the value of the "volume" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @param volume double value of the "volume" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_setVolume(Compartment_t * c, double volume); + + +/** + * Sets the value of the "units" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @param units const char * value of the "units" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_setUnits(Compartment_t * c, const char * units); + + +/** + * Sets the value of the "spatialDimensions" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @param spatialDimensions unsigned int value of the "spatialDimensions" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_setSpatialDimensions(Compartment_t * c, + unsigned int spatialDimensions); + + +/** + * Sets the value of the "constant" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @param constant int value of the "constant" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_setConstant(Compartment_t * c, int constant); + + +/** + * Sets the value of the "outside" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @param outside const char * value of the "outside" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_setOutside(Compartment_t * c, const char * outside); + + +/** + * Sets the value of the "compartmentType" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @param compartmentType const char * value of the "compartmentType" attribute + * to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_setCompartmentType(Compartment_t * c, + const char * compartmentType); + + +/** + * Unsets the value of the "size" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_unsetSize(Compartment_t * c); + + +/** + * Unsets the value of the "volume" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_unsetVolume(Compartment_t * c); + + +/** + * Unsets the value of the "units" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_unsetUnits(Compartment_t * c); + + +/** + * Unsets the value of the "spatialDimensions" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_unsetSpatialDimensions(Compartment_t * c); + + +/** + * Unsets the value of the "constant" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_unsetConstant(Compartment_t * c); + + +/** + * Unsets the value of the "outside" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_unsetOutside(Compartment_t * c); + + +/** + * Unsets the value of the "compartmentType" attribute of this Compartment_t. + * + * @param c the Compartment_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_unsetCompartmentType(Compartment_t * c); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Compartment_t object have been set. + * + * @param c the Compartment_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Compartment_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the Compartment_t object are: + * @li "constant" + * + * @memberof Compartment_t + */ +LIBSBML_EXTERN +int +Compartment_hasRequiredAttributes(const Compartment_t * c); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Compartment_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Constraint.cpp b/generator/tests/test_cpp_code/test-code/Constraint.cpp index c7c68efa..82510141 100644 --- a/generator/tests/test_cpp_code/test-code/Constraint.cpp +++ b/generator/tests/test_cpp_code/test-code/Constraint.cpp @@ -1,803 +1,803 @@ -/** - * @file Constraint.cpp - * @brief Implementation of the Constraint class. - * @author DEVISER - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Constraint using the given SBML Level and @ p version values. - */ -Constraint::Constraint(unsigned int level, unsigned int version) - : SBase(level, version) - , mMath (NULL) - , mMessage (NULL) -{ - setSBMLNamespacesAndOwn(new SBMLNamespaces(level, version)); - connectToChild(); -} - - -/* - * Creates a new Constraint using the given SBMLNamespaces object @p sbmlns. - */ -Constraint::Constraint(SBMLNamespaces *sbmlns) - : SBase(sbmlns) - , mMath (NULL) - , mMessage (NULL) -{ - setElementNamespace(sbmlns->getURI()); - connectToChild(); -} - - -/* - * Copy constructor for Constraint. - */ -Constraint::Constraint(const Constraint& orig) - : SBase( orig ) - , mMath ( NULL ) - , mMessage ( NULL ) -{ - if (orig.mMath != NULL) - { - mMath = orig.mMath->deepCopy(); - } - - if (orig.mMessage != NULL) - { - mMessage = orig.mMessage->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for Constraint. - */ -Constraint& -Constraint::operator=(const Constraint& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - delete mMath; - if (rhs.mMath != NULL) - { - mMath = rhs.mMath->deepCopy(); - } - else - { - mMath = NULL; - } - - delete mMessage; - if (rhs.mMessage != NULL) - { - mMessage = rhs.mMessage->clone(); - } - else - { - mMessage = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Constraint object. - */ -Constraint* -Constraint::clone() const -{ - return new Constraint(*this); -} - - -/* - * Destructor for Constraint. - */ -Constraint::~Constraint() -{ - delete mMath; - mMath = NULL; - delete mMessage; - mMessage = NULL; -} - - -/* - * Returns the value of the "math" element of this Constraint. - */ -const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* -Constraint::getMath() const -{ - return mMath; -} - - -/* - * Returns the value of the "math" element of this Constraint. - */ -LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* -Constraint::getMath() -{ - return mMath; -} - - -/* - * Returns the value of the "message" element of this Constraint. - */ -const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* -Constraint::getMessage() const -{ - return mMessage; -} - - -/* - * Returns the value of the "message" element of this Constraint. - */ -LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* -Constraint::getMessage() -{ - return mMessage; -} - - -/* - * Predicate returning @c true if this Constraint's "math" element is set. - */ -bool -Constraint::isSetMath() const -{ - return (mMath != NULL); -} - - -/* - * Predicate returning @c true if this Constraint's "message" element is set. - */ -bool -Constraint::isSetMessage() const -{ - return (mMessage != NULL); -} - - -/* - * Sets the value of the "math" element of this Constraint. - */ -int -Constraint::setMath(const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* math) -{ - if (mMath == math) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (math == NULL) - { - delete mMath; - mMath = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else if (!(math->isWellFormedASTNode())) - { - return LIBSBML_INVALID_OBJECT; - } - else - { - delete mMath; - mMath = (math != NULL) ? math->deepCopy() : NULL; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "message" element of this Constraint. - */ -int -Constraint::setMessage(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* message) -{ - if (mMessage == message) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (message == NULL) - { - delete mMessage; - mMessage = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mMessage; - mMessage = (message != NULL) ? message->clone() : NULL; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "math" element of this Constraint. - */ -int -Constraint::unsetMath() -{ - delete mMath; - mMath = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "message" element of this Constraint. - */ -int -Constraint::unsetMessage() -{ - delete mMessage; - mMessage = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this Constraint object. - */ -const std::string& -Constraint::getElementName() const -{ - static const string name = ""; - return name; -} - - -/* - * Returns the libSBML type code for this Constraint object. - */ -int -Constraint::getTypeCode() const -{ - return CORE_CONSTRAINT; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Constraint::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const -{ - SBase::writeElements(stream); - - if (isSetMath() == true) - { - writeMathML(getMath(), stream, NULL); - } - - if (isSetMessage() == true) - { - stream.startElement("message"); - stream << *mMessage; - stream.endElement("message"); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Constraint::accept(SBMLVisitor& v) const -{ - return false; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Constraint::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Constraint::connectToChild() -{ - SBase::connectToChild(); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Constraint's attribute "attributeName" - * is set. - */ -bool -Constraint::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Constraint. - */ -int -Constraint::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads other XML such as math/notes etc. - */ -bool -Constraint::readOtherXML(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& - stream) -{ - bool read = false; - const string& name = stream.peek().getName(); - - if (name == "math") - { - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken elem = stream.peek(); - const std::string prefix = checkMathMLNamespace(elem); - delete mMath; - mMath = readMathML(stream, prefix); - read = true; - } - - if (name == "message") - { - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& token = stream.next(); - stream.skipText(); - delete mMessage; - LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* xml = new - LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(stream); - mMessage = new LIBSBML_CPP_NAMESPACE_QUALIFIER - XMLNode(*(static_cast(xml))); - stream.skipPastEnd(token); - delete xml; - read = true; - } - - if (SBase::readOtherXML(stream)) - { - read = true; - } - - return read; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Constraint_t using the given SBML Level and @ p version - * values. - */ -LIBSBML_EXTERN -Constraint_t * -Constraint_create(unsigned int level, unsigned int version) -{ - return new Constraint(level, version); -} - - -/* - * Creates and returns a deep copy of this Constraint_t object. - */ -LIBSBML_EXTERN -Constraint_t* -Constraint_clone(const Constraint_t* c) -{ - if (c != NULL) - { - return static_cast(c->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Constraint_t object. - */ -LIBSBML_EXTERN -void -Constraint_free(Constraint_t* c) -{ - if (c != NULL) - { - delete c; - } -} - - -/* - * Returns the value of the "math" element of this Constraint_t. - */ -LIBSBML_EXTERN -const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* -Constraint_getMath(const Constraint_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return (LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t*)(c->getMath()); -} - - -/* - * Returns the value of the "message" element of this Constraint_t. - */ -LIBSBML_EXTERN -const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* -Constraint_getMessage(const Constraint_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t*)(c->getMessage()); -} - - -/* - * Predicate returning @c 1 (true) if this Constraint_t's "math" element is - * set. - */ -LIBSBML_EXTERN -int -Constraint_isSetMath(const Constraint_t * c) -{ - return (c != NULL) ? static_cast(c->isSetMath()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Constraint_t's "message" element is - * set. - */ -LIBSBML_EXTERN -int -Constraint_isSetMessage(const Constraint_t * c) -{ - return (c != NULL) ? static_cast(c->isSetMessage()) : 0; -} - - -/* - * Sets the value of the "math" element of this Constraint_t. - */ -LIBSBML_EXTERN -int -Constraint_setMath(Constraint_t * c, - const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* math) -{ - return (c != NULL) ? c->setMath(math) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "message" element of this Constraint_t. - */ -LIBSBML_EXTERN -int -Constraint_setMessage(Constraint_t * c, - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* message) -{ - return (c != NULL) ? c->setMessage(message) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "math" element of this Constraint_t. - */ -LIBSBML_EXTERN -int -Constraint_unsetMath(Constraint_t * c) -{ - return (c != NULL) ? c->unsetMath() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "message" element of this Constraint_t. - */ -LIBSBML_EXTERN -int -Constraint_unsetMessage(Constraint_t * c) -{ - return (c != NULL) ? c->unsetMessage() : LIBSBML_INVALID_OBJECT; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Constraint.cpp + * @brief Implementation of the Constraint class. + * @author DEVISER + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Constraint using the given SBML Level and @ p version values. + */ +Constraint::Constraint(unsigned int level, unsigned int version) + : SBase(level, version) + , mMath (NULL) + , mMessage (NULL) +{ + setSBMLNamespacesAndOwn(new SBMLNamespaces(level, version)); + connectToChild(); +} + + +/* + * Creates a new Constraint using the given SBMLNamespaces object @p sbmlns. + */ +Constraint::Constraint(SBMLNamespaces *sbmlns) + : SBase(sbmlns) + , mMath (NULL) + , mMessage (NULL) +{ + setElementNamespace(sbmlns->getURI()); + connectToChild(); +} + + +/* + * Copy constructor for Constraint. + */ +Constraint::Constraint(const Constraint& orig) + : SBase( orig ) + , mMath ( NULL ) + , mMessage ( NULL ) +{ + if (orig.mMath != NULL) + { + mMath = orig.mMath->deepCopy(); + } + + if (orig.mMessage != NULL) + { + mMessage = orig.mMessage->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for Constraint. + */ +Constraint& +Constraint::operator=(const Constraint& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + delete mMath; + if (rhs.mMath != NULL) + { + mMath = rhs.mMath->deepCopy(); + } + else + { + mMath = NULL; + } + + delete mMessage; + if (rhs.mMessage != NULL) + { + mMessage = rhs.mMessage->clone(); + } + else + { + mMessage = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Constraint object. + */ +Constraint* +Constraint::clone() const +{ + return new Constraint(*this); +} + + +/* + * Destructor for Constraint. + */ +Constraint::~Constraint() +{ + delete mMath; + mMath = NULL; + delete mMessage; + mMessage = NULL; +} + + +/* + * Returns the value of the "math" element of this Constraint. + */ +const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* +Constraint::getMath() const +{ + return mMath; +} + + +/* + * Returns the value of the "math" element of this Constraint. + */ +LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* +Constraint::getMath() +{ + return mMath; +} + + +/* + * Returns the value of the "message" element of this Constraint. + */ +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* +Constraint::getMessage() const +{ + return mMessage; +} + + +/* + * Returns the value of the "message" element of this Constraint. + */ +LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* +Constraint::getMessage() +{ + return mMessage; +} + + +/* + * Predicate returning @c true if this Constraint's "math" element is set. + */ +bool +Constraint::isSetMath() const +{ + return (mMath != NULL); +} + + +/* + * Predicate returning @c true if this Constraint's "message" element is set. + */ +bool +Constraint::isSetMessage() const +{ + return (mMessage != NULL); +} + + +/* + * Sets the value of the "math" element of this Constraint. + */ +int +Constraint::setMath(const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* math) +{ + if (mMath == math) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (math == NULL) + { + delete mMath; + mMath = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else if (!(math->isWellFormedASTNode())) + { + return LIBSBML_INVALID_OBJECT; + } + else + { + delete mMath; + mMath = (math != NULL) ? math->deepCopy() : NULL; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "message" element of this Constraint. + */ +int +Constraint::setMessage(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* message) +{ + if (mMessage == message) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (message == NULL) + { + delete mMessage; + mMessage = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mMessage; + mMessage = (message != NULL) ? message->clone() : NULL; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "math" element of this Constraint. + */ +int +Constraint::unsetMath() +{ + delete mMath; + mMath = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "message" element of this Constraint. + */ +int +Constraint::unsetMessage() +{ + delete mMessage; + mMessage = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this Constraint object. + */ +const std::string& +Constraint::getElementName() const +{ + static const string name = ""; + return name; +} + + +/* + * Returns the libSBML type code for this Constraint object. + */ +int +Constraint::getTypeCode() const +{ + return CORE_CONSTRAINT; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Constraint::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + SBase::writeElements(stream); + + if (isSetMath() == true) + { + writeMathML(getMath(), stream, NULL); + } + + if (isSetMessage() == true) + { + stream.startElement("message"); + stream << *mMessage; + stream.endElement("message"); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Constraint::accept(SBMLVisitor& v) const +{ + return false; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Constraint::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Constraint::connectToChild() +{ + SBase::connectToChild(); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Constraint's attribute "attributeName" + * is set. + */ +bool +Constraint::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Constraint. + */ +int +Constraint::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads other XML such as math/notes etc. + */ +bool +Constraint::readOtherXML(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream) +{ + bool read = false; + const string& name = stream.peek().getName(); + + if (name == "math") + { + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken elem = stream.peek(); + const std::string prefix = checkMathMLNamespace(elem); + delete mMath; + mMath = readMathML(stream, prefix); + read = true; + } + + if (name == "message") + { + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& token = stream.next(); + stream.skipText(); + delete mMessage; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* xml = new + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(stream); + mMessage = new LIBSBML_CPP_NAMESPACE_QUALIFIER + XMLNode(*(static_cast(xml))); + stream.skipPastEnd(token); + delete xml; + read = true; + } + + if (SBase::readOtherXML(stream)) + { + read = true; + } + + return read; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Constraint_t using the given SBML Level and @ p version + * values. + */ +LIBSBML_EXTERN +Constraint_t * +Constraint_create(unsigned int level, unsigned int version) +{ + return new Constraint(level, version); +} + + +/* + * Creates and returns a deep copy of this Constraint_t object. + */ +LIBSBML_EXTERN +Constraint_t* +Constraint_clone(const Constraint_t* c) +{ + if (c != NULL) + { + return static_cast(c->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Constraint_t object. + */ +LIBSBML_EXTERN +void +Constraint_free(Constraint_t* c) +{ + if (c != NULL) + { + delete c; + } +} + + +/* + * Returns the value of the "math" element of this Constraint_t. + */ +LIBSBML_EXTERN +const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* +Constraint_getMath(const Constraint_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return (LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t*)(c->getMath()); +} + + +/* + * Returns the value of the "message" element of this Constraint_t. + */ +LIBSBML_EXTERN +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* +Constraint_getMessage(const Constraint_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t*)(c->getMessage()); +} + + +/* + * Predicate returning @c 1 (true) if this Constraint_t's "math" element is + * set. + */ +LIBSBML_EXTERN +int +Constraint_isSetMath(const Constraint_t * c) +{ + return (c != NULL) ? static_cast(c->isSetMath()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Constraint_t's "message" element is + * set. + */ +LIBSBML_EXTERN +int +Constraint_isSetMessage(const Constraint_t * c) +{ + return (c != NULL) ? static_cast(c->isSetMessage()) : 0; +} + + +/* + * Sets the value of the "math" element of this Constraint_t. + */ +LIBSBML_EXTERN +int +Constraint_setMath(Constraint_t * c, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* math) +{ + return (c != NULL) ? c->setMath(math) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "message" element of this Constraint_t. + */ +LIBSBML_EXTERN +int +Constraint_setMessage(Constraint_t * c, + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* message) +{ + return (c != NULL) ? c->setMessage(message) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "math" element of this Constraint_t. + */ +LIBSBML_EXTERN +int +Constraint_unsetMath(Constraint_t * c) +{ + return (c != NULL) ? c->unsetMath() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "message" element of this Constraint_t. + */ +LIBSBML_EXTERN +int +Constraint_unsetMessage(Constraint_t * c) +{ + return (c != NULL) ? c->unsetMessage() : LIBSBML_INVALID_OBJECT; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Constraint.h b/generator/tests/test_cpp_code/test-code/Constraint.h index cbec85d6..6763186d 100644 --- a/generator/tests/test_cpp_code/test-code/Constraint.h +++ b/generator/tests/test_cpp_code/test-code/Constraint.h @@ -1,793 +1,793 @@ -/** - * @file Constraint.h - * @brief Definition of the Constraint class. - * @author DEVISER - * - * - * - * @class Constraint - * @sbmlbrief{core} TODO:Definition of the Constraint class. - */ - - -#ifndef Constraint_H__ -#define Constraint_H__ - - -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Constraint : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* mMath; - LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* mMessage; - - /** @endcond */ - -public: - - /** - * Creates a new Constraint using the given SBML Level and @ p version - * values. - * - * @param level an unsigned int, the SBML Level to assign to this Constraint. - * - * @param version an unsigned int, the SBML Version to assign to this - * Constraint. - * - * @copydetails doc_note_setting_lv_pkg - */ - Constraint(unsigned int level = SBML_DEFAULT_LEVEL, - unsigned int version = SBML_DEFAULT_VERSION); - - - /** - * Creates a new Constraint using the given SBMLNamespaces object @p sbmlns. - * - * @param sbmlns the SBMLNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Constraint(SBMLNamespaces *sbmlns); - - - /** - * Copy constructor for Constraint. - * - * @param orig the Constraint instance to copy. - */ - Constraint(const Constraint& orig); - - - /** - * Assignment operator for Constraint. - * - * @param rhs the Constraint object whose values are to be used as the basis - * of the assignment. - */ - Constraint& operator=(const Constraint& rhs); - - - /** - * Creates and returns a deep copy of this Constraint object. - * - * @return a (deep) copy of this Constraint object. - */ - virtual Constraint* clone() const; - - - /** - * Destructor for Constraint. - */ - virtual ~Constraint(); - - - /** - * Returns the value of the "math" element of this Constraint. - * - * @return the value of the "math" element of this Constraint as a - * LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode*. - */ - const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* getMath() const; - - - /** - * Returns the value of the "math" element of this Constraint. - * - * @return the value of the "math" element of this Constraint as a - * LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode*. - */ - LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* getMath(); - - - /** - * Returns the value of the "message" element of this Constraint. - * - * @return the value of the "message" element of this Constraint as a - * LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode*. - */ - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getMessage() const; - - - /** - * Returns the value of the "message" element of this Constraint. - * - * @return the value of the "message" element of this Constraint as a - * LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode*. - */ - LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getMessage(); - - - /** - * Predicate returning @c true if this Constraint's "math" element is set. - * - * @return @c true if this Constraint's "math" element has been set, - * otherwise @c false is returned. - */ - bool isSetMath() const; - - - /** - * Predicate returning @c true if this Constraint's "message" element is set. - * - * @return @c true if this Constraint's "message" element has been set, - * otherwise @c false is returned. - */ - bool isSetMessage() const; - - - /** - * Sets the value of the "math" element of this Constraint. - * - * @param math LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* value of the "math" - * element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setMath(const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* math); - - - /** - * Sets the value of the "message" element of this Constraint. - * - * @param message LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* value of the - * "message" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setMessage(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* message); - - - /** - * Unsets the value of the "math" element of this Constraint. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetMath(); - - - /** - * Unsets the value of the "message" element of this Constraint. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetMessage(); - - - /** - * Returns the XML element name of this Constraint object. - * - * For Constraint, the XML element name is always @c "". - * - * @return the name of this element, i.e. @c "". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Constraint object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{CORE_CONSTRAINT, SBMLTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Constraint's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Constraint's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Constraint. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads other XML such as math/notes etc. - */ - virtual bool readOtherXML(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& - stream); - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Constraint_t using the given SBML Level and @ p version - * values. - * - * @param level an unsigned int, the SBML Level to assign to this Constraint_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Constraint_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -Constraint_t * -Constraint_create(unsigned int level, unsigned int version); - - -/** - * Creates and returns a deep copy of this Constraint_t object. - * - * @param c the Constraint_t structure. - * - * @return a (deep) copy of this Constraint_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -Constraint_t* -Constraint_clone(const Constraint_t* c); - - -/** - * Frees this Constraint_t object. - * - * @param c the Constraint_t structure. - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -void -Constraint_free(Constraint_t* c); - - -/** - * Returns the value of the "math" element of this Constraint_t. - * - * @param c the Constraint_t structure whose math is sought. - * - * @return the value of the "math" element of this Constraint_t as a pointer to - * an ASTNode_t object. - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* -Constraint_getMath(const Constraint_t * c); - - -/** - * Returns the value of the "message" element of this Constraint_t. - * - * @param c the Constraint_t structure whose message is sought. - * - * @return the value of the "message" element of this Constraint_t as a - * LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode*. - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* -Constraint_getMessage(const Constraint_t * c); - - -/** - * Predicate returning @c 1 (true) if this Constraint_t's "math" element is - * set. - * - * @param c the Constraint_t structure. - * - * @return @c 1 (true) if this Constraint_t's "math" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -int -Constraint_isSetMath(const Constraint_t * c); - - -/** - * Predicate returning @c 1 (true) if this Constraint_t's "message" element is - * set. - * - * @param c the Constraint_t structure. - * - * @return @c 1 (true) if this Constraint_t's "message" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -int -Constraint_isSetMessage(const Constraint_t * c); - - -/** - * Sets the value of the "math" element of this Constraint_t. - * - * @param c the Constraint_t structure. - * - * @param math LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* value of the "math" - * element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -int -Constraint_setMath(Constraint_t * c, - const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* math); - - -/** - * Sets the value of the "message" element of this Constraint_t. - * - * @param c the Constraint_t structure. - * - * @param message LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* value of the - * "message" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -int -Constraint_setMessage(Constraint_t * c, - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* - message); - - -/** - * Unsets the value of the "math" element of this Constraint_t. - * - * @param c the Constraint_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -int -Constraint_unsetMath(Constraint_t * c); - - -/** - * Unsets the value of the "message" element of this Constraint_t. - * - * @param c the Constraint_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Constraint_t - */ -LIBSBML_EXTERN -int -Constraint_unsetMessage(Constraint_t * c); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Constraint_H__ */ - - +/** + * @file Constraint.h + * @brief Definition of the Constraint class. + * @author DEVISER + * + * + * + * @class Constraint + * @sbmlbrief{core} TODO:Definition of the Constraint class. + */ + + +#ifndef Constraint_H__ +#define Constraint_H__ + + +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Constraint : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* mMath; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* mMessage; + + /** @endcond */ + +public: + + /** + * Creates a new Constraint using the given SBML Level and @ p version + * values. + * + * @param level an unsigned int, the SBML Level to assign to this Constraint. + * + * @param version an unsigned int, the SBML Version to assign to this + * Constraint. + * + * @copydetails doc_note_setting_lv_pkg + */ + Constraint(unsigned int level = SBML_DEFAULT_LEVEL, + unsigned int version = SBML_DEFAULT_VERSION); + + + /** + * Creates a new Constraint using the given SBMLNamespaces object @p sbmlns. + * + * @param sbmlns the SBMLNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Constraint(SBMLNamespaces *sbmlns); + + + /** + * Copy constructor for Constraint. + * + * @param orig the Constraint instance to copy. + */ + Constraint(const Constraint& orig); + + + /** + * Assignment operator for Constraint. + * + * @param rhs the Constraint object whose values are to be used as the basis + * of the assignment. + */ + Constraint& operator=(const Constraint& rhs); + + + /** + * Creates and returns a deep copy of this Constraint object. + * + * @return a (deep) copy of this Constraint object. + */ + virtual Constraint* clone() const; + + + /** + * Destructor for Constraint. + */ + virtual ~Constraint(); + + + /** + * Returns the value of the "math" element of this Constraint. + * + * @return the value of the "math" element of this Constraint as a + * LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode*. + */ + const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* getMath() const; + + + /** + * Returns the value of the "math" element of this Constraint. + * + * @return the value of the "math" element of this Constraint as a + * LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode*. + */ + LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* getMath(); + + + /** + * Returns the value of the "message" element of this Constraint. + * + * @return the value of the "message" element of this Constraint as a + * LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode*. + */ + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getMessage() const; + + + /** + * Returns the value of the "message" element of this Constraint. + * + * @return the value of the "message" element of this Constraint as a + * LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode*. + */ + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getMessage(); + + + /** + * Predicate returning @c true if this Constraint's "math" element is set. + * + * @return @c true if this Constraint's "math" element has been set, + * otherwise @c false is returned. + */ + bool isSetMath() const; + + + /** + * Predicate returning @c true if this Constraint's "message" element is set. + * + * @return @c true if this Constraint's "message" element has been set, + * otherwise @c false is returned. + */ + bool isSetMessage() const; + + + /** + * Sets the value of the "math" element of this Constraint. + * + * @param math LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* value of the "math" + * element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setMath(const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode* math); + + + /** + * Sets the value of the "message" element of this Constraint. + * + * @param message LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* value of the + * "message" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setMessage(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* message); + + + /** + * Unsets the value of the "math" element of this Constraint. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetMath(); + + + /** + * Unsets the value of the "message" element of this Constraint. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetMessage(); + + + /** + * Returns the XML element name of this Constraint object. + * + * For Constraint, the XML element name is always @c "". + * + * @return the name of this element, i.e. @c "". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Constraint object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{CORE_CONSTRAINT, SBMLTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Constraint's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Constraint's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Constraint. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads other XML such as math/notes etc. + */ + virtual bool readOtherXML(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream); + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Constraint_t using the given SBML Level and @ p version + * values. + * + * @param level an unsigned int, the SBML Level to assign to this Constraint_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Constraint_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +Constraint_t * +Constraint_create(unsigned int level, unsigned int version); + + +/** + * Creates and returns a deep copy of this Constraint_t object. + * + * @param c the Constraint_t structure. + * + * @return a (deep) copy of this Constraint_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +Constraint_t* +Constraint_clone(const Constraint_t* c); + + +/** + * Frees this Constraint_t object. + * + * @param c the Constraint_t structure. + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +void +Constraint_free(Constraint_t* c); + + +/** + * Returns the value of the "math" element of this Constraint_t. + * + * @param c the Constraint_t structure whose math is sought. + * + * @return the value of the "math" element of this Constraint_t as a pointer to + * an ASTNode_t object. + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* +Constraint_getMath(const Constraint_t * c); + + +/** + * Returns the value of the "message" element of this Constraint_t. + * + * @param c the Constraint_t structure whose message is sought. + * + * @return the value of the "message" element of this Constraint_t as a + * LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode*. + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* +Constraint_getMessage(const Constraint_t * c); + + +/** + * Predicate returning @c 1 (true) if this Constraint_t's "math" element is + * set. + * + * @param c the Constraint_t structure. + * + * @return @c 1 (true) if this Constraint_t's "math" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +int +Constraint_isSetMath(const Constraint_t * c); + + +/** + * Predicate returning @c 1 (true) if this Constraint_t's "message" element is + * set. + * + * @param c the Constraint_t structure. + * + * @return @c 1 (true) if this Constraint_t's "message" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +int +Constraint_isSetMessage(const Constraint_t * c); + + +/** + * Sets the value of the "math" element of this Constraint_t. + * + * @param c the Constraint_t structure. + * + * @param math LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* value of the "math" + * element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +int +Constraint_setMath(Constraint_t * c, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ASTNode_t* math); + + +/** + * Sets the value of the "message" element of this Constraint_t. + * + * @param c the Constraint_t structure. + * + * @param message LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* value of the + * "message" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +int +Constraint_setMessage(Constraint_t * c, + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode_t* + message); + + +/** + * Unsets the value of the "math" element of this Constraint_t. + * + * @param c the Constraint_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +int +Constraint_unsetMath(Constraint_t * c); + + +/** + * Unsets the value of the "message" element of this Constraint_t. + * + * @param c the Constraint_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Constraint_t + */ +LIBSBML_EXTERN +int +Constraint_unsetMessage(Constraint_t * c); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Constraint_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Container.cpp b/generator/tests/test_cpp_code/test-code/Container.cpp index 8fc2ad34..c008d43d 100644 --- a/generator/tests/test_cpp_code/test-code/Container.cpp +++ b/generator/tests/test_cpp_code/test-code/Container.cpp @@ -1,995 +1,995 @@ -/** - * @file Container.cpp - * @brief Implementation of the Container class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Container using the given SBML Level, Version and - * “test” package version. - */ -Container::Container(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mMyLoTests (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new Container using the given TestPkgNamespaces object. - */ -Container::Container(TestPkgNamespaces *testns) - : SBase(testns) - , mMyLoTests (testns) -{ - setElementNamespace(testns->getURI()); - connectToChild(); - loadPlugins(testns); -} - - -/* - * Copy constructor for Container. - */ -Container::Container(const Container& orig) - : SBase( orig ) - , mMyLoTests ( orig.mMyLoTests ) -{ - connectToChild(); -} - - -/* - * Assignment operator for Container. - */ -Container& -Container::operator=(const Container& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mMyLoTests = rhs.mMyLoTests; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Container object. - */ -Container* -Container::clone() const -{ - return new Container(*this); -} - - -/* - * Destructor for Container. - */ -Container::~Container() -{ -} - - -/* - * Returns the ListOfMyLoTests from this Container. - */ -const ListOfMyLoTests* -Container::getListOfMyLoTests() const -{ - return &mMyLoTests; -} - - -/* - * Returns the ListOfMyLoTests from this Container. - */ -ListOfMyLoTests* -Container::getListOfMyLoTests() -{ - return &mMyLoTests; -} - - -/* - * Get a MyLoTest from the Container. - */ -MyLoTest* -Container::getMyLoTest(unsigned int n) -{ - return mMyLoTests.get(n); -} - - -/* - * Get a MyLoTest from the Container. - */ -const MyLoTest* -Container::getMyLoTest(unsigned int n) const -{ - return mMyLoTests.get(n); -} - - -/* - * Get a MyLoTest from the Container based on its identifier. - */ -MyLoTest* -Container::getMyLoTest(const std::string& sid) -{ - return mMyLoTests.get(sid); -} - - -/* - * Get a MyLoTest from the Container based on its identifier. - */ -const MyLoTest* -Container::getMyLoTest(const std::string& sid) const -{ - return mMyLoTests.get(sid); -} - - -/* - * Adds a copy of the given MyLoTest to this Container. - */ -int -Container::addMyLoTest(const MyLoTest* mlt) -{ - if (mlt == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (mlt->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != mlt->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != mlt->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(mlt)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (mlt->isSetId() && (mMyLoTests.get(mlt->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mMyLoTests.append(mlt); - } -} - - -/* - * Get the number of MyLoTest objects in this Container. - */ -unsigned int -Container::getNumMyLoTests() const -{ - return mMyLoTests.size(); -} - - -/* - * Creates a new MyLoTest object, adds it to this Container object and returns - * the MyLoTest object created. - */ -MyLoTest* -Container::createMyLoTest() -{ - MyLoTest* mlt = NULL; - - try - { - TEST_CREATE_NS(testns, getSBMLNamespaces()); - mlt = new MyLoTest(testns); - delete testns; - } - catch (...) - { - } - - if (mlt != NULL) - { - mMyLoTests.appendAndOwn(mlt); - } - - return mlt; -} - - -/* - * Removes the nth MyLoTest from this Container and returns a pointer to it. - */ -MyLoTest* -Container::removeMyLoTest(unsigned int n) -{ - return mMyLoTests.remove(n); -} - - -/* - * Removes the MyLoTest from this Container based on its identifier and returns - * a pointer to it. - */ -MyLoTest* -Container::removeMyLoTest(const std::string& sid) -{ - return mMyLoTests.remove(sid); -} - - -/* - * Returns the XML element name of this Container object. - */ -const std::string& -Container::getElementName() const -{ - static const string name = "container"; - return name; -} - - -/* - * Returns the libSBML type code for this Container object. - */ -int -Container::getTypeCode() const -{ - return SBML_TEST_CONTAINER; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Container::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (getNumMyLoTests() > 0) - { - mMyLoTests.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Container::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mMyLoTests.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Container::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - mMyLoTests.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Container::connectToChild() -{ - SBase::connectToChild(); - - mMyLoTests.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Container::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mMyLoTests.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -Container::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - mMyLoTests.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Container. - */ -int -Container::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Container. - */ -int -Container::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Container. - */ -int -Container::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Container. - */ -int -Container::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Container. - */ -int -Container::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Container's attribute "attributeName" is - * set. - */ -bool -Container::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Container. - */ -int -Container::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Container. - */ -int -Container::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Container. - */ -int -Container::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Container. - */ -int -Container::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Container. - */ -int -Container::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Container. - */ -int -Container::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this Container. - */ -SBase* -Container::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "myLoTest") - { - return createMyLoTest(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this Container. - */ -int -Container::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "myLoTest" && element->getTypeCode() == TEST_LO_TEST) - { - return addMyLoTest((const MyLoTest*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Container. - */ -SBase* -Container::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "myLoTest") - { - return removeMyLoTest(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this Container. - */ -unsigned int -Container::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "myLoTest") - { - return getNumMyLoTests(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this Container. - */ -SBase* -Container::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "myLoTest") - { - return getMyLoTest(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -Container::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mMyLoTests.getId() == id) - { - return &mMyLoTests; - } - - obj = mMyLoTests.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -Container::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mMyLoTests.getMetaId() == metaid) - { - return &mMyLoTests; - } - - obj = mMyLoTests.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -Container::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mMyLoTests, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -Container::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - if (name == "listOfMyLoTests") - { - if (getErrorLog() && mMyLoTests.size() != 0) - { - getErrorLog()->logPackageError("test", TestContainerAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mMyLoTests; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Container_t using the given SBML Level, Version and - * “test” package version. - */ -LIBSBML_EXTERN -Container_t * -Container_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new Container(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Container_t object. - */ -LIBSBML_EXTERN -Container_t* -Container_clone(const Container_t* c) -{ - if (c != NULL) - { - return static_cast(c->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Container_t object. - */ -LIBSBML_EXTERN -void -Container_free(Container_t* c) -{ - if (c != NULL) - { - delete c; - } -} - - -/* - * Returns a ListOf_t * containing MyLoTest_t objects from this Container_t. - */ -LIBSBML_EXTERN -ListOf_t* -Container_getListOfMyLoTests(Container_t* c) -{ - return (c != NULL) ? c->getListOfMyLoTests() : NULL; -} - - -/* - * Get a MyLoTest_t from the Container_t. - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_getMyLoTest(Container_t* c, unsigned int n) -{ - return (c != NULL) ? c->getMyLoTest(n) : NULL; -} - - -/* - * Get a MyLoTest_t from the Container_t based on its identifier. - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_getMyLoTestById(Container_t* c, const char *sid) -{ - return (c != NULL && sid != NULL) ? c->getMyLoTest(sid) : NULL; -} - - -/* - * Adds a copy of the given MyLoTest_t to this Container_t. - */ -LIBSBML_EXTERN -int -Container_addMyLoTest(Container_t* c, const MyLoTest_t* mlt) -{ - return (c != NULL) ? c->addMyLoTest(mlt) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of MyLoTest_t objects in this Container_t. - */ -LIBSBML_EXTERN -unsigned int -Container_getNumMyLoTests(Container_t* c) -{ - return (c != NULL) ? c->getNumMyLoTests() : SBML_INT_MAX; -} - - -/* - * Creates a new MyLoTest_t object, adds it to this Container_t object and - * returns the MyLoTest_t object created. - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_createMyLoTest(Container_t* c) -{ - return (c != NULL) ? c->createMyLoTest() : NULL; -} - - -/* - * Removes the nth MyLoTest_t from this Container_t and returns a pointer to - * it. - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_removeMyLoTest(Container_t* c, unsigned int n) -{ - return (c != NULL) ? c->removeMyLoTest(n) : NULL; -} - - -/* - * Removes the MyLoTest_t from this Container_t based on its identifier and - * returns a pointer to it. - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_removeMyLoTestById(Container_t* c, const char* sid) -{ - return (c != NULL && sid != NULL) ? c->removeMyLoTest(sid) : NULL; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Container.cpp + * @brief Implementation of the Container class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Container using the given SBML Level, Version and + * “test” package version. + */ +Container::Container(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mMyLoTests (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new Container using the given TestPkgNamespaces object. + */ +Container::Container(TestPkgNamespaces *testns) + : SBase(testns) + , mMyLoTests (testns) +{ + setElementNamespace(testns->getURI()); + connectToChild(); + loadPlugins(testns); +} + + +/* + * Copy constructor for Container. + */ +Container::Container(const Container& orig) + : SBase( orig ) + , mMyLoTests ( orig.mMyLoTests ) +{ + connectToChild(); +} + + +/* + * Assignment operator for Container. + */ +Container& +Container::operator=(const Container& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mMyLoTests = rhs.mMyLoTests; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Container object. + */ +Container* +Container::clone() const +{ + return new Container(*this); +} + + +/* + * Destructor for Container. + */ +Container::~Container() +{ +} + + +/* + * Returns the ListOfMyLoTests from this Container. + */ +const ListOfMyLoTests* +Container::getListOfMyLoTests() const +{ + return &mMyLoTests; +} + + +/* + * Returns the ListOfMyLoTests from this Container. + */ +ListOfMyLoTests* +Container::getListOfMyLoTests() +{ + return &mMyLoTests; +} + + +/* + * Get a MyLoTest from the Container. + */ +MyLoTest* +Container::getMyLoTest(unsigned int n) +{ + return mMyLoTests.get(n); +} + + +/* + * Get a MyLoTest from the Container. + */ +const MyLoTest* +Container::getMyLoTest(unsigned int n) const +{ + return mMyLoTests.get(n); +} + + +/* + * Get a MyLoTest from the Container based on its identifier. + */ +MyLoTest* +Container::getMyLoTest(const std::string& sid) +{ + return mMyLoTests.get(sid); +} + + +/* + * Get a MyLoTest from the Container based on its identifier. + */ +const MyLoTest* +Container::getMyLoTest(const std::string& sid) const +{ + return mMyLoTests.get(sid); +} + + +/* + * Adds a copy of the given MyLoTest to this Container. + */ +int +Container::addMyLoTest(const MyLoTest* mlt) +{ + if (mlt == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (mlt->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != mlt->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != mlt->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(mlt)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (mlt->isSetId() && (mMyLoTests.get(mlt->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mMyLoTests.append(mlt); + } +} + + +/* + * Get the number of MyLoTest objects in this Container. + */ +unsigned int +Container::getNumMyLoTests() const +{ + return mMyLoTests.size(); +} + + +/* + * Creates a new MyLoTest object, adds it to this Container object and returns + * the MyLoTest object created. + */ +MyLoTest* +Container::createMyLoTest() +{ + MyLoTest* mlt = NULL; + + try + { + TEST_CREATE_NS(testns, getSBMLNamespaces()); + mlt = new MyLoTest(testns); + delete testns; + } + catch (...) + { + } + + if (mlt != NULL) + { + mMyLoTests.appendAndOwn(mlt); + } + + return mlt; +} + + +/* + * Removes the nth MyLoTest from this Container and returns a pointer to it. + */ +MyLoTest* +Container::removeMyLoTest(unsigned int n) +{ + return mMyLoTests.remove(n); +} + + +/* + * Removes the MyLoTest from this Container based on its identifier and returns + * a pointer to it. + */ +MyLoTest* +Container::removeMyLoTest(const std::string& sid) +{ + return mMyLoTests.remove(sid); +} + + +/* + * Returns the XML element name of this Container object. + */ +const std::string& +Container::getElementName() const +{ + static const string name = "container"; + return name; +} + + +/* + * Returns the libSBML type code for this Container object. + */ +int +Container::getTypeCode() const +{ + return SBML_TEST_CONTAINER; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Container::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (getNumMyLoTests() > 0) + { + mMyLoTests.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Container::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mMyLoTests.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Container::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + mMyLoTests.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Container::connectToChild() +{ + SBase::connectToChild(); + + mMyLoTests.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Container::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mMyLoTests.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +Container::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + mMyLoTests.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Container. + */ +int +Container::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Container. + */ +int +Container::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Container. + */ +int +Container::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Container. + */ +int +Container::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Container. + */ +int +Container::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Container's attribute "attributeName" is + * set. + */ +bool +Container::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Container. + */ +int +Container::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Container. + */ +int +Container::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Container. + */ +int +Container::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Container. + */ +int +Container::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Container. + */ +int +Container::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Container. + */ +int +Container::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this Container. + */ +SBase* +Container::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "myLoTest") + { + return createMyLoTest(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this Container. + */ +int +Container::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "myLoTest" && element->getTypeCode() == TEST_LO_TEST) + { + return addMyLoTest((const MyLoTest*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * Container. + */ +SBase* +Container::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "myLoTest") + { + return removeMyLoTest(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this Container. + */ +unsigned int +Container::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "myLoTest") + { + return getNumMyLoTests(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this Container. + */ +SBase* +Container::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "myLoTest") + { + return getMyLoTest(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +Container::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mMyLoTests.getId() == id) + { + return &mMyLoTests; + } + + obj = mMyLoTests.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +Container::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mMyLoTests.getMetaId() == metaid) + { + return &mMyLoTests; + } + + obj = mMyLoTests.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +Container::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mMyLoTests, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +Container::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "listOfMyLoTests") + { + if (getErrorLog() && mMyLoTests.size() != 0) + { + getErrorLog()->logPackageError("test", TestContainerAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mMyLoTests; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Container_t using the given SBML Level, Version and + * “test” package version. + */ +LIBSBML_EXTERN +Container_t * +Container_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new Container(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Container_t object. + */ +LIBSBML_EXTERN +Container_t* +Container_clone(const Container_t* c) +{ + if (c != NULL) + { + return static_cast(c->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Container_t object. + */ +LIBSBML_EXTERN +void +Container_free(Container_t* c) +{ + if (c != NULL) + { + delete c; + } +} + + +/* + * Returns a ListOf_t * containing MyLoTest_t objects from this Container_t. + */ +LIBSBML_EXTERN +ListOf_t* +Container_getListOfMyLoTests(Container_t* c) +{ + return (c != NULL) ? c->getListOfMyLoTests() : NULL; +} + + +/* + * Get a MyLoTest_t from the Container_t. + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_getMyLoTest(Container_t* c, unsigned int n) +{ + return (c != NULL) ? c->getMyLoTest(n) : NULL; +} + + +/* + * Get a MyLoTest_t from the Container_t based on its identifier. + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_getMyLoTestById(Container_t* c, const char *sid) +{ + return (c != NULL && sid != NULL) ? c->getMyLoTest(sid) : NULL; +} + + +/* + * Adds a copy of the given MyLoTest_t to this Container_t. + */ +LIBSBML_EXTERN +int +Container_addMyLoTest(Container_t* c, const MyLoTest_t* mlt) +{ + return (c != NULL) ? c->addMyLoTest(mlt) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of MyLoTest_t objects in this Container_t. + */ +LIBSBML_EXTERN +unsigned int +Container_getNumMyLoTests(Container_t* c) +{ + return (c != NULL) ? c->getNumMyLoTests() : SBML_INT_MAX; +} + + +/* + * Creates a new MyLoTest_t object, adds it to this Container_t object and + * returns the MyLoTest_t object created. + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_createMyLoTest(Container_t* c) +{ + return (c != NULL) ? c->createMyLoTest() : NULL; +} + + +/* + * Removes the nth MyLoTest_t from this Container_t and returns a pointer to + * it. + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_removeMyLoTest(Container_t* c, unsigned int n) +{ + return (c != NULL) ? c->removeMyLoTest(n) : NULL; +} + + +/* + * Removes the MyLoTest_t from this Container_t based on its identifier and + * returns a pointer to it. + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_removeMyLoTestById(Container_t* c, const char* sid) +{ + return (c != NULL && sid != NULL) ? c->removeMyLoTest(sid) : NULL; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Container.h b/generator/tests/test_cpp_code/test-code/Container.h index 91733e7d..9d7c85d8 100644 --- a/generator/tests/test_cpp_code/test-code/Container.h +++ b/generator/tests/test_cpp_code/test-code/Container.h @@ -1,1089 +1,1089 @@ -/** - * @file Container.h - * @brief Definition of the Container class. - * @author SBMLTeam - * - * - * - * @class Container - * @sbmlbrief{test} TODO:Definition of the Container class. - */ - - -#ifndef Container_H__ -#define Container_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Container : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - ListOfMyLoTests mMyLoTests; - - /** @endcond */ - -public: - - /** - * Creates a new Container using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Container. - * - * @param version an unsigned int, the SBML Version to assign to this - * Container. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * Container. - * - * @copydetails doc_note_setting_lv_pkg - */ - Container(unsigned int level = TestExtension::getDefaultLevel(), - unsigned int version = TestExtension::getDefaultVersion(), - unsigned int pkgVersion = - TestExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Container using the given TestPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param testns the TestPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Container(TestPkgNamespaces *testns); - - - /** - * Copy constructor for Container. - * - * @param orig the Container instance to copy. - */ - Container(const Container& orig); - - - /** - * Assignment operator for Container. - * - * @param rhs the Container object whose values are to be used as the basis - * of the assignment. - */ - Container& operator=(const Container& rhs); - - - /** - * Creates and returns a deep copy of this Container object. - * - * @return a (deep) copy of this Container object. - */ - virtual Container* clone() const; - - - /** - * Destructor for Container. - */ - virtual ~Container(); - - - /** - * Returns the ListOfMyLoTests from this Container. - * - * @return the ListOfMyLoTests from this Container. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - const ListOfMyLoTests* getListOfMyLoTests() const; - - - /** - * Returns the ListOfMyLoTests from this Container. - * - * @return the ListOfMyLoTests from this Container. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - ListOfMyLoTests* getListOfMyLoTests(); - - - /** - * Get a MyLoTest from the Container. - * - * @param n an unsigned int representing the index of the MyLoTest to - * retrieve. - * - * @return the nth MyLoTest in the ListOfMyLoTests within this Container or - * @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - MyLoTest* getMyLoTest(unsigned int n); - - - /** - * Get a MyLoTest from the Container. - * - * @param n an unsigned int representing the index of the MyLoTest to - * retrieve. - * - * @return the nth MyLoTest in the ListOfMyLoTests within this Container or - * @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - const MyLoTest* getMyLoTest(unsigned int n) const; - - - /** - * Get a MyLoTest from the Container based on its identifier. - * - * @param sid a string representing the identifier of the MyLoTest to - * retrieve. - * - * @return the MyLoTest in the ListOfMyLoTests within this Container with the - * given @p sid or @c NULL if no such MyLoTest exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - MyLoTest* getMyLoTest(const std::string& sid); - - - /** - * Get a MyLoTest from the Container based on its identifier. - * - * @param sid a string representing the identifier of the MyLoTest to - * retrieve. - * - * @return the MyLoTest in the ListOfMyLoTests within this Container with the - * given @p sid or @c NULL if no such MyLoTest exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - const MyLoTest* getMyLoTest(const std::string& sid) const; - - - /** - * Adds a copy of the given MyLoTest to this Container. - * - * @param mlt the MyLoTest object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - int addMyLoTest(const MyLoTest* mlt); - - - /** - * Get the number of MyLoTest objects in this Container. - * - * @return the number of MyLoTest objects in this Container. - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getMyLoTest(unsigned int n) - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - unsigned int getNumMyLoTests() const; - - - /** - * Creates a new MyLoTest object, adds it to this Container object and - * returns the MyLoTest object created. - * - * @return a new MyLoTest object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see getMyLoTest(const std::string& sid) - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - * @see removeMyLoTest(unsigned int n) - */ - MyLoTest* createMyLoTest(); - - - /** - * Removes the nth MyLoTest from this Container and returns a pointer to it. - * - * @param n an unsigned int representing the index of the MyLoTest to remove. - * - * @return a pointer to the nth MyLoTest in this Container. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(const std::string& sid) - */ - MyLoTest* removeMyLoTest(unsigned int n); - - - /** - * Removes the MyLoTest from this Container based on its identifier and - * returns a pointer to it. - * - * @param sid a string representing the identifier of the MyLoTest to remove. - * - * @return the MyLoTest in this Container based on the identifier or NULL if - * no such MyLoTest exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addMyLoTest(const MyLoTest* object) - * @see createMyLoTest() - * @see getMyLoTest(const std::string& sid) - * @see getMyLoTest(unsigned int n) - * @see getNumMyLoTests() - * @see removeMyLoTest(unsigned int n) - */ - MyLoTest* removeMyLoTest(const std::string& sid); - - - /** - * Returns the XML element name of this Container object. - * - * For Container, the XML element name is always @c "container". - * - * @return the name of this element, i.e. @c "container". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Container object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_TEST_CONTAINER, SBMLTestTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Container's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Container's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Container. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this Container. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this Container. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * Container. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this Container. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this Container. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Container_t using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Container_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Container_t. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * Container_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Container_t - */ -LIBSBML_EXTERN -Container_t * -Container_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Container_t object. - * - * @param c the Container_t structure. - * - * @return a (deep) copy of this Container_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Container_t - */ -LIBSBML_EXTERN -Container_t* -Container_clone(const Container_t* c); - - -/** - * Frees this Container_t object. - * - * @param c the Container_t structure. - * - * @memberof Container_t - */ -LIBSBML_EXTERN -void -Container_free(Container_t* c); - - -/** - * Returns a ListOf_t * containing MyLoTest_t objects from this Container_t. - * - * @param c the Container_t structure whose ListOfMyLoTests is sought. - * - * @return the ListOfMyLoTests from this Container_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Container_addMyLoTest() - * @see Container_createMyLoTest() - * @see Container_getMyLoTestById() - * @see Container_getMyLoTest() - * @see Container_getNumMyLoTests() - * @see Container_removeMyLoTestById() - * @see Container_removeMyLoTest() - * - * @memberof Container_t - */ -LIBSBML_EXTERN -ListOf_t* -Container_getListOfMyLoTests(Container_t* c); - - -/** - * Get a MyLoTest_t from the Container_t. - * - * @param c the Container_t structure to search. - * - * @param n an unsigned int representing the index of the MyLoTest_t to - * retrieve. - * - * @return the nth MyLoTest_t in the ListOfMyLoTests within this Container or - * @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Container_t - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_getMyLoTest(Container_t* c, unsigned int n); - - -/** - * Get a MyLoTest_t from the Container_t based on its identifier. - * - * @param c the Container_t structure to search. - * - * @param sid a string representing the identifier of the MyLoTest_t to - * retrieve. - * - * @return the MyLoTest_t in the ListOfMyLoTests within this Container with the - * given @p sid or @c NULL if no such MyLoTest_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Container_t - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_getMyLoTestById(Container_t* c, const char *sid); - - -/** - * Adds a copy of the given MyLoTest_t to this Container_t. - * - * @param c the Container_t structure to which the MyLoTest_t should be added. - * - * @param mlt the MyLoTest_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Container_t - */ -LIBSBML_EXTERN -int -Container_addMyLoTest(Container_t* c, const MyLoTest_t* mlt); - - -/** - * Get the number of MyLoTest_t objects in this Container_t. - * - * @param c the Container_t structure to query. - * - * @return the number of MyLoTest_t objects in this Container_t. - * - * @memberof Container_t - */ -LIBSBML_EXTERN -unsigned int -Container_getNumMyLoTests(Container_t* c); - - -/** - * Creates a new MyLoTest_t object, adds it to this Container_t object and - * returns the MyLoTest_t object created. - * - * @param c the Container_t structure to which the MyLoTest_t should be added. - * - * @return a new MyLoTest_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Container_t - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_createMyLoTest(Container_t* c); - - -/** - * Removes the nth MyLoTest_t from this Container_t and returns a pointer to - * it. - * - * @param c the Container_t structure to search. - * - * @param n an unsigned int representing the index of the MyLoTest_t to remove. - * - * @return a pointer to the nth MyLoTest_t in this Container_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Container_t - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_removeMyLoTest(Container_t* c, unsigned int n); - - -/** - * Removes the MyLoTest_t from this Container_t based on its identifier and - * returns a pointer to it. - * - * @param c the Container_t structure to search. - * - * @param sid a string representing the identifier of the MyLoTest_t to remove. - * - * @return the MyLoTest_t in this Container_t based on the identifier or NULL - * if no such MyLoTest_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Container_t - */ -LIBSBML_EXTERN -MyLoTest_t* -Container_removeMyLoTestById(Container_t* c, const char* sid); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Container_H__ */ - - +/** + * @file Container.h + * @brief Definition of the Container class. + * @author SBMLTeam + * + * + * + * @class Container + * @sbmlbrief{test} TODO:Definition of the Container class. + */ + + +#ifndef Container_H__ +#define Container_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Container : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + ListOfMyLoTests mMyLoTests; + + /** @endcond */ + +public: + + /** + * Creates a new Container using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Container. + * + * @param version an unsigned int, the SBML Version to assign to this + * Container. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * Container. + * + * @copydetails doc_note_setting_lv_pkg + */ + Container(unsigned int level = TestExtension::getDefaultLevel(), + unsigned int version = TestExtension::getDefaultVersion(), + unsigned int pkgVersion = + TestExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Container using the given TestPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param testns the TestPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Container(TestPkgNamespaces *testns); + + + /** + * Copy constructor for Container. + * + * @param orig the Container instance to copy. + */ + Container(const Container& orig); + + + /** + * Assignment operator for Container. + * + * @param rhs the Container object whose values are to be used as the basis + * of the assignment. + */ + Container& operator=(const Container& rhs); + + + /** + * Creates and returns a deep copy of this Container object. + * + * @return a (deep) copy of this Container object. + */ + virtual Container* clone() const; + + + /** + * Destructor for Container. + */ + virtual ~Container(); + + + /** + * Returns the ListOfMyLoTests from this Container. + * + * @return the ListOfMyLoTests from this Container. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + const ListOfMyLoTests* getListOfMyLoTests() const; + + + /** + * Returns the ListOfMyLoTests from this Container. + * + * @return the ListOfMyLoTests from this Container. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + ListOfMyLoTests* getListOfMyLoTests(); + + + /** + * Get a MyLoTest from the Container. + * + * @param n an unsigned int representing the index of the MyLoTest to + * retrieve. + * + * @return the nth MyLoTest in the ListOfMyLoTests within this Container or + * @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + MyLoTest* getMyLoTest(unsigned int n); + + + /** + * Get a MyLoTest from the Container. + * + * @param n an unsigned int representing the index of the MyLoTest to + * retrieve. + * + * @return the nth MyLoTest in the ListOfMyLoTests within this Container or + * @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + const MyLoTest* getMyLoTest(unsigned int n) const; + + + /** + * Get a MyLoTest from the Container based on its identifier. + * + * @param sid a string representing the identifier of the MyLoTest to + * retrieve. + * + * @return the MyLoTest in the ListOfMyLoTests within this Container with the + * given @p sid or @c NULL if no such MyLoTest exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + MyLoTest* getMyLoTest(const std::string& sid); + + + /** + * Get a MyLoTest from the Container based on its identifier. + * + * @param sid a string representing the identifier of the MyLoTest to + * retrieve. + * + * @return the MyLoTest in the ListOfMyLoTests within this Container with the + * given @p sid or @c NULL if no such MyLoTest exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + const MyLoTest* getMyLoTest(const std::string& sid) const; + + + /** + * Adds a copy of the given MyLoTest to this Container. + * + * @param mlt the MyLoTest object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + int addMyLoTest(const MyLoTest* mlt); + + + /** + * Get the number of MyLoTest objects in this Container. + * + * @return the number of MyLoTest objects in this Container. + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getMyLoTest(unsigned int n) + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + unsigned int getNumMyLoTests() const; + + + /** + * Creates a new MyLoTest object, adds it to this Container object and + * returns the MyLoTest object created. + * + * @return a new MyLoTest object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see getMyLoTest(const std::string& sid) + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + * @see removeMyLoTest(unsigned int n) + */ + MyLoTest* createMyLoTest(); + + + /** + * Removes the nth MyLoTest from this Container and returns a pointer to it. + * + * @param n an unsigned int representing the index of the MyLoTest to remove. + * + * @return a pointer to the nth MyLoTest in this Container. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(const std::string& sid) + */ + MyLoTest* removeMyLoTest(unsigned int n); + + + /** + * Removes the MyLoTest from this Container based on its identifier and + * returns a pointer to it. + * + * @param sid a string representing the identifier of the MyLoTest to remove. + * + * @return the MyLoTest in this Container based on the identifier or NULL if + * no such MyLoTest exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addMyLoTest(const MyLoTest* object) + * @see createMyLoTest() + * @see getMyLoTest(const std::string& sid) + * @see getMyLoTest(unsigned int n) + * @see getNumMyLoTests() + * @see removeMyLoTest(unsigned int n) + */ + MyLoTest* removeMyLoTest(const std::string& sid); + + + /** + * Returns the XML element name of this Container object. + * + * For Container, the XML element name is always @c "container". + * + * @return the name of this element, i.e. @c "container". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Container object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_TEST_CONTAINER, SBMLTestTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Container's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Container's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Container. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this Container. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this Container. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * Container. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this Container. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this Container. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Container_t using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Container_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Container_t. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * Container_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Container_t + */ +LIBSBML_EXTERN +Container_t * +Container_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Container_t object. + * + * @param c the Container_t structure. + * + * @return a (deep) copy of this Container_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Container_t + */ +LIBSBML_EXTERN +Container_t* +Container_clone(const Container_t* c); + + +/** + * Frees this Container_t object. + * + * @param c the Container_t structure. + * + * @memberof Container_t + */ +LIBSBML_EXTERN +void +Container_free(Container_t* c); + + +/** + * Returns a ListOf_t * containing MyLoTest_t objects from this Container_t. + * + * @param c the Container_t structure whose ListOfMyLoTests is sought. + * + * @return the ListOfMyLoTests from this Container_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Container_addMyLoTest() + * @see Container_createMyLoTest() + * @see Container_getMyLoTestById() + * @see Container_getMyLoTest() + * @see Container_getNumMyLoTests() + * @see Container_removeMyLoTestById() + * @see Container_removeMyLoTest() + * + * @memberof Container_t + */ +LIBSBML_EXTERN +ListOf_t* +Container_getListOfMyLoTests(Container_t* c); + + +/** + * Get a MyLoTest_t from the Container_t. + * + * @param c the Container_t structure to search. + * + * @param n an unsigned int representing the index of the MyLoTest_t to + * retrieve. + * + * @return the nth MyLoTest_t in the ListOfMyLoTests within this Container or + * @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Container_t + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_getMyLoTest(Container_t* c, unsigned int n); + + +/** + * Get a MyLoTest_t from the Container_t based on its identifier. + * + * @param c the Container_t structure to search. + * + * @param sid a string representing the identifier of the MyLoTest_t to + * retrieve. + * + * @return the MyLoTest_t in the ListOfMyLoTests within this Container with the + * given @p sid or @c NULL if no such MyLoTest_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Container_t + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_getMyLoTestById(Container_t* c, const char *sid); + + +/** + * Adds a copy of the given MyLoTest_t to this Container_t. + * + * @param c the Container_t structure to which the MyLoTest_t should be added. + * + * @param mlt the MyLoTest_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Container_t + */ +LIBSBML_EXTERN +int +Container_addMyLoTest(Container_t* c, const MyLoTest_t* mlt); + + +/** + * Get the number of MyLoTest_t objects in this Container_t. + * + * @param c the Container_t structure to query. + * + * @return the number of MyLoTest_t objects in this Container_t. + * + * @memberof Container_t + */ +LIBSBML_EXTERN +unsigned int +Container_getNumMyLoTests(Container_t* c); + + +/** + * Creates a new MyLoTest_t object, adds it to this Container_t object and + * returns the MyLoTest_t object created. + * + * @param c the Container_t structure to which the MyLoTest_t should be added. + * + * @return a new MyLoTest_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Container_t + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_createMyLoTest(Container_t* c); + + +/** + * Removes the nth MyLoTest_t from this Container_t and returns a pointer to + * it. + * + * @param c the Container_t structure to search. + * + * @param n an unsigned int representing the index of the MyLoTest_t to remove. + * + * @return a pointer to the nth MyLoTest_t in this Container_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Container_t + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_removeMyLoTest(Container_t* c, unsigned int n); + + +/** + * Removes the MyLoTest_t from this Container_t based on its identifier and + * returns a pointer to it. + * + * @param c the Container_t structure to search. + * + * @param sid a string representing the identifier of the MyLoTest_t to remove. + * + * @return the MyLoTest_t in this Container_t based on the identifier or NULL + * if no such MyLoTest_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Container_t + */ +LIBSBML_EXTERN +MyLoTest_t* +Container_removeMyLoTestById(Container_t* c, const char* sid); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Container_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ContainerX.cpp b/generator/tests/test_cpp_code/test-code/ContainerX.cpp index 70f159d6..5d50f81e 100644 --- a/generator/tests/test_cpp_code/test-code/ContainerX.cpp +++ b/generator/tests/test_cpp_code/test-code/ContainerX.cpp @@ -1,990 +1,990 @@ -/** - * @file ContainerX.cpp - * @brief Implementation of the ContainerX class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ContainerX using the given SBML Level, Version and - * “x” package version. - */ -ContainerX::ContainerX(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mFreds (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new XPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new ContainerX using the given XPkgNamespaces object. - */ -ContainerX::ContainerX(XPkgNamespaces *xns) - : SBase(xns) - , mFreds (xns) -{ - setElementNamespace(xns->getURI()); - connectToChild(); - loadPlugins(xns); -} - - -/* - * Copy constructor for ContainerX. - */ -ContainerX::ContainerX(const ContainerX& orig) - : SBase( orig ) - , mFreds ( orig.mFreds ) -{ - connectToChild(); -} - - -/* - * Assignment operator for ContainerX. - */ -ContainerX& -ContainerX::operator=(const ContainerX& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mFreds = rhs.mFreds; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ContainerX object. - */ -ContainerX* -ContainerX::clone() const -{ - return new ContainerX(*this); -} - - -/* - * Destructor for ContainerX. - */ -ContainerX::~ContainerX() -{ -} - - -/* - * Returns the ListOfFreds from this ContainerX. - */ -const ListOfFreds* -ContainerX::getListOfFreds() const -{ - return &mFreds; -} - - -/* - * Returns the ListOfFreds from this ContainerX. - */ -ListOfFreds* -ContainerX::getListOfFreds() -{ - return &mFreds; -} - - -/* - * Get a Fred from the ContainerX. - */ -Fred* -ContainerX::getFred(unsigned int n) -{ - return mFreds.get(n); -} - - -/* - * Get a Fred from the ContainerX. - */ -const Fred* -ContainerX::getFred(unsigned int n) const -{ - return mFreds.get(n); -} - - -/* - * Get a Fred from the ContainerX based on its identifier. - */ -Fred* -ContainerX::getFred(const std::string& sid) -{ - return mFreds.get(sid); -} - - -/* - * Get a Fred from the ContainerX based on its identifier. - */ -const Fred* -ContainerX::getFred(const std::string& sid) const -{ - return mFreds.get(sid); -} - - -/* - * Adds a copy of the given Fred to this ContainerX. - */ -int -ContainerX::addFred(const Fred* f) -{ - if (f == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (f->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != f->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != f->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(f)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (f->isSetId() && (mFreds.get(f->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mFreds.append(f); - } -} - - -/* - * Get the number of Fred objects in this ContainerX. - */ -unsigned int -ContainerX::getNumFreds() const -{ - return mFreds.size(); -} - - -/* - * Creates a new Fred object, adds it to this ContainerX object and returns the - * Fred object created. - */ -Fred* -ContainerX::createFred() -{ - Fred* f = NULL; - - try - { - X_CREATE_NS(xns, getSBMLNamespaces()); - f = new Fred(xns); - delete xns; - } - catch (...) - { - } - - if (f != NULL) - { - mFreds.appendAndOwn(f); - } - - return f; -} - - -/* - * Removes the nth Fred from this ContainerX and returns a pointer to it. - */ -Fred* -ContainerX::removeFred(unsigned int n) -{ - return mFreds.remove(n); -} - - -/* - * Removes the Fred from this ContainerX based on its identifier and returns a - * pointer to it. - */ -Fred* -ContainerX::removeFred(const std::string& sid) -{ - return mFreds.remove(sid); -} - - -/* - * Returns the XML element name of this ContainerX object. - */ -const std::string& -ContainerX::getElementName() const -{ - static const string name = "containerX"; - return name; -} - - -/* - * Returns the libSBML type code for this ContainerX object. - */ -int -ContainerX::getTypeCode() const -{ - return SBML_X_CONTAINERX; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ContainerX::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (getNumFreds() > 0) - { - mFreds.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ContainerX::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mFreds.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ContainerX::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - mFreds.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -ContainerX::connectToChild() -{ - SBase::connectToChild(); - - mFreds.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ContainerX::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mFreds.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -ContainerX::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - mFreds.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ContainerX's attribute "attributeName" - * is set. - */ -bool -ContainerX::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this ContainerX. - */ -int -ContainerX::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this ContainerX. - */ -SBase* -ContainerX::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "fred") - { - return createFred(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this ContainerX. - */ -int -ContainerX::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "fred" && element->getTypeCode() == SBML_X_FRED) - { - return addFred((const Fred*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * ContainerX. - */ -SBase* -ContainerX::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "fred") - { - return removeFred(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this ContainerX. - */ -unsigned int -ContainerX::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "fred") - { - return getNumFreds(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this ContainerX. - */ -SBase* -ContainerX::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "fred") - { - return getFred(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -ContainerX::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - obj = mFreds.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -ContainerX::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mFreds.getMetaId() == metaid) - { - return &mFreds; - } - - obj = mFreds.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -ContainerX::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mFreds, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -ContainerX::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - if (name == "listOfFreds") - { - if (getErrorLog() && mFreds.size() != 0) - { - getErrorLog()->logPackageError("x", XContainerXAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mFreds; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ContainerX_t using the given SBML Level, Version and - * “x” package version. - */ -LIBSBML_EXTERN -ContainerX_t * -ContainerX_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ContainerX(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ContainerX_t object. - */ -LIBSBML_EXTERN -ContainerX_t* -ContainerX_clone(const ContainerX_t* cx) -{ - if (cx != NULL) - { - return static_cast(cx->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ContainerX_t object. - */ -LIBSBML_EXTERN -void -ContainerX_free(ContainerX_t* cx) -{ - if (cx != NULL) - { - delete cx; - } -} - - -/* - * Returns a ListOf_t * containing Fred_t objects from this ContainerX_t. - */ -LIBSBML_EXTERN -ListOf_t* -ContainerX_getListOfFreds(ContainerX_t* cx) -{ - return (cx != NULL) ? cx->getListOfFreds() : NULL; -} - - -/* - * Get a Fred_t from the ContainerX_t. - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_getFred(ContainerX_t* cx, unsigned int n) -{ - return (cx != NULL) ? cx->getFred(n) : NULL; -} - - -/* - * Get a Fred_t from the ContainerX_t based on its identifier. - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_getFredById(ContainerX_t* cx, const char *sid) -{ - return (cx != NULL && sid != NULL) ? cx->getFred(sid) : NULL; -} - - -/* - * Adds a copy of the given Fred_t to this ContainerX_t. - */ -LIBSBML_EXTERN -int -ContainerX_addFred(ContainerX_t* cx, const Fred_t* f) -{ - return (cx != NULL) ? cx->addFred(f) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of Fred_t objects in this ContainerX_t. - */ -LIBSBML_EXTERN -unsigned int -ContainerX_getNumFreds(ContainerX_t* cx) -{ - return (cx != NULL) ? cx->getNumFreds() : SBML_INT_MAX; -} - - -/* - * Creates a new Fred_t object, adds it to this ContainerX_t object and returns - * the Fred_t object created. - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_createFred(ContainerX_t* cx) -{ - return (cx != NULL) ? cx->createFred() : NULL; -} - - -/* - * Removes the nth Fred_t from this ContainerX_t and returns a pointer to it. - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_removeFred(ContainerX_t* cx, unsigned int n) -{ - return (cx != NULL) ? cx->removeFred(n) : NULL; -} - - -/* - * Removes the Fred_t from this ContainerX_t based on its identifier and - * returns a pointer to it. - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_removeFredById(ContainerX_t* cx, const char* sid) -{ - return (cx != NULL && sid != NULL) ? cx->removeFred(sid) : NULL; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ContainerX.cpp + * @brief Implementation of the ContainerX class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ContainerX using the given SBML Level, Version and + * “x” package version. + */ +ContainerX::ContainerX(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mFreds (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new XPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new ContainerX using the given XPkgNamespaces object. + */ +ContainerX::ContainerX(XPkgNamespaces *xns) + : SBase(xns) + , mFreds (xns) +{ + setElementNamespace(xns->getURI()); + connectToChild(); + loadPlugins(xns); +} + + +/* + * Copy constructor for ContainerX. + */ +ContainerX::ContainerX(const ContainerX& orig) + : SBase( orig ) + , mFreds ( orig.mFreds ) +{ + connectToChild(); +} + + +/* + * Assignment operator for ContainerX. + */ +ContainerX& +ContainerX::operator=(const ContainerX& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mFreds = rhs.mFreds; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ContainerX object. + */ +ContainerX* +ContainerX::clone() const +{ + return new ContainerX(*this); +} + + +/* + * Destructor for ContainerX. + */ +ContainerX::~ContainerX() +{ +} + + +/* + * Returns the ListOfFreds from this ContainerX. + */ +const ListOfFreds* +ContainerX::getListOfFreds() const +{ + return &mFreds; +} + + +/* + * Returns the ListOfFreds from this ContainerX. + */ +ListOfFreds* +ContainerX::getListOfFreds() +{ + return &mFreds; +} + + +/* + * Get a Fred from the ContainerX. + */ +Fred* +ContainerX::getFred(unsigned int n) +{ + return mFreds.get(n); +} + + +/* + * Get a Fred from the ContainerX. + */ +const Fred* +ContainerX::getFred(unsigned int n) const +{ + return mFreds.get(n); +} + + +/* + * Get a Fred from the ContainerX based on its identifier. + */ +Fred* +ContainerX::getFred(const std::string& sid) +{ + return mFreds.get(sid); +} + + +/* + * Get a Fred from the ContainerX based on its identifier. + */ +const Fred* +ContainerX::getFred(const std::string& sid) const +{ + return mFreds.get(sid); +} + + +/* + * Adds a copy of the given Fred to this ContainerX. + */ +int +ContainerX::addFred(const Fred* f) +{ + if (f == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (f->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != f->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != f->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(f)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (f->isSetId() && (mFreds.get(f->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mFreds.append(f); + } +} + + +/* + * Get the number of Fred objects in this ContainerX. + */ +unsigned int +ContainerX::getNumFreds() const +{ + return mFreds.size(); +} + + +/* + * Creates a new Fred object, adds it to this ContainerX object and returns the + * Fred object created. + */ +Fred* +ContainerX::createFred() +{ + Fred* f = NULL; + + try + { + X_CREATE_NS(xns, getSBMLNamespaces()); + f = new Fred(xns); + delete xns; + } + catch (...) + { + } + + if (f != NULL) + { + mFreds.appendAndOwn(f); + } + + return f; +} + + +/* + * Removes the nth Fred from this ContainerX and returns a pointer to it. + */ +Fred* +ContainerX::removeFred(unsigned int n) +{ + return mFreds.remove(n); +} + + +/* + * Removes the Fred from this ContainerX based on its identifier and returns a + * pointer to it. + */ +Fred* +ContainerX::removeFred(const std::string& sid) +{ + return mFreds.remove(sid); +} + + +/* + * Returns the XML element name of this ContainerX object. + */ +const std::string& +ContainerX::getElementName() const +{ + static const string name = "containerX"; + return name; +} + + +/* + * Returns the libSBML type code for this ContainerX object. + */ +int +ContainerX::getTypeCode() const +{ + return SBML_X_CONTAINERX; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ContainerX::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (getNumFreds() > 0) + { + mFreds.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ContainerX::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mFreds.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ContainerX::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + mFreds.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +ContainerX::connectToChild() +{ + SBase::connectToChild(); + + mFreds.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ContainerX::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mFreds.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +ContainerX::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + mFreds.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ContainerX's attribute "attributeName" + * is set. + */ +bool +ContainerX::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this ContainerX. + */ +int +ContainerX::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this ContainerX. + */ +SBase* +ContainerX::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "fred") + { + return createFred(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this ContainerX. + */ +int +ContainerX::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "fred" && element->getTypeCode() == SBML_X_FRED) + { + return addFred((const Fred*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * ContainerX. + */ +SBase* +ContainerX::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "fred") + { + return removeFred(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this ContainerX. + */ +unsigned int +ContainerX::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "fred") + { + return getNumFreds(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this ContainerX. + */ +SBase* +ContainerX::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "fred") + { + return getFred(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +ContainerX::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + obj = mFreds.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +ContainerX::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mFreds.getMetaId() == metaid) + { + return &mFreds; + } + + obj = mFreds.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +ContainerX::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mFreds, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +ContainerX::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "listOfFreds") + { + if (getErrorLog() && mFreds.size() != 0) + { + getErrorLog()->logPackageError("x", XContainerXAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mFreds; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ContainerX_t using the given SBML Level, Version and + * “x” package version. + */ +LIBSBML_EXTERN +ContainerX_t * +ContainerX_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ContainerX(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ContainerX_t object. + */ +LIBSBML_EXTERN +ContainerX_t* +ContainerX_clone(const ContainerX_t* cx) +{ + if (cx != NULL) + { + return static_cast(cx->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ContainerX_t object. + */ +LIBSBML_EXTERN +void +ContainerX_free(ContainerX_t* cx) +{ + if (cx != NULL) + { + delete cx; + } +} + + +/* + * Returns a ListOf_t * containing Fred_t objects from this ContainerX_t. + */ +LIBSBML_EXTERN +ListOf_t* +ContainerX_getListOfFreds(ContainerX_t* cx) +{ + return (cx != NULL) ? cx->getListOfFreds() : NULL; +} + + +/* + * Get a Fred_t from the ContainerX_t. + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_getFred(ContainerX_t* cx, unsigned int n) +{ + return (cx != NULL) ? cx->getFred(n) : NULL; +} + + +/* + * Get a Fred_t from the ContainerX_t based on its identifier. + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_getFredById(ContainerX_t* cx, const char *sid) +{ + return (cx != NULL && sid != NULL) ? cx->getFred(sid) : NULL; +} + + +/* + * Adds a copy of the given Fred_t to this ContainerX_t. + */ +LIBSBML_EXTERN +int +ContainerX_addFred(ContainerX_t* cx, const Fred_t* f) +{ + return (cx != NULL) ? cx->addFred(f) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of Fred_t objects in this ContainerX_t. + */ +LIBSBML_EXTERN +unsigned int +ContainerX_getNumFreds(ContainerX_t* cx) +{ + return (cx != NULL) ? cx->getNumFreds() : SBML_INT_MAX; +} + + +/* + * Creates a new Fred_t object, adds it to this ContainerX_t object and returns + * the Fred_t object created. + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_createFred(ContainerX_t* cx) +{ + return (cx != NULL) ? cx->createFred() : NULL; +} + + +/* + * Removes the nth Fred_t from this ContainerX_t and returns a pointer to it. + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_removeFred(ContainerX_t* cx, unsigned int n) +{ + return (cx != NULL) ? cx->removeFred(n) : NULL; +} + + +/* + * Removes the Fred_t from this ContainerX_t based on its identifier and + * returns a pointer to it. + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_removeFredById(ContainerX_t* cx, const char* sid) +{ + return (cx != NULL && sid != NULL) ? cx->removeFred(sid) : NULL; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ContainerX.h b/generator/tests/test_cpp_code/test-code/ContainerX.h index 75acb5cf..f6f8f443 100644 --- a/generator/tests/test_cpp_code/test-code/ContainerX.h +++ b/generator/tests/test_cpp_code/test-code/ContainerX.h @@ -1,1081 +1,1081 @@ -/** - * @file ContainerX.h - * @brief Definition of the ContainerX class. - * @author SBMLTeam - * - * - * - * @class ContainerX - * @sbmlbrief{x} TODO:Definition of the ContainerX class. - */ - - -#ifndef ContainerX_H__ -#define ContainerX_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ContainerX : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - ListOfFreds mFreds; - - /** @endcond */ - -public: - - /** - * Creates a new ContainerX using the given SBML Level, Version and - * “x” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ContainerX. - * - * @param version an unsigned int, the SBML Version to assign to this - * ContainerX. - * - * @param pkgVersion an unsigned int, the SBML X Version to assign to this - * ContainerX. - * - * @copydetails doc_note_setting_lv_pkg - */ - ContainerX(unsigned int level = XExtension::getDefaultLevel(), - unsigned int version = XExtension::getDefaultVersion(), - unsigned int pkgVersion = XExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ContainerX using the given XPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param xns the XPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ContainerX(XPkgNamespaces *xns); - - - /** - * Copy constructor for ContainerX. - * - * @param orig the ContainerX instance to copy. - */ - ContainerX(const ContainerX& orig); - - - /** - * Assignment operator for ContainerX. - * - * @param rhs the ContainerX object whose values are to be used as the basis - * of the assignment. - */ - ContainerX& operator=(const ContainerX& rhs); - - - /** - * Creates and returns a deep copy of this ContainerX object. - * - * @return a (deep) copy of this ContainerX object. - */ - virtual ContainerX* clone() const; - - - /** - * Destructor for ContainerX. - */ - virtual ~ContainerX(); - - - /** - * Returns the ListOfFreds from this ContainerX. - * - * @return the ListOfFreds from this ContainerX. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(const std::string& sid) - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - const ListOfFreds* getListOfFreds() const; - - - /** - * Returns the ListOfFreds from this ContainerX. - * - * @return the ListOfFreds from this ContainerX. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(const std::string& sid) - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - ListOfFreds* getListOfFreds(); - - - /** - * Get a Fred from the ContainerX. - * - * @param n an unsigned int representing the index of the Fred to retrieve. - * - * @return the nth Fred in the ListOfFreds within this ContainerX or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(const std::string& sid) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - Fred* getFred(unsigned int n); - - - /** - * Get a Fred from the ContainerX. - * - * @param n an unsigned int representing the index of the Fred to retrieve. - * - * @return the nth Fred in the ListOfFreds within this ContainerX or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(const std::string& sid) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - const Fred* getFred(unsigned int n) const; - - - /** - * Get a Fred from the ContainerX based on its identifier. - * - * @param sid a string representing the identifier of the Fred to retrieve. - * - * @return the Fred in the ListOfFreds within this ContainerX with the given - * @p sid or @c NULL if no such Fred exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - Fred* getFred(const std::string& sid); - - - /** - * Get a Fred from the ContainerX based on its identifier. - * - * @param sid a string representing the identifier of the Fred to retrieve. - * - * @return the Fred in the ListOfFreds within this ContainerX with the given - * @p sid or @c NULL if no such Fred exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - const Fred* getFred(const std::string& sid) const; - - - /** - * Adds a copy of the given Fred to this ContainerX. - * - * @param f the Fred object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createFred() - * @see getFred(const std::string& sid) - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - int addFred(const Fred* f); - - - /** - * Get the number of Fred objects in this ContainerX. - * - * @return the number of Fred objects in this ContainerX. - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(const std::string& sid) - * @see getFred(unsigned int n) - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - unsigned int getNumFreds() const; - - - /** - * Creates a new Fred object, adds it to this ContainerX object and returns - * the Fred object created. - * - * @return a new Fred object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addFred(const Fred* object) - * @see getFred(const std::string& sid) - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - * @see removeFred(unsigned int n) - */ - Fred* createFred(); - - - /** - * Removes the nth Fred from this ContainerX and returns a pointer to it. - * - * @param n an unsigned int representing the index of the Fred to remove. - * - * @return a pointer to the nth Fred in this ContainerX. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(const std::string& sid) - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(const std::string& sid) - */ - Fred* removeFred(unsigned int n); - - - /** - * Removes the Fred from this ContainerX based on its identifier and returns - * a pointer to it. - * - * @param sid a string representing the identifier of the Fred to remove. - * - * @return the Fred in this ContainerX based on the identifier or NULL if no - * such Fred exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addFred(const Fred* object) - * @see createFred() - * @see getFred(const std::string& sid) - * @see getFred(unsigned int n) - * @see getNumFreds() - * @see removeFred(unsigned int n) - */ - Fred* removeFred(const std::string& sid); - - - /** - * Returns the XML element name of this ContainerX object. - * - * For ContainerX, the XML element name is always @c "containerX". - * - * @return the name of this element, i.e. @c "containerX". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ContainerX object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_X_CONTAINERX, SBMLXTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ContainerX's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ContainerX's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this ContainerX. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this ContainerX. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this ContainerX. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * ContainerX. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this ContainerX. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this ContainerX. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ContainerX_t using the given SBML Level, Version and - * “x” package version. - * - * @param level an unsigned int, the SBML Level to assign to this ContainerX_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ContainerX_t. - * - * @param pkgVersion an unsigned int, the SBML X Version to assign to this - * ContainerX_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -ContainerX_t * -ContainerX_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ContainerX_t object. - * - * @param cx the ContainerX_t structure. - * - * @return a (deep) copy of this ContainerX_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -ContainerX_t* -ContainerX_clone(const ContainerX_t* cx); - - -/** - * Frees this ContainerX_t object. - * - * @param cx the ContainerX_t structure. - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -void -ContainerX_free(ContainerX_t* cx); - - -/** - * Returns a ListOf_t * containing Fred_t objects from this ContainerX_t. - * - * @param cx the ContainerX_t structure whose ListOfFreds is sought. - * - * @return the ListOfFreds from this ContainerX_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see ContainerX_addFred() - * @see ContainerX_createFred() - * @see ContainerX_getFredById() - * @see ContainerX_getFred() - * @see ContainerX_getNumFreds() - * @see ContainerX_removeFredById() - * @see ContainerX_removeFred() - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -ListOf_t* -ContainerX_getListOfFreds(ContainerX_t* cx); - - -/** - * Get a Fred_t from the ContainerX_t. - * - * @param cx the ContainerX_t structure to search. - * - * @param n an unsigned int representing the index of the Fred_t to retrieve. - * - * @return the nth Fred_t in the ListOfFreds within this ContainerX or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_getFred(ContainerX_t* cx, unsigned int n); - - -/** - * Get a Fred_t from the ContainerX_t based on its identifier. - * - * @param cx the ContainerX_t structure to search. - * - * @param sid a string representing the identifier of the Fred_t to retrieve. - * - * @return the Fred_t in the ListOfFreds within this ContainerX with the given - * @p sid or @c NULL if no such Fred_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_getFredById(ContainerX_t* cx, const char *sid); - - -/** - * Adds a copy of the given Fred_t to this ContainerX_t. - * - * @param cx the ContainerX_t structure to which the Fred_t should be added. - * - * @param f the Fred_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -int -ContainerX_addFred(ContainerX_t* cx, const Fred_t* f); - - -/** - * Get the number of Fred_t objects in this ContainerX_t. - * - * @param cx the ContainerX_t structure to query. - * - * @return the number of Fred_t objects in this ContainerX_t. - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -unsigned int -ContainerX_getNumFreds(ContainerX_t* cx); - - -/** - * Creates a new Fred_t object, adds it to this ContainerX_t object and returns - * the Fred_t object created. - * - * @param cx the ContainerX_t structure to which the Fred_t should be added. - * - * @return a new Fred_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_createFred(ContainerX_t* cx); - - -/** - * Removes the nth Fred_t from this ContainerX_t and returns a pointer to it. - * - * @param cx the ContainerX_t structure to search. - * - * @param n an unsigned int representing the index of the Fred_t to remove. - * - * @return a pointer to the nth Fred_t in this ContainerX_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_removeFred(ContainerX_t* cx, unsigned int n); - - -/** - * Removes the Fred_t from this ContainerX_t based on its identifier and - * returns a pointer to it. - * - * @param cx the ContainerX_t structure to search. - * - * @param sid a string representing the identifier of the Fred_t to remove. - * - * @return the Fred_t in this ContainerX_t based on the identifier or NULL if - * no such Fred_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof ContainerX_t - */ -LIBSBML_EXTERN -Fred_t* -ContainerX_removeFredById(ContainerX_t* cx, const char* sid); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ContainerX_H__ */ - - +/** + * @file ContainerX.h + * @brief Definition of the ContainerX class. + * @author SBMLTeam + * + * + * + * @class ContainerX + * @sbmlbrief{x} TODO:Definition of the ContainerX class. + */ + + +#ifndef ContainerX_H__ +#define ContainerX_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ContainerX : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + ListOfFreds mFreds; + + /** @endcond */ + +public: + + /** + * Creates a new ContainerX using the given SBML Level, Version and + * “x” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ContainerX. + * + * @param version an unsigned int, the SBML Version to assign to this + * ContainerX. + * + * @param pkgVersion an unsigned int, the SBML X Version to assign to this + * ContainerX. + * + * @copydetails doc_note_setting_lv_pkg + */ + ContainerX(unsigned int level = XExtension::getDefaultLevel(), + unsigned int version = XExtension::getDefaultVersion(), + unsigned int pkgVersion = XExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ContainerX using the given XPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param xns the XPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ContainerX(XPkgNamespaces *xns); + + + /** + * Copy constructor for ContainerX. + * + * @param orig the ContainerX instance to copy. + */ + ContainerX(const ContainerX& orig); + + + /** + * Assignment operator for ContainerX. + * + * @param rhs the ContainerX object whose values are to be used as the basis + * of the assignment. + */ + ContainerX& operator=(const ContainerX& rhs); + + + /** + * Creates and returns a deep copy of this ContainerX object. + * + * @return a (deep) copy of this ContainerX object. + */ + virtual ContainerX* clone() const; + + + /** + * Destructor for ContainerX. + */ + virtual ~ContainerX(); + + + /** + * Returns the ListOfFreds from this ContainerX. + * + * @return the ListOfFreds from this ContainerX. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(const std::string& sid) + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + const ListOfFreds* getListOfFreds() const; + + + /** + * Returns the ListOfFreds from this ContainerX. + * + * @return the ListOfFreds from this ContainerX. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(const std::string& sid) + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + ListOfFreds* getListOfFreds(); + + + /** + * Get a Fred from the ContainerX. + * + * @param n an unsigned int representing the index of the Fred to retrieve. + * + * @return the nth Fred in the ListOfFreds within this ContainerX or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(const std::string& sid) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + Fred* getFred(unsigned int n); + + + /** + * Get a Fred from the ContainerX. + * + * @param n an unsigned int representing the index of the Fred to retrieve. + * + * @return the nth Fred in the ListOfFreds within this ContainerX or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(const std::string& sid) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + const Fred* getFred(unsigned int n) const; + + + /** + * Get a Fred from the ContainerX based on its identifier. + * + * @param sid a string representing the identifier of the Fred to retrieve. + * + * @return the Fred in the ListOfFreds within this ContainerX with the given + * @p sid or @c NULL if no such Fred exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + Fred* getFred(const std::string& sid); + + + /** + * Get a Fred from the ContainerX based on its identifier. + * + * @param sid a string representing the identifier of the Fred to retrieve. + * + * @return the Fred in the ListOfFreds within this ContainerX with the given + * @p sid or @c NULL if no such Fred exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + const Fred* getFred(const std::string& sid) const; + + + /** + * Adds a copy of the given Fred to this ContainerX. + * + * @param f the Fred object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createFred() + * @see getFred(const std::string& sid) + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + int addFred(const Fred* f); + + + /** + * Get the number of Fred objects in this ContainerX. + * + * @return the number of Fred objects in this ContainerX. + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(const std::string& sid) + * @see getFred(unsigned int n) + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + unsigned int getNumFreds() const; + + + /** + * Creates a new Fred object, adds it to this ContainerX object and returns + * the Fred object created. + * + * @return a new Fred object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addFred(const Fred* object) + * @see getFred(const std::string& sid) + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + * @see removeFred(unsigned int n) + */ + Fred* createFred(); + + + /** + * Removes the nth Fred from this ContainerX and returns a pointer to it. + * + * @param n an unsigned int representing the index of the Fred to remove. + * + * @return a pointer to the nth Fred in this ContainerX. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(const std::string& sid) + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(const std::string& sid) + */ + Fred* removeFred(unsigned int n); + + + /** + * Removes the Fred from this ContainerX based on its identifier and returns + * a pointer to it. + * + * @param sid a string representing the identifier of the Fred to remove. + * + * @return the Fred in this ContainerX based on the identifier or NULL if no + * such Fred exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addFred(const Fred* object) + * @see createFred() + * @see getFred(const std::string& sid) + * @see getFred(unsigned int n) + * @see getNumFreds() + * @see removeFred(unsigned int n) + */ + Fred* removeFred(const std::string& sid); + + + /** + * Returns the XML element name of this ContainerX object. + * + * For ContainerX, the XML element name is always @c "containerX". + * + * @return the name of this element, i.e. @c "containerX". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ContainerX object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_X_CONTAINERX, SBMLXTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ContainerX's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ContainerX's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this ContainerX. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this ContainerX. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this ContainerX. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * ContainerX. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this ContainerX. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this ContainerX. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ContainerX_t using the given SBML Level, Version and + * “x” package version. + * + * @param level an unsigned int, the SBML Level to assign to this ContainerX_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ContainerX_t. + * + * @param pkgVersion an unsigned int, the SBML X Version to assign to this + * ContainerX_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +ContainerX_t * +ContainerX_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ContainerX_t object. + * + * @param cx the ContainerX_t structure. + * + * @return a (deep) copy of this ContainerX_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +ContainerX_t* +ContainerX_clone(const ContainerX_t* cx); + + +/** + * Frees this ContainerX_t object. + * + * @param cx the ContainerX_t structure. + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +void +ContainerX_free(ContainerX_t* cx); + + +/** + * Returns a ListOf_t * containing Fred_t objects from this ContainerX_t. + * + * @param cx the ContainerX_t structure whose ListOfFreds is sought. + * + * @return the ListOfFreds from this ContainerX_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see ContainerX_addFred() + * @see ContainerX_createFred() + * @see ContainerX_getFredById() + * @see ContainerX_getFred() + * @see ContainerX_getNumFreds() + * @see ContainerX_removeFredById() + * @see ContainerX_removeFred() + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +ListOf_t* +ContainerX_getListOfFreds(ContainerX_t* cx); + + +/** + * Get a Fred_t from the ContainerX_t. + * + * @param cx the ContainerX_t structure to search. + * + * @param n an unsigned int representing the index of the Fred_t to retrieve. + * + * @return the nth Fred_t in the ListOfFreds within this ContainerX or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_getFred(ContainerX_t* cx, unsigned int n); + + +/** + * Get a Fred_t from the ContainerX_t based on its identifier. + * + * @param cx the ContainerX_t structure to search. + * + * @param sid a string representing the identifier of the Fred_t to retrieve. + * + * @return the Fred_t in the ListOfFreds within this ContainerX with the given + * @p sid or @c NULL if no such Fred_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_getFredById(ContainerX_t* cx, const char *sid); + + +/** + * Adds a copy of the given Fred_t to this ContainerX_t. + * + * @param cx the ContainerX_t structure to which the Fred_t should be added. + * + * @param f the Fred_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +int +ContainerX_addFred(ContainerX_t* cx, const Fred_t* f); + + +/** + * Get the number of Fred_t objects in this ContainerX_t. + * + * @param cx the ContainerX_t structure to query. + * + * @return the number of Fred_t objects in this ContainerX_t. + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +unsigned int +ContainerX_getNumFreds(ContainerX_t* cx); + + +/** + * Creates a new Fred_t object, adds it to this ContainerX_t object and returns + * the Fred_t object created. + * + * @param cx the ContainerX_t structure to which the Fred_t should be added. + * + * @return a new Fred_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_createFred(ContainerX_t* cx); + + +/** + * Removes the nth Fred_t from this ContainerX_t and returns a pointer to it. + * + * @param cx the ContainerX_t structure to search. + * + * @param n an unsigned int representing the index of the Fred_t to remove. + * + * @return a pointer to the nth Fred_t in this ContainerX_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_removeFred(ContainerX_t* cx, unsigned int n); + + +/** + * Removes the Fred_t from this ContainerX_t based on its identifier and + * returns a pointer to it. + * + * @param cx the ContainerX_t structure to search. + * + * @param sid a string representing the identifier of the Fred_t to remove. + * + * @return the Fred_t in this ContainerX_t based on the identifier or NULL if + * no such Fred_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof ContainerX_t + */ +LIBSBML_EXTERN +Fred_t* +ContainerX_removeFredById(ContainerX_t* cx, const char* sid); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ContainerX_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/CoordinateComponent.cpp b/generator/tests/test_cpp_code/test-code/CoordinateComponent.cpp index 5bb5cd29..e925d995 100644 --- a/generator/tests/test_cpp_code/test-code/CoordinateComponent.cpp +++ b/generator/tests/test_cpp_code/test-code/CoordinateComponent.cpp @@ -1,2003 +1,2003 @@ -/** - * @file CoordinateComponent.cpp - * @brief Implementation of the CoordinateComponent class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new CoordinateComponent using the given SBML Level, Version and - * “spatial” package version. - */ -CoordinateComponent::CoordinateComponent(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mType (SPATIAL_COORDINATEKIND_INVALID) - , mUnit ("") - , mBoundaryMin (NULL) - , mBoundaryMax (NULL) -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new CoordinateComponent using the given SpatialPkgNamespaces - * object. - */ -CoordinateComponent::CoordinateComponent(SpatialPkgNamespaces *spatialns) - : SBase(spatialns) - , mType (SPATIAL_COORDINATEKIND_INVALID) - , mUnit ("") - , mBoundaryMin (NULL) - , mBoundaryMax (NULL) -{ - setElementNamespace(spatialns->getURI()); - connectToChild(); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for CoordinateComponent. - */ -CoordinateComponent::CoordinateComponent(const CoordinateComponent& orig) - : SBase( orig ) - , mType ( orig.mType ) - , mUnit ( orig.mUnit ) - , mBoundaryMin ( NULL ) - , mBoundaryMax ( NULL ) -{ - if (orig.mBoundaryMin != NULL) - { - mBoundaryMin = orig.mBoundaryMin->clone(); - } - - if (orig.mBoundaryMax != NULL) - { - mBoundaryMax = orig.mBoundaryMax->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for CoordinateComponent. - */ -CoordinateComponent& -CoordinateComponent::operator=(const CoordinateComponent& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mType = rhs.mType; - mUnit = rhs.mUnit; - delete mBoundaryMin; - if (rhs.mBoundaryMin != NULL) - { - mBoundaryMin = rhs.mBoundaryMin->clone(); - } - else - { - mBoundaryMin = NULL; - } - - delete mBoundaryMax; - if (rhs.mBoundaryMax != NULL) - { - mBoundaryMax = rhs.mBoundaryMax->clone(); - } - else - { - mBoundaryMax = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this CoordinateComponent object. - */ -CoordinateComponent* -CoordinateComponent::clone() const -{ - return new CoordinateComponent(*this); -} - - -/* - * Destructor for CoordinateComponent. - */ -CoordinateComponent::~CoordinateComponent() -{ - delete mBoundaryMin; - mBoundaryMin = NULL; - delete mBoundaryMax; - mBoundaryMax = NULL; -} - - -/* - * Returns the value of the "id" attribute of this CoordinateComponent. - */ -const std::string& -CoordinateComponent::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "type" attribute of this CoordinateComponent. - */ -CoordinateKind_t -CoordinateComponent::getType() const -{ - return mType; -} - - -/* - * Returns the value of the "type" attribute of this CoordinateComponent. - */ -std::string -CoordinateComponent::getTypeAsString() const -{ - std::string code_str = CoordinateKind_toString(mType); - return code_str; -} - - -/* - * Returns the value of the "unit" attribute of this CoordinateComponent. - */ -const std::string& -CoordinateComponent::getUnit() const -{ - return mUnit; -} - - -/* - * Predicate returning @c true if this CoordinateComponent's "id" attribute is - * set. - */ -bool -CoordinateComponent::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this CoordinateComponent's "type" attribute - * is set. - */ -bool -CoordinateComponent::isSetType() const -{ - return (mType != SPATIAL_COORDINATEKIND_INVALID); -} - - -/* - * Predicate returning @c true if this CoordinateComponent's "unit" attribute - * is set. - */ -bool -CoordinateComponent::isSetUnit() const -{ - return (mUnit.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "type" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setType(const CoordinateKind_t type) -{ - if (CoordinateKind_isValid(type) == 0) - { - mType = SPATIAL_COORDINATEKIND_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mType = type; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "type" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setType(const std::string& type) -{ - mType = CoordinateKind_fromString(type.c_str()); - - if (mType == SPATIAL_COORDINATEKIND_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "unit" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setUnit(const std::string& unit) -{ - if (!(SyntaxChecker::isValidInternalUnitSId(unit))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mUnit = unit; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "id" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "type" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::unsetType() -{ - mType = SPATIAL_COORDINATEKIND_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "unit" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::unsetUnit() -{ - mUnit.erase(); - - if (mUnit.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "boundaryMin" element of this CoordinateComponent. - */ -const Boundary* -CoordinateComponent::getBoundaryMin() const -{ - return mBoundaryMin; -} - - -/* - * Returns the value of the "boundaryMin" element of this CoordinateComponent. - */ -Boundary* -CoordinateComponent::getBoundaryMin() -{ - return mBoundaryMin; -} - - -/* - * Returns the value of the "boundaryMax" element of this CoordinateComponent. - */ -const Boundary* -CoordinateComponent::getBoundaryMax() const -{ - return mBoundaryMax; -} - - -/* - * Returns the value of the "boundaryMax" element of this CoordinateComponent. - */ -Boundary* -CoordinateComponent::getBoundaryMax() -{ - return mBoundaryMax; -} - - -/* - * Predicate returning @c true if this CoordinateComponent's "boundaryMin" - * element is set. - */ -bool -CoordinateComponent::isSetBoundaryMin() const -{ - return (mBoundaryMin != NULL); -} - - -/* - * Predicate returning @c true if this CoordinateComponent's "boundaryMax" - * element is set. - */ -bool -CoordinateComponent::isSetBoundaryMax() const -{ - return (mBoundaryMax != NULL); -} - - -/* - * Sets the value of the "boundaryMin" element of this CoordinateComponent. - */ -int -CoordinateComponent::setBoundaryMin(const Boundary* boundaryMin) -{ - if (mBoundaryMin == boundaryMin) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (boundaryMin == NULL) - { - delete mBoundaryMin; - mBoundaryMin = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mBoundaryMin; - mBoundaryMin = (boundaryMin != NULL) ? boundaryMin->clone() : NULL; - if (mBoundaryMin != NULL) - { - mBoundaryMin->setElementName("boundaryMin"); - mBoundaryMin->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "boundaryMax" element of this CoordinateComponent. - */ -int -CoordinateComponent::setBoundaryMax(const Boundary* boundaryMax) -{ - if (mBoundaryMax == boundaryMax) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (boundaryMax == NULL) - { - delete mBoundaryMax; - mBoundaryMax = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mBoundaryMax; - mBoundaryMax = (boundaryMax != NULL) ? boundaryMax->clone() : NULL; - if (mBoundaryMax != NULL) - { - mBoundaryMax->setElementName("boundaryMax"); - mBoundaryMax->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new Boundary object, adds it to this CoordinateComponent object - * and returns the Boundary object created. - */ -Boundary* -CoordinateComponent::createBoundaryMin() -{ - if (mBoundaryMin != NULL) - { - delete mBoundaryMin; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mBoundaryMin = new Boundary(spatialns); - - mBoundaryMin->setElementName("boundaryMin"); - - delete spatialns; - - connectToChild(); - - return mBoundaryMin; -} - - -/* - * Creates a new Boundary object, adds it to this CoordinateComponent object - * and returns the Boundary object created. - */ -Boundary* -CoordinateComponent::createBoundaryMax() -{ - if (mBoundaryMax != NULL) - { - delete mBoundaryMax; - } - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mBoundaryMax = new Boundary(spatialns); - - mBoundaryMax->setElementName("boundaryMax"); - - delete spatialns; - - connectToChild(); - - return mBoundaryMax; -} - - -/* - * Unsets the value of the "boundaryMin" element of this CoordinateComponent. - */ -int -CoordinateComponent::unsetBoundaryMin() -{ - delete mBoundaryMin; - mBoundaryMin = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "boundaryMax" element of this CoordinateComponent. - */ -int -CoordinateComponent::unsetBoundaryMax() -{ - delete mBoundaryMax; - mBoundaryMax = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -CoordinateComponent::renameSIdRefs(const std::string& oldid, - const std::string& newid) -{ - if (isSetUnit() && mUnit == oldid) - { - setUnit(newid); - } -} - - -/* - * Returns the XML element name of this CoordinateComponent object. - */ -const std::string& -CoordinateComponent::getElementName() const -{ - static const string name = "coordinateComponent"; - return name; -} - - -/* - * Returns the libSBML type code for this CoordinateComponent object. - */ -int -CoordinateComponent::getTypeCode() const -{ - return SBML_SPATIAL_COORDINATECOMPONENT; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * CoordinateComponent object have been set. - */ -bool -CoordinateComponent::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - if (isSetType() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * CoordinateComponent object have been set. - */ -bool -CoordinateComponent::hasRequiredElements() const -{ - bool allPresent = true; - - if (isSetBoundaryMin() == false) - { - allPresent = false; - } - - if (isSetBoundaryMax() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -CoordinateComponent::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetBoundaryMin() == true) - { - mBoundaryMin->write(stream); - } - - if (isSetBoundaryMax() == true) - { - mBoundaryMax->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -CoordinateComponent::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mBoundaryMin != NULL) - { - mBoundaryMin->accept(v); - } - - if (mBoundaryMax != NULL) - { - mBoundaryMax->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -CoordinateComponent::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mBoundaryMin != NULL) - { - mBoundaryMin->setSBMLDocument(d); - } - - if (mBoundaryMax != NULL) - { - mBoundaryMax->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -CoordinateComponent::connectToChild() -{ - SBase::connectToChild(); - - if (mBoundaryMin != NULL) - { - mBoundaryMin->connectToParent(this); - } - - if (mBoundaryMax != NULL) - { - mBoundaryMax->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -CoordinateComponent::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetBoundaryMin()) - { - mBoundaryMin->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - if (isSetBoundaryMax()) - { - mBoundaryMax->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -CoordinateComponent::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mBoundaryMin != NULL) - { - mBoundaryMin->updateSBMLNamespace(package, level, version); - } - - if (mBoundaryMax != NULL) - { - mBoundaryMax->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "type") - { - value = getTypeAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "unit") - { - value = getUnit(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this CoordinateComponent's attribute - * "attributeName" is set. - */ -bool -CoordinateComponent::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "type") - { - value = isSetType(); - } - else if (attributeName == "unit") - { - value = isSetUnit(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this CoordinateComponent. - */ -int -CoordinateComponent::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "type") - { - return_value = setType(value); - } - else if (attributeName == "unit") - { - return_value = setUnit(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * CoordinateComponent. - */ -int -CoordinateComponent::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "type") - { - value = unsetType(); - } - else if (attributeName == "unit") - { - value = unsetUnit(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this CoordinateComponent. - */ -SBase* -CoordinateComponent::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "boundaryMin") - { - return createBoundaryMin(); - } - else if (elementName == "boundaryMax") - { - return createBoundaryMax(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this CoordinateComponent. - */ -int -CoordinateComponent::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "boundaryMin" && element->getTypeCode() == - SBML_SPATIAL_BOUNDARY) - { - return setBoundaryMin((const Boundary*)(element)); - } - else if (elementName == "boundaryMax" && element->getTypeCode() == - SBML_SPATIAL_BOUNDARY) - { - return setBoundaryMax((const Boundary*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * CoordinateComponent. - */ -SBase* -CoordinateComponent::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "boundaryMin") - { - Boundary * obj = mBoundaryMin; - mBoundaryMin = NULL; return obj; - } - else if (elementName == "boundaryMax") - { - Boundary * obj = mBoundaryMax; - mBoundaryMax = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this CoordinateComponent. - */ -unsigned int -CoordinateComponent::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "boundaryMin") - { - if (isSetBoundaryMin()) - { - return 1; - } - } - else if (elementName == "boundaryMax") - { - if (isSetBoundaryMax()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this CoordinateComponent. - */ -SBase* -CoordinateComponent::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "boundaryMin") - { - return getBoundaryMin(); - } - else if (elementName == "boundaryMax") - { - return getBoundaryMax(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -CoordinateComponent::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mBoundaryMin != NULL) - { - if (mBoundaryMin->getId() == id) - { - return mBoundaryMin; - } - - obj = mBoundaryMin->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mBoundaryMax != NULL) - { - if (mBoundaryMax->getId() == id) - { - return mBoundaryMax; - } - - obj = mBoundaryMax->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -CoordinateComponent::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mBoundaryMin != NULL) - { - if (mBoundaryMin->getMetaId() == metaid) - { - return mBoundaryMin; - } - - obj = mBoundaryMin->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mBoundaryMax != NULL) - { - if (mBoundaryMax->getMetaId() == metaid) - { - return mBoundaryMax; - } - - obj = mBoundaryMax->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -CoordinateComponent::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mBoundaryMin, filter); - ADD_FILTERED_POINTER(ret, sublist, mBoundaryMax, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -CoordinateComponent::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - - if (name == "boundaryMin") - { - if (getErrorLog() && isSetBoundaryMin()) - { - getErrorLog()->logPackageError("spatial", - SpatialCoordinateComponentAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mBoundaryMin; - mBoundaryMin = new Boundary(spatialns); - mBoundaryMin->setElementName(name); - obj = mBoundaryMin; - } - else if (name == "boundaryMax") - { - if (getErrorLog() && isSetBoundaryMax()) - { - getErrorLog()->logPackageError("spatial", - SpatialCoordinateComponentAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mBoundaryMax; - mBoundaryMax = new Boundary(spatialns); - mBoundaryMax->setElementName(name); - obj = mBoundaryMax; - } - - delete spatialns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -CoordinateComponent::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("type"); - - attributes.add("unit"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -CoordinateComponent::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialGeometryLOCoordinateComponentsAllowedAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialGeometryLOCoordinateComponentsAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialCoordinateComponentAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'id' is missing from the " - " element."; - log->logPackageError("spatial", - SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // type enum (use = "required" ) - // - - std::string type; - assigned = attributes.readInto("type", type); - - if (assigned == true) - { - if (type.empty() == true) - { - logEmptyString(type, level, version, ""); - } - else - { - mType = CoordinateKind_fromString(type.c_str()); - - if (log && CoordinateKind_isValid(mType) == 0) - { - std::string msg = "The type on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + type + "', which is not a valid option."; - - log->logPackageError("spatial", - SpatialCoordinateComponentTypeMustBeCoordinateKindEnum, pkgVersion, - level, version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'type' is missing."; - log->logPackageError("spatial", - SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // unit UnitSIdRef (use = "optional" ) - // - - assigned = attributes.readInto("unit", mUnit); - - if (assigned == true) - { - if (mUnit.empty() == true) - { - logEmptyString(mUnit, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mUnit) == false) - { - std::string msg = "The unit attribute on the <" + getElementName() + ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mUnit + "', which does not conform to the syntax."; - log->logPackageError("spatial", - SpatialCoordinateComponentUnitMustBeUnitSId, pkgVersion, level, version, - msg, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -CoordinateComponent::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetType() == true) - { - stream.writeAttribute("type", getPrefix(), CoordinateKind_toString(mType)); - } - - if (isSetUnit() == true) - { - stream.writeAttribute("unit", getPrefix(), mUnit); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new CoordinateComponent_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CoordinateComponent_t * -CoordinateComponent_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CoordinateComponent(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this CoordinateComponent_t object. - */ -LIBSBML_EXTERN -CoordinateComponent_t* -CoordinateComponent_clone(const CoordinateComponent_t* cc) -{ - if (cc != NULL) - { - return static_cast(cc->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this CoordinateComponent_t object. - */ -LIBSBML_EXTERN -void -CoordinateComponent_free(CoordinateComponent_t* cc) -{ - if (cc != NULL) - { - delete cc; - } -} - - -/* - * Returns the value of the "id" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -char * -CoordinateComponent_getId(const CoordinateComponent_t * cc) -{ - if (cc == NULL) - { - return NULL; - } - - return cc->getId().empty() ? NULL : safe_strdup(cc->getId().c_str()); -} - - -/* - * Returns the value of the "type" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -CoordinateKind_t -CoordinateComponent_getType(const CoordinateComponent_t * cc) -{ - if (cc == NULL) - { - return SPATIAL_COORDINATEKIND_INVALID; - } - - return cc->getType(); -} - - -/* - * Returns the value of the "type" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -char * -CoordinateComponent_getTypeAsString(const CoordinateComponent_t * cc) -{ - return (char*)(CoordinateKind_toString(cc->getType())); -} - - -/* - * Returns the value of the "unit" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -char * -CoordinateComponent_getUnit(const CoordinateComponent_t * cc) -{ - if (cc == NULL) - { - return NULL; - } - - return cc->getUnit().empty() ? NULL : safe_strdup(cc->getUnit().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this CoordinateComponent_t's "id" - * attribute is set. - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetId(const CoordinateComponent_t * cc) -{ - return (cc != NULL) ? static_cast(cc->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this CoordinateComponent_t's "type" - * attribute is set. - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetType(const CoordinateComponent_t * cc) -{ - return (cc != NULL) ? static_cast(cc->isSetType()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this CoordinateComponent_t's "unit" - * attribute is set. - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetUnit(const CoordinateComponent_t * cc) -{ - return (cc != NULL) ? static_cast(cc->isSetUnit()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_setId(CoordinateComponent_t * cc, const char * id) -{ - return (cc != NULL) ? cc->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "type" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_setType(CoordinateComponent_t * cc, CoordinateKind_t type) -{ - return (cc != NULL) ? cc->setType(type) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "type" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_setTypeAsString(CoordinateComponent_t * cc, - const char * type) -{ - return (cc != NULL) ? cc->setType(type): LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "unit" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_setUnit(CoordinateComponent_t * cc, const char * unit) -{ - return (cc != NULL) ? cc->setUnit(unit) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetId(CoordinateComponent_t * cc) -{ - return (cc != NULL) ? cc->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "type" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetType(CoordinateComponent_t * cc) -{ - return (cc != NULL) ? cc->unsetType() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "unit" attribute of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetUnit(CoordinateComponent_t * cc) -{ - return (cc != NULL) ? cc->unsetUnit() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "boundaryMin" element of this - * CoordinateComponent_t. - */ -LIBSBML_EXTERN -const Boundary_t* -CoordinateComponent_getBoundaryMin(const CoordinateComponent_t * cc) -{ - if (cc == NULL) - { - return NULL; - } - - return (Boundary_t*)(cc->getBoundaryMin()); -} - - -/* - * Returns the value of the "boundaryMax" element of this - * CoordinateComponent_t. - */ -LIBSBML_EXTERN -const Boundary_t* -CoordinateComponent_getBoundaryMax(const CoordinateComponent_t * cc) -{ - if (cc == NULL) - { - return NULL; - } - - return (Boundary_t*)(cc->getBoundaryMax()); -} - - -/* - * Predicate returning @c 1 (true) if this CoordinateComponent_t's - * "boundaryMin" element is set. - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetBoundaryMin(const CoordinateComponent_t * cc) -{ - return (cc != NULL) ? static_cast(cc->isSetBoundaryMin()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this CoordinateComponent_t's - * "boundaryMax" element is set. - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetBoundaryMax(const CoordinateComponent_t * cc) -{ - return (cc != NULL) ? static_cast(cc->isSetBoundaryMax()) : 0; -} - - -/* - * Sets the value of the "boundaryMin" element of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_setBoundaryMin(CoordinateComponent_t * cc, - const Boundary_t* boundaryMin) -{ - return (cc != NULL) ? cc->setBoundaryMin(boundaryMin) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "boundaryMax" element of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_setBoundaryMax(CoordinateComponent_t * cc, - const Boundary_t* boundaryMax) -{ - return (cc != NULL) ? cc->setBoundaryMax(boundaryMax) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new Boundary_t object, adds it to this CoordinateComponent_t - * object and returns the Boundary_t object created. - */ -LIBSBML_EXTERN -Boundary_t* -CoordinateComponent_createBoundaryMin(CoordinateComponent_t* cc) -{ - if (cc == NULL) - { - return NULL; - } - - return (Boundary_t*)(cc->createBoundaryMin()); -} - - -/* - * Creates a new Boundary_t object, adds it to this CoordinateComponent_t - * object and returns the Boundary_t object created. - */ -LIBSBML_EXTERN -Boundary_t* -CoordinateComponent_createBoundaryMax(CoordinateComponent_t* cc) -{ - if (cc == NULL) - { - return NULL; - } - - return (Boundary_t*)(cc->createBoundaryMax()); -} - - -/* - * Unsets the value of the "boundaryMin" element of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetBoundaryMin(CoordinateComponent_t * cc) -{ - return (cc != NULL) ? cc->unsetBoundaryMin() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "boundaryMax" element of this CoordinateComponent_t. - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetBoundaryMax(CoordinateComponent_t * cc) -{ - return (cc != NULL) ? cc->unsetBoundaryMax() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * CoordinateComponent_t object have been set. - */ -LIBSBML_EXTERN -int -CoordinateComponent_hasRequiredAttributes(const CoordinateComponent_t * cc) -{ - return (cc != NULL) ? static_cast(cc->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * CoordinateComponent_t object have been set. - */ -LIBSBML_EXTERN -int -CoordinateComponent_hasRequiredElements(const CoordinateComponent_t * cc) -{ - return (cc != NULL) ? static_cast(cc->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file CoordinateComponent.cpp + * @brief Implementation of the CoordinateComponent class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CoordinateComponent using the given SBML Level, Version and + * “spatial” package version. + */ +CoordinateComponent::CoordinateComponent(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mType (SPATIAL_COORDINATEKIND_INVALID) + , mUnit ("") + , mBoundaryMin (NULL) + , mBoundaryMax (NULL) +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new CoordinateComponent using the given SpatialPkgNamespaces + * object. + */ +CoordinateComponent::CoordinateComponent(SpatialPkgNamespaces *spatialns) + : SBase(spatialns) + , mType (SPATIAL_COORDINATEKIND_INVALID) + , mUnit ("") + , mBoundaryMin (NULL) + , mBoundaryMax (NULL) +{ + setElementNamespace(spatialns->getURI()); + connectToChild(); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for CoordinateComponent. + */ +CoordinateComponent::CoordinateComponent(const CoordinateComponent& orig) + : SBase( orig ) + , mType ( orig.mType ) + , mUnit ( orig.mUnit ) + , mBoundaryMin ( NULL ) + , mBoundaryMax ( NULL ) +{ + if (orig.mBoundaryMin != NULL) + { + mBoundaryMin = orig.mBoundaryMin->clone(); + } + + if (orig.mBoundaryMax != NULL) + { + mBoundaryMax = orig.mBoundaryMax->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for CoordinateComponent. + */ +CoordinateComponent& +CoordinateComponent::operator=(const CoordinateComponent& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mType = rhs.mType; + mUnit = rhs.mUnit; + delete mBoundaryMin; + if (rhs.mBoundaryMin != NULL) + { + mBoundaryMin = rhs.mBoundaryMin->clone(); + } + else + { + mBoundaryMin = NULL; + } + + delete mBoundaryMax; + if (rhs.mBoundaryMax != NULL) + { + mBoundaryMax = rhs.mBoundaryMax->clone(); + } + else + { + mBoundaryMax = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CoordinateComponent object. + */ +CoordinateComponent* +CoordinateComponent::clone() const +{ + return new CoordinateComponent(*this); +} + + +/* + * Destructor for CoordinateComponent. + */ +CoordinateComponent::~CoordinateComponent() +{ + delete mBoundaryMin; + mBoundaryMin = NULL; + delete mBoundaryMax; + mBoundaryMax = NULL; +} + + +/* + * Returns the value of the "id" attribute of this CoordinateComponent. + */ +const std::string& +CoordinateComponent::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "type" attribute of this CoordinateComponent. + */ +CoordinateKind_t +CoordinateComponent::getType() const +{ + return mType; +} + + +/* + * Returns the value of the "type" attribute of this CoordinateComponent. + */ +std::string +CoordinateComponent::getTypeAsString() const +{ + std::string code_str = CoordinateKind_toString(mType); + return code_str; +} + + +/* + * Returns the value of the "unit" attribute of this CoordinateComponent. + */ +const std::string& +CoordinateComponent::getUnit() const +{ + return mUnit; +} + + +/* + * Predicate returning @c true if this CoordinateComponent's "id" attribute is + * set. + */ +bool +CoordinateComponent::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this CoordinateComponent's "type" attribute + * is set. + */ +bool +CoordinateComponent::isSetType() const +{ + return (mType != SPATIAL_COORDINATEKIND_INVALID); +} + + +/* + * Predicate returning @c true if this CoordinateComponent's "unit" attribute + * is set. + */ +bool +CoordinateComponent::isSetUnit() const +{ + return (mUnit.empty() == false); +} + + +/* + * Sets the value of the "id" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "type" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setType(const CoordinateKind_t type) +{ + if (CoordinateKind_isValid(type) == 0) + { + mType = SPATIAL_COORDINATEKIND_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mType = type; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "type" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setType(const std::string& type) +{ + mType = CoordinateKind_fromString(type.c_str()); + + if (mType == SPATIAL_COORDINATEKIND_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "unit" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setUnit(const std::string& unit) +{ + if (!(SyntaxChecker::isValidInternalUnitSId(unit))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mUnit = unit; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "id" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "type" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::unsetType() +{ + mType = SPATIAL_COORDINATEKIND_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "unit" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::unsetUnit() +{ + mUnit.erase(); + + if (mUnit.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "boundaryMin" element of this CoordinateComponent. + */ +const Boundary* +CoordinateComponent::getBoundaryMin() const +{ + return mBoundaryMin; +} + + +/* + * Returns the value of the "boundaryMin" element of this CoordinateComponent. + */ +Boundary* +CoordinateComponent::getBoundaryMin() +{ + return mBoundaryMin; +} + + +/* + * Returns the value of the "boundaryMax" element of this CoordinateComponent. + */ +const Boundary* +CoordinateComponent::getBoundaryMax() const +{ + return mBoundaryMax; +} + + +/* + * Returns the value of the "boundaryMax" element of this CoordinateComponent. + */ +Boundary* +CoordinateComponent::getBoundaryMax() +{ + return mBoundaryMax; +} + + +/* + * Predicate returning @c true if this CoordinateComponent's "boundaryMin" + * element is set. + */ +bool +CoordinateComponent::isSetBoundaryMin() const +{ + return (mBoundaryMin != NULL); +} + + +/* + * Predicate returning @c true if this CoordinateComponent's "boundaryMax" + * element is set. + */ +bool +CoordinateComponent::isSetBoundaryMax() const +{ + return (mBoundaryMax != NULL); +} + + +/* + * Sets the value of the "boundaryMin" element of this CoordinateComponent. + */ +int +CoordinateComponent::setBoundaryMin(const Boundary* boundaryMin) +{ + if (mBoundaryMin == boundaryMin) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (boundaryMin == NULL) + { + delete mBoundaryMin; + mBoundaryMin = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mBoundaryMin; + mBoundaryMin = (boundaryMin != NULL) ? boundaryMin->clone() : NULL; + if (mBoundaryMin != NULL) + { + mBoundaryMin->setElementName("boundaryMin"); + mBoundaryMin->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "boundaryMax" element of this CoordinateComponent. + */ +int +CoordinateComponent::setBoundaryMax(const Boundary* boundaryMax) +{ + if (mBoundaryMax == boundaryMax) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (boundaryMax == NULL) + { + delete mBoundaryMax; + mBoundaryMax = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mBoundaryMax; + mBoundaryMax = (boundaryMax != NULL) ? boundaryMax->clone() : NULL; + if (mBoundaryMax != NULL) + { + mBoundaryMax->setElementName("boundaryMax"); + mBoundaryMax->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new Boundary object, adds it to this CoordinateComponent object + * and returns the Boundary object created. + */ +Boundary* +CoordinateComponent::createBoundaryMin() +{ + if (mBoundaryMin != NULL) + { + delete mBoundaryMin; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mBoundaryMin = new Boundary(spatialns); + + mBoundaryMin->setElementName("boundaryMin"); + + delete spatialns; + + connectToChild(); + + return mBoundaryMin; +} + + +/* + * Creates a new Boundary object, adds it to this CoordinateComponent object + * and returns the Boundary object created. + */ +Boundary* +CoordinateComponent::createBoundaryMax() +{ + if (mBoundaryMax != NULL) + { + delete mBoundaryMax; + } + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mBoundaryMax = new Boundary(spatialns); + + mBoundaryMax->setElementName("boundaryMax"); + + delete spatialns; + + connectToChild(); + + return mBoundaryMax; +} + + +/* + * Unsets the value of the "boundaryMin" element of this CoordinateComponent. + */ +int +CoordinateComponent::unsetBoundaryMin() +{ + delete mBoundaryMin; + mBoundaryMin = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "boundaryMax" element of this CoordinateComponent. + */ +int +CoordinateComponent::unsetBoundaryMax() +{ + delete mBoundaryMax; + mBoundaryMax = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +CoordinateComponent::renameSIdRefs(const std::string& oldid, + const std::string& newid) +{ + if (isSetUnit() && mUnit == oldid) + { + setUnit(newid); + } +} + + +/* + * Returns the XML element name of this CoordinateComponent object. + */ +const std::string& +CoordinateComponent::getElementName() const +{ + static const string name = "coordinateComponent"; + return name; +} + + +/* + * Returns the libSBML type code for this CoordinateComponent object. + */ +int +CoordinateComponent::getTypeCode() const +{ + return SBML_SPATIAL_COORDINATECOMPONENT; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CoordinateComponent object have been set. + */ +bool +CoordinateComponent::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + if (isSetType() == false) + { + allPresent = false; + } + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * CoordinateComponent object have been set. + */ +bool +CoordinateComponent::hasRequiredElements() const +{ + bool allPresent = true; + + if (isSetBoundaryMin() == false) + { + allPresent = false; + } + + if (isSetBoundaryMax() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +CoordinateComponent::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetBoundaryMin() == true) + { + mBoundaryMin->write(stream); + } + + if (isSetBoundaryMax() == true) + { + mBoundaryMax->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +CoordinateComponent::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mBoundaryMin != NULL) + { + mBoundaryMin->accept(v); + } + + if (mBoundaryMax != NULL) + { + mBoundaryMax->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +CoordinateComponent::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mBoundaryMin != NULL) + { + mBoundaryMin->setSBMLDocument(d); + } + + if (mBoundaryMax != NULL) + { + mBoundaryMax->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +CoordinateComponent::connectToChild() +{ + SBase::connectToChild(); + + if (mBoundaryMin != NULL) + { + mBoundaryMin->connectToParent(this); + } + + if (mBoundaryMax != NULL) + { + mBoundaryMax->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +CoordinateComponent::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetBoundaryMin()) + { + mBoundaryMin->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + if (isSetBoundaryMax()) + { + mBoundaryMax->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +CoordinateComponent::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mBoundaryMin != NULL) + { + mBoundaryMin->updateSBMLNamespace(package, level, version); + } + + if (mBoundaryMax != NULL) + { + mBoundaryMax->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "type") + { + value = getTypeAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "unit") + { + value = getUnit(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this CoordinateComponent's attribute + * "attributeName" is set. + */ +bool +CoordinateComponent::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "type") + { + value = isSetType(); + } + else if (attributeName == "unit") + { + value = isSetUnit(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CoordinateComponent. + */ +int +CoordinateComponent::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "type") + { + return_value = setType(value); + } + else if (attributeName == "unit") + { + return_value = setUnit(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * CoordinateComponent. + */ +int +CoordinateComponent::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "type") + { + value = unsetType(); + } + else if (attributeName == "unit") + { + value = unsetUnit(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this CoordinateComponent. + */ +SBase* +CoordinateComponent::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "boundaryMin") + { + return createBoundaryMin(); + } + else if (elementName == "boundaryMax") + { + return createBoundaryMax(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this CoordinateComponent. + */ +int +CoordinateComponent::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "boundaryMin" && element->getTypeCode() == + SBML_SPATIAL_BOUNDARY) + { + return setBoundaryMin((const Boundary*)(element)); + } + else if (elementName == "boundaryMax" && element->getTypeCode() == + SBML_SPATIAL_BOUNDARY) + { + return setBoundaryMax((const Boundary*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CoordinateComponent. + */ +SBase* +CoordinateComponent::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "boundaryMin") + { + Boundary * obj = mBoundaryMin; + mBoundaryMin = NULL; return obj; + } + else if (elementName == "boundaryMax") + { + Boundary * obj = mBoundaryMax; + mBoundaryMax = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this CoordinateComponent. + */ +unsigned int +CoordinateComponent::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "boundaryMin") + { + if (isSetBoundaryMin()) + { + return 1; + } + } + else if (elementName == "boundaryMax") + { + if (isSetBoundaryMax()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this CoordinateComponent. + */ +SBase* +CoordinateComponent::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "boundaryMin") + { + return getBoundaryMin(); + } + else if (elementName == "boundaryMax") + { + return getBoundaryMax(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +CoordinateComponent::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mBoundaryMin != NULL) + { + if (mBoundaryMin->getId() == id) + { + return mBoundaryMin; + } + + obj = mBoundaryMin->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mBoundaryMax != NULL) + { + if (mBoundaryMax->getId() == id) + { + return mBoundaryMax; + } + + obj = mBoundaryMax->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +CoordinateComponent::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mBoundaryMin != NULL) + { + if (mBoundaryMin->getMetaId() == metaid) + { + return mBoundaryMin; + } + + obj = mBoundaryMin->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mBoundaryMax != NULL) + { + if (mBoundaryMax->getMetaId() == metaid) + { + return mBoundaryMax; + } + + obj = mBoundaryMax->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +CoordinateComponent::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mBoundaryMin, filter); + ADD_FILTERED_POINTER(ret, sublist, mBoundaryMax, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +CoordinateComponent::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + + if (name == "boundaryMin") + { + if (getErrorLog() && isSetBoundaryMin()) + { + getErrorLog()->logPackageError("spatial", + SpatialCoordinateComponentAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mBoundaryMin; + mBoundaryMin = new Boundary(spatialns); + mBoundaryMin->setElementName(name); + obj = mBoundaryMin; + } + else if (name == "boundaryMax") + { + if (getErrorLog() && isSetBoundaryMax()) + { + getErrorLog()->logPackageError("spatial", + SpatialCoordinateComponentAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mBoundaryMax; + mBoundaryMax = new Boundary(spatialns); + mBoundaryMax->setElementName(name); + obj = mBoundaryMax; + } + + delete spatialns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CoordinateComponent::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("type"); + + attributes.add("unit"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CoordinateComponent::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialGeometryLOCoordinateComponentsAllowedAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialGeometryLOCoordinateComponentsAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialCoordinateComponentAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'id' is missing from the " + " element."; + log->logPackageError("spatial", + SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // type enum (use = "required" ) + // + + std::string type; + assigned = attributes.readInto("type", type); + + if (assigned == true) + { + if (type.empty() == true) + { + logEmptyString(type, level, version, ""); + } + else + { + mType = CoordinateKind_fromString(type.c_str()); + + if (log && CoordinateKind_isValid(mType) == 0) + { + std::string msg = "The type on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + type + "', which is not a valid option."; + + log->logPackageError("spatial", + SpatialCoordinateComponentTypeMustBeCoordinateKindEnum, pkgVersion, + level, version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'type' is missing."; + log->logPackageError("spatial", + SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // unit UnitSIdRef (use = "optional" ) + // + + assigned = attributes.readInto("unit", mUnit); + + if (assigned == true) + { + if (mUnit.empty() == true) + { + logEmptyString(mUnit, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mUnit) == false) + { + std::string msg = "The unit attribute on the <" + getElementName() + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mUnit + "', which does not conform to the syntax."; + log->logPackageError("spatial", + SpatialCoordinateComponentUnitMustBeUnitSId, pkgVersion, level, version, + msg, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +CoordinateComponent::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetType() == true) + { + stream.writeAttribute("type", getPrefix(), CoordinateKind_toString(mType)); + } + + if (isSetUnit() == true) + { + stream.writeAttribute("unit", getPrefix(), mUnit); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CoordinateComponent_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CoordinateComponent_t * +CoordinateComponent_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CoordinateComponent(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this CoordinateComponent_t object. + */ +LIBSBML_EXTERN +CoordinateComponent_t* +CoordinateComponent_clone(const CoordinateComponent_t* cc) +{ + if (cc != NULL) + { + return static_cast(cc->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CoordinateComponent_t object. + */ +LIBSBML_EXTERN +void +CoordinateComponent_free(CoordinateComponent_t* cc) +{ + if (cc != NULL) + { + delete cc; + } +} + + +/* + * Returns the value of the "id" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +char * +CoordinateComponent_getId(const CoordinateComponent_t * cc) +{ + if (cc == NULL) + { + return NULL; + } + + return cc->getId().empty() ? NULL : safe_strdup(cc->getId().c_str()); +} + + +/* + * Returns the value of the "type" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +CoordinateKind_t +CoordinateComponent_getType(const CoordinateComponent_t * cc) +{ + if (cc == NULL) + { + return SPATIAL_COORDINATEKIND_INVALID; + } + + return cc->getType(); +} + + +/* + * Returns the value of the "type" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +char * +CoordinateComponent_getTypeAsString(const CoordinateComponent_t * cc) +{ + return (char*)(CoordinateKind_toString(cc->getType())); +} + + +/* + * Returns the value of the "unit" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +char * +CoordinateComponent_getUnit(const CoordinateComponent_t * cc) +{ + if (cc == NULL) + { + return NULL; + } + + return cc->getUnit().empty() ? NULL : safe_strdup(cc->getUnit().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this CoordinateComponent_t's "id" + * attribute is set. + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetId(const CoordinateComponent_t * cc) +{ + return (cc != NULL) ? static_cast(cc->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this CoordinateComponent_t's "type" + * attribute is set. + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetType(const CoordinateComponent_t * cc) +{ + return (cc != NULL) ? static_cast(cc->isSetType()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this CoordinateComponent_t's "unit" + * attribute is set. + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetUnit(const CoordinateComponent_t * cc) +{ + return (cc != NULL) ? static_cast(cc->isSetUnit()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_setId(CoordinateComponent_t * cc, const char * id) +{ + return (cc != NULL) ? cc->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "type" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_setType(CoordinateComponent_t * cc, CoordinateKind_t type) +{ + return (cc != NULL) ? cc->setType(type) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "type" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_setTypeAsString(CoordinateComponent_t * cc, + const char * type) +{ + return (cc != NULL) ? cc->setType(type): LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "unit" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_setUnit(CoordinateComponent_t * cc, const char * unit) +{ + return (cc != NULL) ? cc->setUnit(unit) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetId(CoordinateComponent_t * cc) +{ + return (cc != NULL) ? cc->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "type" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetType(CoordinateComponent_t * cc) +{ + return (cc != NULL) ? cc->unsetType() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "unit" attribute of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetUnit(CoordinateComponent_t * cc) +{ + return (cc != NULL) ? cc->unsetUnit() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "boundaryMin" element of this + * CoordinateComponent_t. + */ +LIBSBML_EXTERN +const Boundary_t* +CoordinateComponent_getBoundaryMin(const CoordinateComponent_t * cc) +{ + if (cc == NULL) + { + return NULL; + } + + return (Boundary_t*)(cc->getBoundaryMin()); +} + + +/* + * Returns the value of the "boundaryMax" element of this + * CoordinateComponent_t. + */ +LIBSBML_EXTERN +const Boundary_t* +CoordinateComponent_getBoundaryMax(const CoordinateComponent_t * cc) +{ + if (cc == NULL) + { + return NULL; + } + + return (Boundary_t*)(cc->getBoundaryMax()); +} + + +/* + * Predicate returning @c 1 (true) if this CoordinateComponent_t's + * "boundaryMin" element is set. + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetBoundaryMin(const CoordinateComponent_t * cc) +{ + return (cc != NULL) ? static_cast(cc->isSetBoundaryMin()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this CoordinateComponent_t's + * "boundaryMax" element is set. + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetBoundaryMax(const CoordinateComponent_t * cc) +{ + return (cc != NULL) ? static_cast(cc->isSetBoundaryMax()) : 0; +} + + +/* + * Sets the value of the "boundaryMin" element of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_setBoundaryMin(CoordinateComponent_t * cc, + const Boundary_t* boundaryMin) +{ + return (cc != NULL) ? cc->setBoundaryMin(boundaryMin) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "boundaryMax" element of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_setBoundaryMax(CoordinateComponent_t * cc, + const Boundary_t* boundaryMax) +{ + return (cc != NULL) ? cc->setBoundaryMax(boundaryMax) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new Boundary_t object, adds it to this CoordinateComponent_t + * object and returns the Boundary_t object created. + */ +LIBSBML_EXTERN +Boundary_t* +CoordinateComponent_createBoundaryMin(CoordinateComponent_t* cc) +{ + if (cc == NULL) + { + return NULL; + } + + return (Boundary_t*)(cc->createBoundaryMin()); +} + + +/* + * Creates a new Boundary_t object, adds it to this CoordinateComponent_t + * object and returns the Boundary_t object created. + */ +LIBSBML_EXTERN +Boundary_t* +CoordinateComponent_createBoundaryMax(CoordinateComponent_t* cc) +{ + if (cc == NULL) + { + return NULL; + } + + return (Boundary_t*)(cc->createBoundaryMax()); +} + + +/* + * Unsets the value of the "boundaryMin" element of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetBoundaryMin(CoordinateComponent_t * cc) +{ + return (cc != NULL) ? cc->unsetBoundaryMin() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "boundaryMax" element of this CoordinateComponent_t. + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetBoundaryMax(CoordinateComponent_t * cc) +{ + return (cc != NULL) ? cc->unsetBoundaryMax() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CoordinateComponent_t object have been set. + */ +LIBSBML_EXTERN +int +CoordinateComponent_hasRequiredAttributes(const CoordinateComponent_t * cc) +{ + return (cc != NULL) ? static_cast(cc->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * CoordinateComponent_t object have been set. + */ +LIBSBML_EXTERN +int +CoordinateComponent_hasRequiredElements(const CoordinateComponent_t * cc) +{ + return (cc != NULL) ? static_cast(cc->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/CoordinateComponent.h b/generator/tests/test_cpp_code/test-code/CoordinateComponent.h index bd98229f..4d431adb 100644 --- a/generator/tests/test_cpp_code/test-code/CoordinateComponent.h +++ b/generator/tests/test_cpp_code/test-code/CoordinateComponent.h @@ -1,1612 +1,1612 @@ -/** - * @file CoordinateComponent.h - * @brief Definition of the CoordinateComponent class. - * @author SBMLTeam - * - * - * - * @class CoordinateComponent - * @sbmlbrief{spatial} TODO:Definition of the CoordinateComponent class. - */ - -/** - * - * - * - * @class doc_coordinatecomponent_type - * - * @par - * The attribute "type" on a CoordinateComponent object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Spatial specification, the following are the - * allowable values for "type": - *
    - *
  • @c "cartesianX", TODO:add description - * - *
  • @c "cartesianY", TODO:add description - * - *
  • @c "cartesianZ", TODO:add description - * - *
- */ - - -#ifndef CoordinateComponent_H__ -#define CoordinateComponent_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN CoordinateComponent : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - CoordinateKind_t mType; - std::string mUnit; - Boundary* mBoundaryMin; - Boundary* mBoundaryMax; - - /** @endcond */ - -public: - - /** - * Creates a new CoordinateComponent using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CoordinateComponent. - * - * @param version an unsigned int, the SBML Version to assign to this - * CoordinateComponent. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CoordinateComponent. - * - * @copydetails doc_note_setting_lv_pkg - */ - CoordinateComponent(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = - SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new CoordinateComponent using the given SpatialPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - CoordinateComponent(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for CoordinateComponent. - * - * @param orig the CoordinateComponent instance to copy. - */ - CoordinateComponent(const CoordinateComponent& orig); - - - /** - * Assignment operator for CoordinateComponent. - * - * @param rhs the CoordinateComponent object whose values are to be used as - * the basis of the assignment. - */ - CoordinateComponent& operator=(const CoordinateComponent& rhs); - - - /** - * Creates and returns a deep copy of this CoordinateComponent object. - * - * @return a (deep) copy of this CoordinateComponent object. - */ - virtual CoordinateComponent* clone() const; - - - /** - * Destructor for CoordinateComponent. - */ - virtual ~CoordinateComponent(); - - - /** - * Returns the value of the "id" attribute of this CoordinateComponent. - * - * @return the value of the "id" attribute of this CoordinateComponent as a - * string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "type" attribute of this CoordinateComponent. - * - * @return the value of the "type" attribute of this CoordinateComponent as a - * CoordinateKind_t. - * - * @copydetails doc_coordinatecomponent_type - * @if clike The value is drawn from the enumeration @ref CoordinateKind_t - * @endif - * The possible values returned by this method are: - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_X, CoordinateKind_t} - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Y, CoordinateKind_t} - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Z, CoordinateKind_t} - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_INVALID, CoordinateKind_t} - */ - CoordinateKind_t getType() const; - - - /** - * Returns the value of the "type" attribute of this CoordinateComponent. - * - * @return the value of the "type" attribute of this CoordinateComponent as a - * string. - * - * @copydetails doc_coordinatecomponent_type - * The possible values returned by this method are: - * @li @c "cartesianX" - * @li @c "cartesianY" - * @li @c "cartesianZ" - * @li @c "invalid CoordinateKind value" - */ - std::string getTypeAsString() const; - - - /** - * Returns the value of the "unit" attribute of this CoordinateComponent. - * - * @return the value of the "unit" attribute of this CoordinateComponent as a - * string. - */ - const std::string& getUnit() const; - - - /** - * Predicate returning @c true if this CoordinateComponent's "id" attribute - * is set. - * - * @return @c true if this CoordinateComponent's "id" attribute has been set, - * otherwise @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this CoordinateComponent's "type" attribute - * is set. - * - * @return @c true if this CoordinateComponent's "type" attribute has been - * set, otherwise @c false is returned. - * - * @copydetails doc_coordinatecomponent_type - */ - bool isSetType() const; - - - /** - * Predicate returning @c true if this CoordinateComponent's "unit" attribute - * is set. - * - * @return @c true if this CoordinateComponent's "unit" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetUnit() const; - - - /** - * Sets the value of the "id" attribute of this CoordinateComponent. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "type" attribute of this CoordinateComponent. - * - * @param type @if clike CoordinateKind_t@else int@endif value of the "type" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_coordinatecomponent_type - */ - int setType(const CoordinateKind_t type); - - - /** - * Sets the value of the "type" attribute of this CoordinateComponent. - * - * @param type std::string& of the "type" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_coordinatecomponent_type - */ - int setType(const std::string& type); - - - /** - * Sets the value of the "unit" attribute of this CoordinateComponent. - * - * @param unit std::string& value of the "unit" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setUnit(const std::string& unit); - - - /** - * Unsets the value of the "id" attribute of this CoordinateComponent. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "type" attribute of this CoordinateComponent. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_coordinatecomponent_type - */ - int unsetType(); - - - /** - * Unsets the value of the "unit" attribute of this CoordinateComponent. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetUnit(); - - - /** - * Returns the value of the "boundaryMin" element of this - * CoordinateComponent. - * - * @return the value of the "boundaryMin" element of this CoordinateComponent - * as a Boundary*. - */ - const Boundary* getBoundaryMin() const; - - - /** - * Returns the value of the "boundaryMin" element of this - * CoordinateComponent. - * - * @return the value of the "boundaryMin" element of this CoordinateComponent - * as a Boundary*. - */ - Boundary* getBoundaryMin(); - - - /** - * Returns the value of the "boundaryMax" element of this - * CoordinateComponent. - * - * @return the value of the "boundaryMax" element of this CoordinateComponent - * as a Boundary*. - */ - const Boundary* getBoundaryMax() const; - - - /** - * Returns the value of the "boundaryMax" element of this - * CoordinateComponent. - * - * @return the value of the "boundaryMax" element of this CoordinateComponent - * as a Boundary*. - */ - Boundary* getBoundaryMax(); - - - /** - * Predicate returning @c true if this CoordinateComponent's "boundaryMin" - * element is set. - * - * @return @c true if this CoordinateComponent's "boundaryMin" element has - * been set, otherwise @c false is returned. - */ - bool isSetBoundaryMin() const; - - - /** - * Predicate returning @c true if this CoordinateComponent's "boundaryMax" - * element is set. - * - * @return @c true if this CoordinateComponent's "boundaryMax" element has - * been set, otherwise @c false is returned. - */ - bool isSetBoundaryMax() const; - - - /** - * Sets the value of the "boundaryMin" element of this CoordinateComponent. - * - * @param boundaryMin Boundary* value of the "boundaryMin" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setBoundaryMin(const Boundary* boundaryMin); - - - /** - * Sets the value of the "boundaryMax" element of this CoordinateComponent. - * - * @param boundaryMax Boundary* value of the "boundaryMax" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setBoundaryMax(const Boundary* boundaryMax); - - - /** - * Creates a new Boundary object, adds it to this CoordinateComponent object - * and returns the Boundary object created. - * - * @return a new Boundary object instance. - */ - Boundary* createBoundaryMin(); - - - /** - * Creates a new Boundary object, adds it to this CoordinateComponent object - * and returns the Boundary object created. - * - * @return a new Boundary object instance. - */ - Boundary* createBoundaryMax(); - - - /** - * Unsets the value of the "boundaryMin" element of this CoordinateComponent. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetBoundaryMin(); - - - /** - * Unsets the value of the "boundaryMax" element of this CoordinateComponent. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetBoundaryMax(); - - - /** - * @copydoc doc_renamesidref_common - */ - virtual void renameSIdRefs(const std::string& oldid, - const std::string& newid); - - - /** - * Returns the XML element name of this CoordinateComponent object. - * - * For CoordinateComponent, the XML element name is always - * @c "coordinateComponent". - * - * @return the name of this element, i.e. @c "coordinateComponent". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this CoordinateComponent object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_COORDINATECOMPONENT, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * CoordinateComponent object have been set. - * - * @return @c true to indicate that all the required attributes of this - * CoordinateComponent have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the CoordinateComponent object are: - * @li "id" - * @li "type" - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * CoordinateComponent object have been set. - * - * @return @c true to indicate that all the required elements of this - * CoordinateComponent have been set, otherwise @c false is returned. - * - * - * @note The required elements for the CoordinateComponent object are: - * @li "boundaryMin" - * @li "boundaryMax" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this CoordinateComponent's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this CoordinateComponent's attribute "attributeName" - * has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * CoordinateComponent. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this - * CoordinateComponent. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this CoordinateComponent. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * CoordinateComponent. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this CoordinateComponent. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this CoordinateComponent. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new CoordinateComponent_t using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * CoordinateComponent_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * CoordinateComponent_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this CoordinateComponent_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -CoordinateComponent_t * -CoordinateComponent_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this CoordinateComponent_t object. - * - * @param cc the CoordinateComponent_t structure. - * - * @return a (deep) copy of this CoordinateComponent_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -CoordinateComponent_t* -CoordinateComponent_clone(const CoordinateComponent_t* cc); - - -/** - * Frees this CoordinateComponent_t object. - * - * @param cc the CoordinateComponent_t structure. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -void -CoordinateComponent_free(CoordinateComponent_t* cc); - - -/** - * Returns the value of the "id" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure whose id is sought. - * - * @return the value of the "id" attribute of this CoordinateComponent_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -char * -CoordinateComponent_getId(const CoordinateComponent_t * cc); - - -/** - * Returns the value of the "type" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure whose type is sought. - * - * @return the value of the "type" attribute of this CoordinateComponent_t as a - * CoordinateKind_t. - * - * @copydetails doc_coordinatecomponent_type - * @if clike The value is drawn from the enumeration @ref CoordinateKind_t - * @endif - * The possible values returned by this method are: - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_X, CoordinateKind_t} - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Y, CoordinateKind_t} - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Z, CoordinateKind_t} - * @li @sbmlconstant{SPATIAL_COORDINATEKIND_INVALID, CoordinateKind_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -CoordinateKind_t -CoordinateComponent_getType(const CoordinateComponent_t * cc); - - -/** - * Returns the value of the "type" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure whose type is sought. - * - * @return the value of the "type" attribute of this CoordinateComponent_t as a - * const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_coordinatecomponent_type - * The possible values returned by this method are: - * @li @c "cartesianX" - * @li @c "cartesianY" - * @li @c "cartesianZ" - * @li @c "invalid CoordinateKind value" - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -char * -CoordinateComponent_getTypeAsString(const CoordinateComponent_t * cc); - - -/** - * Returns the value of the "unit" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure whose unit is sought. - * - * @return the value of the "unit" attribute of this CoordinateComponent_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -char * -CoordinateComponent_getUnit(const CoordinateComponent_t * cc); - - -/** - * Predicate returning @c 1 (true) if this CoordinateComponent_t's "id" - * attribute is set. - * - * @param cc the CoordinateComponent_t structure. - * - * @return @c 1 (true) if this CoordinateComponent_t's "id" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetId(const CoordinateComponent_t * cc); - - -/** - * Predicate returning @c 1 (true) if this CoordinateComponent_t's "type" - * attribute is set. - * - * @param cc the CoordinateComponent_t structure. - * - * @return @c 1 (true) if this CoordinateComponent_t's "type" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @copydetails doc_coordinatecomponent_type - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetType(const CoordinateComponent_t * cc); - - -/** - * Predicate returning @c 1 (true) if this CoordinateComponent_t's "unit" - * attribute is set. - * - * @param cc the CoordinateComponent_t structure. - * - * @return @c 1 (true) if this CoordinateComponent_t's "unit" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetUnit(const CoordinateComponent_t * cc); - - -/** - * Sets the value of the "id" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling CoordinateComponent_unsetId(). - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_setId(CoordinateComponent_t * cc, const char * id); - - -/** - * Sets the value of the "type" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @param type CoordinateKind_t value of the "type" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_coordinatecomponent_type - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_setType(CoordinateComponent_t * cc, - CoordinateKind_t type); - - -/** - * Sets the value of the "type" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @param type const char * of the "type" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_coordinatecomponent_type - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_setTypeAsString(CoordinateComponent_t * cc, - const char * type); - - -/** - * Sets the value of the "unit" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @param unit const char * value of the "unit" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_setUnit(CoordinateComponent_t * cc, const char * unit); - - -/** - * Unsets the value of the "id" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetId(CoordinateComponent_t * cc); - - -/** - * Unsets the value of the "type" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_coordinatecomponent_type - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetType(CoordinateComponent_t * cc); - - -/** - * Unsets the value of the "unit" attribute of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetUnit(CoordinateComponent_t * cc); - - -/** - * Returns the value of the "boundaryMin" element of this - * CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure whose boundaryMin is sought. - * - * @return the value of the "boundaryMin" element of this CoordinateComponent_t - * as a Boundary*. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -const Boundary_t* -CoordinateComponent_getBoundaryMin(const CoordinateComponent_t * cc); - - -/** - * Returns the value of the "boundaryMax" element of this - * CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure whose boundaryMax is sought. - * - * @return the value of the "boundaryMax" element of this CoordinateComponent_t - * as a Boundary*. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -const Boundary_t* -CoordinateComponent_getBoundaryMax(const CoordinateComponent_t * cc); - - -/** - * Predicate returning @c 1 (true) if this CoordinateComponent_t's - * "boundaryMin" element is set. - * - * @param cc the CoordinateComponent_t structure. - * - * @return @c 1 (true) if this CoordinateComponent_t's "boundaryMin" element - * has been set, otherwise @c 0 (false) is returned. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetBoundaryMin(const CoordinateComponent_t * cc); - - -/** - * Predicate returning @c 1 (true) if this CoordinateComponent_t's - * "boundaryMax" element is set. - * - * @param cc the CoordinateComponent_t structure. - * - * @return @c 1 (true) if this CoordinateComponent_t's "boundaryMax" element - * has been set, otherwise @c 0 (false) is returned. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_isSetBoundaryMax(const CoordinateComponent_t * cc); - - -/** - * Sets the value of the "boundaryMin" element of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @param boundaryMin Boundary_t* value of the "boundaryMin" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_setBoundaryMin(CoordinateComponent_t * cc, - const Boundary_t* boundaryMin); - - -/** - * Sets the value of the "boundaryMax" element of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @param boundaryMax Boundary_t* value of the "boundaryMax" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_setBoundaryMax(CoordinateComponent_t * cc, - const Boundary_t* boundaryMax); - - -/** - * Creates a new Boundary_t object, adds it to this CoordinateComponent_t - * object and returns the Boundary_t object created. - * - * @param cc the CoordinateComponent_t structure to which the Boundary_t should - * be added. - * - * @return a new Boundary_t object instance. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -Boundary_t* -CoordinateComponent_createBoundaryMin(CoordinateComponent_t* cc); - - -/** - * Creates a new Boundary_t object, adds it to this CoordinateComponent_t - * object and returns the Boundary_t object created. - * - * @param cc the CoordinateComponent_t structure to which the Boundary_t should - * be added. - * - * @return a new Boundary_t object instance. - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -Boundary_t* -CoordinateComponent_createBoundaryMax(CoordinateComponent_t* cc); - - -/** - * Unsets the value of the "boundaryMin" element of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetBoundaryMin(CoordinateComponent_t * cc); - - -/** - * Unsets the value of the "boundaryMax" element of this CoordinateComponent_t. - * - * @param cc the CoordinateComponent_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_unsetBoundaryMax(CoordinateComponent_t * cc); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * CoordinateComponent_t object have been set. - * - * @param cc the CoordinateComponent_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * CoordinateComponent_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the CoordinateComponent_t object are: - * @li "id" - * @li "type" - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_hasRequiredAttributes(const CoordinateComponent_t * cc); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * CoordinateComponent_t object have been set. - * - * @param cc the CoordinateComponent_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * CoordinateComponent_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the CoordinateComponent_t object are: - * @li "boundaryMin" - * @li "boundaryMax" - * - * @memberof CoordinateComponent_t - */ -LIBSBML_EXTERN -int -CoordinateComponent_hasRequiredElements(const CoordinateComponent_t * cc); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !CoordinateComponent_H__ */ - - +/** + * @file CoordinateComponent.h + * @brief Definition of the CoordinateComponent class. + * @author SBMLTeam + * + * + * + * @class CoordinateComponent + * @sbmlbrief{spatial} TODO:Definition of the CoordinateComponent class. + */ + +/** + * + * + * + * @class doc_coordinatecomponent_type + * + * @par + * The attribute "type" on a CoordinateComponent object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Spatial specification, the following are the + * allowable values for "type": + *
    + *
  • @c "cartesianX", TODO:add description + * + *
  • @c "cartesianY", TODO:add description + * + *
  • @c "cartesianZ", TODO:add description + * + *
+ */ + + +#ifndef CoordinateComponent_H__ +#define CoordinateComponent_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN CoordinateComponent : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + CoordinateKind_t mType; + std::string mUnit; + Boundary* mBoundaryMin; + Boundary* mBoundaryMax; + + /** @endcond */ + +public: + + /** + * Creates a new CoordinateComponent using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CoordinateComponent. + * + * @param version an unsigned int, the SBML Version to assign to this + * CoordinateComponent. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CoordinateComponent. + * + * @copydetails doc_note_setting_lv_pkg + */ + CoordinateComponent(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = + SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new CoordinateComponent using the given SpatialPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CoordinateComponent(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for CoordinateComponent. + * + * @param orig the CoordinateComponent instance to copy. + */ + CoordinateComponent(const CoordinateComponent& orig); + + + /** + * Assignment operator for CoordinateComponent. + * + * @param rhs the CoordinateComponent object whose values are to be used as + * the basis of the assignment. + */ + CoordinateComponent& operator=(const CoordinateComponent& rhs); + + + /** + * Creates and returns a deep copy of this CoordinateComponent object. + * + * @return a (deep) copy of this CoordinateComponent object. + */ + virtual CoordinateComponent* clone() const; + + + /** + * Destructor for CoordinateComponent. + */ + virtual ~CoordinateComponent(); + + + /** + * Returns the value of the "id" attribute of this CoordinateComponent. + * + * @return the value of the "id" attribute of this CoordinateComponent as a + * string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "type" attribute of this CoordinateComponent. + * + * @return the value of the "type" attribute of this CoordinateComponent as a + * CoordinateKind_t. + * + * @copydetails doc_coordinatecomponent_type + * @if clike The value is drawn from the enumeration @ref CoordinateKind_t + * @endif + * The possible values returned by this method are: + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_X, CoordinateKind_t} + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Y, CoordinateKind_t} + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Z, CoordinateKind_t} + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_INVALID, CoordinateKind_t} + */ + CoordinateKind_t getType() const; + + + /** + * Returns the value of the "type" attribute of this CoordinateComponent. + * + * @return the value of the "type" attribute of this CoordinateComponent as a + * string. + * + * @copydetails doc_coordinatecomponent_type + * The possible values returned by this method are: + * @li @c "cartesianX" + * @li @c "cartesianY" + * @li @c "cartesianZ" + * @li @c "invalid CoordinateKind value" + */ + std::string getTypeAsString() const; + + + /** + * Returns the value of the "unit" attribute of this CoordinateComponent. + * + * @return the value of the "unit" attribute of this CoordinateComponent as a + * string. + */ + const std::string& getUnit() const; + + + /** + * Predicate returning @c true if this CoordinateComponent's "id" attribute + * is set. + * + * @return @c true if this CoordinateComponent's "id" attribute has been set, + * otherwise @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this CoordinateComponent's "type" attribute + * is set. + * + * @return @c true if this CoordinateComponent's "type" attribute has been + * set, otherwise @c false is returned. + * + * @copydetails doc_coordinatecomponent_type + */ + bool isSetType() const; + + + /** + * Predicate returning @c true if this CoordinateComponent's "unit" attribute + * is set. + * + * @return @c true if this CoordinateComponent's "unit" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetUnit() const; + + + /** + * Sets the value of the "id" attribute of this CoordinateComponent. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "type" attribute of this CoordinateComponent. + * + * @param type @if clike CoordinateKind_t@else int@endif value of the "type" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_coordinatecomponent_type + */ + int setType(const CoordinateKind_t type); + + + /** + * Sets the value of the "type" attribute of this CoordinateComponent. + * + * @param type std::string& of the "type" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_coordinatecomponent_type + */ + int setType(const std::string& type); + + + /** + * Sets the value of the "unit" attribute of this CoordinateComponent. + * + * @param unit std::string& value of the "unit" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setUnit(const std::string& unit); + + + /** + * Unsets the value of the "id" attribute of this CoordinateComponent. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "type" attribute of this CoordinateComponent. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_coordinatecomponent_type + */ + int unsetType(); + + + /** + * Unsets the value of the "unit" attribute of this CoordinateComponent. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetUnit(); + + + /** + * Returns the value of the "boundaryMin" element of this + * CoordinateComponent. + * + * @return the value of the "boundaryMin" element of this CoordinateComponent + * as a Boundary*. + */ + const Boundary* getBoundaryMin() const; + + + /** + * Returns the value of the "boundaryMin" element of this + * CoordinateComponent. + * + * @return the value of the "boundaryMin" element of this CoordinateComponent + * as a Boundary*. + */ + Boundary* getBoundaryMin(); + + + /** + * Returns the value of the "boundaryMax" element of this + * CoordinateComponent. + * + * @return the value of the "boundaryMax" element of this CoordinateComponent + * as a Boundary*. + */ + const Boundary* getBoundaryMax() const; + + + /** + * Returns the value of the "boundaryMax" element of this + * CoordinateComponent. + * + * @return the value of the "boundaryMax" element of this CoordinateComponent + * as a Boundary*. + */ + Boundary* getBoundaryMax(); + + + /** + * Predicate returning @c true if this CoordinateComponent's "boundaryMin" + * element is set. + * + * @return @c true if this CoordinateComponent's "boundaryMin" element has + * been set, otherwise @c false is returned. + */ + bool isSetBoundaryMin() const; + + + /** + * Predicate returning @c true if this CoordinateComponent's "boundaryMax" + * element is set. + * + * @return @c true if this CoordinateComponent's "boundaryMax" element has + * been set, otherwise @c false is returned. + */ + bool isSetBoundaryMax() const; + + + /** + * Sets the value of the "boundaryMin" element of this CoordinateComponent. + * + * @param boundaryMin Boundary* value of the "boundaryMin" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setBoundaryMin(const Boundary* boundaryMin); + + + /** + * Sets the value of the "boundaryMax" element of this CoordinateComponent. + * + * @param boundaryMax Boundary* value of the "boundaryMax" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setBoundaryMax(const Boundary* boundaryMax); + + + /** + * Creates a new Boundary object, adds it to this CoordinateComponent object + * and returns the Boundary object created. + * + * @return a new Boundary object instance. + */ + Boundary* createBoundaryMin(); + + + /** + * Creates a new Boundary object, adds it to this CoordinateComponent object + * and returns the Boundary object created. + * + * @return a new Boundary object instance. + */ + Boundary* createBoundaryMax(); + + + /** + * Unsets the value of the "boundaryMin" element of this CoordinateComponent. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetBoundaryMin(); + + + /** + * Unsets the value of the "boundaryMax" element of this CoordinateComponent. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetBoundaryMax(); + + + /** + * @copydoc doc_renamesidref_common + */ + virtual void renameSIdRefs(const std::string& oldid, + const std::string& newid); + + + /** + * Returns the XML element name of this CoordinateComponent object. + * + * For CoordinateComponent, the XML element name is always + * @c "coordinateComponent". + * + * @return the name of this element, i.e. @c "coordinateComponent". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this CoordinateComponent object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_COORDINATECOMPONENT, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CoordinateComponent object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CoordinateComponent have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the CoordinateComponent object are: + * @li "id" + * @li "type" + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * CoordinateComponent object have been set. + * + * @return @c true to indicate that all the required elements of this + * CoordinateComponent have been set, otherwise @c false is returned. + * + * + * @note The required elements for the CoordinateComponent object are: + * @li "boundaryMin" + * @li "boundaryMax" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this CoordinateComponent's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CoordinateComponent's attribute "attributeName" + * has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * CoordinateComponent. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this + * CoordinateComponent. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this CoordinateComponent. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CoordinateComponent. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this CoordinateComponent. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this CoordinateComponent. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CoordinateComponent_t using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * CoordinateComponent_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * CoordinateComponent_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this CoordinateComponent_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +CoordinateComponent_t * +CoordinateComponent_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this CoordinateComponent_t object. + * + * @param cc the CoordinateComponent_t structure. + * + * @return a (deep) copy of this CoordinateComponent_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +CoordinateComponent_t* +CoordinateComponent_clone(const CoordinateComponent_t* cc); + + +/** + * Frees this CoordinateComponent_t object. + * + * @param cc the CoordinateComponent_t structure. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +void +CoordinateComponent_free(CoordinateComponent_t* cc); + + +/** + * Returns the value of the "id" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure whose id is sought. + * + * @return the value of the "id" attribute of this CoordinateComponent_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +char * +CoordinateComponent_getId(const CoordinateComponent_t * cc); + + +/** + * Returns the value of the "type" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure whose type is sought. + * + * @return the value of the "type" attribute of this CoordinateComponent_t as a + * CoordinateKind_t. + * + * @copydetails doc_coordinatecomponent_type + * @if clike The value is drawn from the enumeration @ref CoordinateKind_t + * @endif + * The possible values returned by this method are: + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_X, CoordinateKind_t} + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Y, CoordinateKind_t} + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_CARTESIAN_Z, CoordinateKind_t} + * @li @sbmlconstant{SPATIAL_COORDINATEKIND_INVALID, CoordinateKind_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +CoordinateKind_t +CoordinateComponent_getType(const CoordinateComponent_t * cc); + + +/** + * Returns the value of the "type" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure whose type is sought. + * + * @return the value of the "type" attribute of this CoordinateComponent_t as a + * const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_coordinatecomponent_type + * The possible values returned by this method are: + * @li @c "cartesianX" + * @li @c "cartesianY" + * @li @c "cartesianZ" + * @li @c "invalid CoordinateKind value" + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +char * +CoordinateComponent_getTypeAsString(const CoordinateComponent_t * cc); + + +/** + * Returns the value of the "unit" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure whose unit is sought. + * + * @return the value of the "unit" attribute of this CoordinateComponent_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +char * +CoordinateComponent_getUnit(const CoordinateComponent_t * cc); + + +/** + * Predicate returning @c 1 (true) if this CoordinateComponent_t's "id" + * attribute is set. + * + * @param cc the CoordinateComponent_t structure. + * + * @return @c 1 (true) if this CoordinateComponent_t's "id" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetId(const CoordinateComponent_t * cc); + + +/** + * Predicate returning @c 1 (true) if this CoordinateComponent_t's "type" + * attribute is set. + * + * @param cc the CoordinateComponent_t structure. + * + * @return @c 1 (true) if this CoordinateComponent_t's "type" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @copydetails doc_coordinatecomponent_type + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetType(const CoordinateComponent_t * cc); + + +/** + * Predicate returning @c 1 (true) if this CoordinateComponent_t's "unit" + * attribute is set. + * + * @param cc the CoordinateComponent_t structure. + * + * @return @c 1 (true) if this CoordinateComponent_t's "unit" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetUnit(const CoordinateComponent_t * cc); + + +/** + * Sets the value of the "id" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling CoordinateComponent_unsetId(). + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_setId(CoordinateComponent_t * cc, const char * id); + + +/** + * Sets the value of the "type" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @param type CoordinateKind_t value of the "type" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_coordinatecomponent_type + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_setType(CoordinateComponent_t * cc, + CoordinateKind_t type); + + +/** + * Sets the value of the "type" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @param type const char * of the "type" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_coordinatecomponent_type + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_setTypeAsString(CoordinateComponent_t * cc, + const char * type); + + +/** + * Sets the value of the "unit" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @param unit const char * value of the "unit" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_setUnit(CoordinateComponent_t * cc, const char * unit); + + +/** + * Unsets the value of the "id" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetId(CoordinateComponent_t * cc); + + +/** + * Unsets the value of the "type" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_coordinatecomponent_type + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetType(CoordinateComponent_t * cc); + + +/** + * Unsets the value of the "unit" attribute of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetUnit(CoordinateComponent_t * cc); + + +/** + * Returns the value of the "boundaryMin" element of this + * CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure whose boundaryMin is sought. + * + * @return the value of the "boundaryMin" element of this CoordinateComponent_t + * as a Boundary*. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +const Boundary_t* +CoordinateComponent_getBoundaryMin(const CoordinateComponent_t * cc); + + +/** + * Returns the value of the "boundaryMax" element of this + * CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure whose boundaryMax is sought. + * + * @return the value of the "boundaryMax" element of this CoordinateComponent_t + * as a Boundary*. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +const Boundary_t* +CoordinateComponent_getBoundaryMax(const CoordinateComponent_t * cc); + + +/** + * Predicate returning @c 1 (true) if this CoordinateComponent_t's + * "boundaryMin" element is set. + * + * @param cc the CoordinateComponent_t structure. + * + * @return @c 1 (true) if this CoordinateComponent_t's "boundaryMin" element + * has been set, otherwise @c 0 (false) is returned. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetBoundaryMin(const CoordinateComponent_t * cc); + + +/** + * Predicate returning @c 1 (true) if this CoordinateComponent_t's + * "boundaryMax" element is set. + * + * @param cc the CoordinateComponent_t structure. + * + * @return @c 1 (true) if this CoordinateComponent_t's "boundaryMax" element + * has been set, otherwise @c 0 (false) is returned. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_isSetBoundaryMax(const CoordinateComponent_t * cc); + + +/** + * Sets the value of the "boundaryMin" element of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @param boundaryMin Boundary_t* value of the "boundaryMin" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_setBoundaryMin(CoordinateComponent_t * cc, + const Boundary_t* boundaryMin); + + +/** + * Sets the value of the "boundaryMax" element of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @param boundaryMax Boundary_t* value of the "boundaryMax" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_setBoundaryMax(CoordinateComponent_t * cc, + const Boundary_t* boundaryMax); + + +/** + * Creates a new Boundary_t object, adds it to this CoordinateComponent_t + * object and returns the Boundary_t object created. + * + * @param cc the CoordinateComponent_t structure to which the Boundary_t should + * be added. + * + * @return a new Boundary_t object instance. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +Boundary_t* +CoordinateComponent_createBoundaryMin(CoordinateComponent_t* cc); + + +/** + * Creates a new Boundary_t object, adds it to this CoordinateComponent_t + * object and returns the Boundary_t object created. + * + * @param cc the CoordinateComponent_t structure to which the Boundary_t should + * be added. + * + * @return a new Boundary_t object instance. + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +Boundary_t* +CoordinateComponent_createBoundaryMax(CoordinateComponent_t* cc); + + +/** + * Unsets the value of the "boundaryMin" element of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetBoundaryMin(CoordinateComponent_t * cc); + + +/** + * Unsets the value of the "boundaryMax" element of this CoordinateComponent_t. + * + * @param cc the CoordinateComponent_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_unsetBoundaryMax(CoordinateComponent_t * cc); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CoordinateComponent_t object have been set. + * + * @param cc the CoordinateComponent_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CoordinateComponent_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the CoordinateComponent_t object are: + * @li "id" + * @li "type" + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_hasRequiredAttributes(const CoordinateComponent_t * cc); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * CoordinateComponent_t object have been set. + * + * @param cc the CoordinateComponent_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * CoordinateComponent_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the CoordinateComponent_t object are: + * @li "boundaryMin" + * @li "boundaryMax" + * + * @memberof CoordinateComponent_t + */ +LIBSBML_EXTERN +int +CoordinateComponent_hasRequiredElements(const CoordinateComponent_t * cc); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CoordinateComponent_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Copyright.cpp b/generator/tests/test_cpp_code/test-code/Copyright.cpp index c693b1fe..1aa98a47 100644 --- a/generator/tests/test_cpp_code/test-code/Copyright.cpp +++ b/generator/tests/test_cpp_code/test-code/Copyright.cpp @@ -1,723 +1,723 @@ -/** - * @file Copyright.cpp - * @brief Implementation of the Copyright class. - * @author SBMLTeam - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Copyright using the given SBML Level, Version and - * “test” package version. - */ -Copyright::Copyright(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) -{ - setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); -} - - -/* - * Creates a new Copyright using the given TestPkgNamespaces object. - */ -Copyright::Copyright(TestPkgNamespaces *testns) - : SBase(testns) -{ - setElementNamespace(testns->getURI()); - loadPlugins(testns); -} - - -/* - * Copy constructor for Copyright. - */ -Copyright::Copyright(const Copyright& orig) - : SBase( orig ) -{ -} - - -/* - * Assignment operator for Copyright. - */ -Copyright& -Copyright::operator=(const Copyright& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Copyright object. - */ -Copyright* -Copyright::clone() const -{ - return new Copyright(*this); -} - - -/* - * Destructor for Copyright. - */ -Copyright::~Copyright() -{ -} - - -/* - * Returns the value of the "id" attribute of this Copyright. - */ -const std::string& -Copyright::getId() const -{ - return mId; -} - - -/* - * Predicate returning @c true if this Copyright's "id" attribute is set. - */ -bool -Copyright::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this Copyright. - */ -int -Copyright::setId(const std::string& id) -{ - mId = id; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this Copyright. - */ -int -Copyright::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the XML element name of this Copyright object. - */ -const std::string& -Copyright::getElementName() const -{ - static const string name = "copyright"; - return name; -} - - -/* - * Returns the libSBML type code for this Copyright object. - */ -int -Copyright::getTypeCode() const -{ - return SBML_TEST_MYBASE; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * Copyright object have been set. - */ -bool -Copyright::hasRequiredAttributes() const -{ - bool allPresent = true; - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Copyright::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Copyright::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Copyright::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Copyright::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Copyright's attribute "attributeName" is - * set. - */ -bool -Copyright::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Copyright. - */ -int -Copyright::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Copyright::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Copyright::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("test", TestCopyrightAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("test", TestCopyrightAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // id string (use = "optional" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Copyright::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Copyright_t using the given SBML Level, Version and - * “test” package version. - */ -LIBSBML_EXTERN -Copyright_t * -Copyright_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new Copyright(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Copyright_t object. - */ -LIBSBML_EXTERN -Copyright_t* -Copyright_clone(const Copyright_t* c) -{ - if (c != NULL) - { - return static_cast(c->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Copyright_t object. - */ -LIBSBML_EXTERN -void -Copyright_free(Copyright_t* c) -{ - if (c != NULL) - { - delete c; - } -} - - -/* - * Returns the value of the "id" attribute of this Copyright_t. - */ -LIBSBML_EXTERN -char * -Copyright_getId(const Copyright_t * c) -{ - if (c == NULL) - { - return NULL; - } - - return c->getId().empty() ? NULL : safe_strdup(c->getId().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this Copyright_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -Copyright_isSetId(const Copyright_t * c) -{ - return (c != NULL) ? static_cast(c->isSetId()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this Copyright_t. - */ -LIBSBML_EXTERN -int -Copyright_setId(Copyright_t * c, const char * id) -{ - return (c != NULL) ? c->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this Copyright_t. - */ -LIBSBML_EXTERN -int -Copyright_unsetId(Copyright_t * c) -{ - return (c != NULL) ? c->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Copyright_t object have been set. - */ -LIBSBML_EXTERN -int -Copyright_hasRequiredAttributes(const Copyright_t * c) -{ - return (c != NULL) ? static_cast(c->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Copyright.cpp + * @brief Implementation of the Copyright class. + * @author SBMLTeam + * + * + */ +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Copyright using the given SBML Level, Version and + * “test” package version. + */ +Copyright::Copyright(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) +{ + setSBMLNamespacesAndOwn(new TestPkgNamespaces(level, version, pkgVersion)); +} + + +/* + * Creates a new Copyright using the given TestPkgNamespaces object. + */ +Copyright::Copyright(TestPkgNamespaces *testns) + : SBase(testns) +{ + setElementNamespace(testns->getURI()); + loadPlugins(testns); +} + + +/* + * Copy constructor for Copyright. + */ +Copyright::Copyright(const Copyright& orig) + : SBase( orig ) +{ +} + + +/* + * Assignment operator for Copyright. + */ +Copyright& +Copyright::operator=(const Copyright& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Copyright object. + */ +Copyright* +Copyright::clone() const +{ + return new Copyright(*this); +} + + +/* + * Destructor for Copyright. + */ +Copyright::~Copyright() +{ +} + + +/* + * Returns the value of the "id" attribute of this Copyright. + */ +const std::string& +Copyright::getId() const +{ + return mId; +} + + +/* + * Predicate returning @c true if this Copyright's "id" attribute is set. + */ +bool +Copyright::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Sets the value of the "id" attribute of this Copyright. + */ +int +Copyright::setId(const std::string& id) +{ + mId = id; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "id" attribute of this Copyright. + */ +int +Copyright::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the XML element name of this Copyright object. + */ +const std::string& +Copyright::getElementName() const +{ + static const string name = "copyright"; + return name; +} + + +/* + * Returns the libSBML type code for this Copyright object. + */ +int +Copyright::getTypeCode() const +{ + return SBML_TEST_MYBASE; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * Copyright object have been set. + */ +bool +Copyright::hasRequiredAttributes() const +{ + bool allPresent = true; + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Copyright::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Copyright::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Copyright::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Copyright::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Copyright's attribute "attributeName" is + * set. + */ +bool +Copyright::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Copyright. + */ +int +Copyright::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Copyright::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Copyright::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("test", TestCopyrightAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("test", TestCopyrightAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // id string (use = "optional" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Copyright::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Copyright_t using the given SBML Level, Version and + * “test” package version. + */ +LIBSBML_EXTERN +Copyright_t * +Copyright_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new Copyright(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Copyright_t object. + */ +LIBSBML_EXTERN +Copyright_t* +Copyright_clone(const Copyright_t* c) +{ + if (c != NULL) + { + return static_cast(c->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Copyright_t object. + */ +LIBSBML_EXTERN +void +Copyright_free(Copyright_t* c) +{ + if (c != NULL) + { + delete c; + } +} + + +/* + * Returns the value of the "id" attribute of this Copyright_t. + */ +LIBSBML_EXTERN +char * +Copyright_getId(const Copyright_t * c) +{ + if (c == NULL) + { + return NULL; + } + + return c->getId().empty() ? NULL : safe_strdup(c->getId().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this Copyright_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +Copyright_isSetId(const Copyright_t * c) +{ + return (c != NULL) ? static_cast(c->isSetId()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this Copyright_t. + */ +LIBSBML_EXTERN +int +Copyright_setId(Copyright_t * c, const char * id) +{ + return (c != NULL) ? c->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this Copyright_t. + */ +LIBSBML_EXTERN +int +Copyright_unsetId(Copyright_t * c) +{ + return (c != NULL) ? c->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Copyright_t object have been set. + */ +LIBSBML_EXTERN +int +Copyright_hasRequiredAttributes(const Copyright_t * c) +{ + return (c != NULL) ? static_cast(c->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Copyright.h b/generator/tests/test_cpp_code/test-code/Copyright.h index d865fef7..26e1302c 100644 --- a/generator/tests/test_cpp_code/test-code/Copyright.h +++ b/generator/tests/test_cpp_code/test-code/Copyright.h @@ -1,729 +1,729 @@ -/** - * @file Copyright.h - * @brief Definition of the Copyright class. - * @author SBMLTeam - * - * - * - * @class Copyright - * @sbmlbrief{test} TODO:Definition of the Copyright class. - */ - - -#ifndef Copyright_H__ -#define Copyright_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Copyright : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - - /** @endcond */ - -public: - - /** - * Creates a new Copyright using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Copyright. - * - * @param version an unsigned int, the SBML Version to assign to this - * Copyright. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * Copyright. - * - * @copydetails doc_note_setting_lv_pkg - */ - Copyright(unsigned int level = TestExtension::getDefaultLevel(), - unsigned int version = TestExtension::getDefaultVersion(), - unsigned int pkgVersion = - TestExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Copyright using the given TestPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param testns the TestPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Copyright(TestPkgNamespaces *testns); - - - /** - * Copy constructor for Copyright. - * - * @param orig the Copyright instance to copy. - */ - Copyright(const Copyright& orig); - - - /** - * Assignment operator for Copyright. - * - * @param rhs the Copyright object whose values are to be used as the basis - * of the assignment. - */ - Copyright& operator=(const Copyright& rhs); - - - /** - * Creates and returns a deep copy of this Copyright object. - * - * @return a (deep) copy of this Copyright object. - */ - virtual Copyright* clone() const; - - - /** - * Destructor for Copyright. - */ - virtual ~Copyright(); - - - /** - * Returns the value of the "id" attribute of this Copyright. - * - * @return the value of the "id" attribute of this Copyright as a string. - */ - virtual const std::string& getId() const; - - - /** - * Predicate returning @c true if this Copyright's "id" attribute is set. - * - * @return @c true if this Copyright's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Sets the value of the "id" attribute of this Copyright. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Unsets the value of the "id" attribute of this Copyright. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Returns the XML element name of this Copyright object. - * - * For Copyright, the XML element name is always @c "copyright". - * - * @return the name of this element, i.e. @c "copyright". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Copyright object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_TEST_MYBASE, SBMLTestTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * Copyright object have been set. - * - * @return @c true to indicate that all the required attributes of this - * Copyright have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Copyright's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Copyright's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Copyright. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Copyright_t using the given SBML Level, Version and - * “test” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Copyright_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Copyright_t. - * - * @param pkgVersion an unsigned int, the SBML Test Version to assign to this - * Copyright_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -Copyright_t * -Copyright_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Copyright_t object. - * - * @param c the Copyright_t structure. - * - * @return a (deep) copy of this Copyright_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -Copyright_t* -Copyright_clone(const Copyright_t* c); - - -/** - * Frees this Copyright_t object. - * - * @param c the Copyright_t structure. - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -void -Copyright_free(Copyright_t* c); - - -/** - * Returns the value of the "id" attribute of this Copyright_t. - * - * @param c the Copyright_t structure whose id is sought. - * - * @return the value of the "id" attribute of this Copyright_t as a pointer to - * a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -char * -Copyright_getId(const Copyright_t * c); - - -/** - * Predicate returning @c 1 (true) if this Copyright_t's "id" attribute is set. - * - * @param c the Copyright_t structure. - * - * @return @c 1 (true) if this Copyright_t's "id" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -int -Copyright_isSetId(const Copyright_t * c); - - -/** - * Sets the value of the "id" attribute of this Copyright_t. - * - * @param c the Copyright_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling Copyright_unsetId(). - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -int -Copyright_setId(Copyright_t * c, const char * id); - - -/** - * Unsets the value of the "id" attribute of this Copyright_t. - * - * @param c the Copyright_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -int -Copyright_unsetId(Copyright_t * c); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Copyright_t object have been set. - * - * @param c the Copyright_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Copyright_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof Copyright_t - */ -LIBSBML_EXTERN -int -Copyright_hasRequiredAttributes(const Copyright_t * c); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Copyright_H__ */ - - +/** + * @file Copyright.h + * @brief Definition of the Copyright class. + * @author SBMLTeam + * + * + * + * @class Copyright + * @sbmlbrief{test} TODO:Definition of the Copyright class. + */ + + +#ifndef Copyright_H__ +#define Copyright_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Copyright : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + + /** @endcond */ + +public: + + /** + * Creates a new Copyright using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Copyright. + * + * @param version an unsigned int, the SBML Version to assign to this + * Copyright. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * Copyright. + * + * @copydetails doc_note_setting_lv_pkg + */ + Copyright(unsigned int level = TestExtension::getDefaultLevel(), + unsigned int version = TestExtension::getDefaultVersion(), + unsigned int pkgVersion = + TestExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Copyright using the given TestPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param testns the TestPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Copyright(TestPkgNamespaces *testns); + + + /** + * Copy constructor for Copyright. + * + * @param orig the Copyright instance to copy. + */ + Copyright(const Copyright& orig); + + + /** + * Assignment operator for Copyright. + * + * @param rhs the Copyright object whose values are to be used as the basis + * of the assignment. + */ + Copyright& operator=(const Copyright& rhs); + + + /** + * Creates and returns a deep copy of this Copyright object. + * + * @return a (deep) copy of this Copyright object. + */ + virtual Copyright* clone() const; + + + /** + * Destructor for Copyright. + */ + virtual ~Copyright(); + + + /** + * Returns the value of the "id" attribute of this Copyright. + * + * @return the value of the "id" attribute of this Copyright as a string. + */ + virtual const std::string& getId() const; + + + /** + * Predicate returning @c true if this Copyright's "id" attribute is set. + * + * @return @c true if this Copyright's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Sets the value of the "id" attribute of this Copyright. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Unsets the value of the "id" attribute of this Copyright. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Returns the XML element name of this Copyright object. + * + * For Copyright, the XML element name is always @c "copyright". + * + * @return the name of this element, i.e. @c "copyright". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Copyright object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_TEST_MYBASE, SBMLTestTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * Copyright object have been set. + * + * @return @c true to indicate that all the required attributes of this + * Copyright have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Copyright's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Copyright's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Copyright. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Copyright_t using the given SBML Level, Version and + * “test” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Copyright_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Copyright_t. + * + * @param pkgVersion an unsigned int, the SBML Test Version to assign to this + * Copyright_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +Copyright_t * +Copyright_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Copyright_t object. + * + * @param c the Copyright_t structure. + * + * @return a (deep) copy of this Copyright_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +Copyright_t* +Copyright_clone(const Copyright_t* c); + + +/** + * Frees this Copyright_t object. + * + * @param c the Copyright_t structure. + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +void +Copyright_free(Copyright_t* c); + + +/** + * Returns the value of the "id" attribute of this Copyright_t. + * + * @param c the Copyright_t structure whose id is sought. + * + * @return the value of the "id" attribute of this Copyright_t as a pointer to + * a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +char * +Copyright_getId(const Copyright_t * c); + + +/** + * Predicate returning @c 1 (true) if this Copyright_t's "id" attribute is set. + * + * @param c the Copyright_t structure. + * + * @return @c 1 (true) if this Copyright_t's "id" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +int +Copyright_isSetId(const Copyright_t * c); + + +/** + * Sets the value of the "id" attribute of this Copyright_t. + * + * @param c the Copyright_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling Copyright_unsetId(). + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +int +Copyright_setId(Copyright_t * c, const char * id); + + +/** + * Unsets the value of the "id" attribute of this Copyright_t. + * + * @param c the Copyright_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +int +Copyright_unsetId(Copyright_t * c); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Copyright_t object have been set. + * + * @param c the Copyright_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Copyright_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof Copyright_t + */ +LIBSBML_EXTERN +int +Copyright_hasRequiredAttributes(const Copyright_t * c); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Copyright_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Def.cpp b/generator/tests/test_cpp_code/test-code/Def.cpp index 72b028a8..89fd1212 100644 --- a/generator/tests/test_cpp_code/test-code/Def.cpp +++ b/generator/tests/test_cpp_code/test-code/Def.cpp @@ -1,933 +1,933 @@ -/** - * @file Def.cpp - * @brief Implementation of the Def class. - * @author SBMLTeam - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Def using the given SBML Level, Version and “copy” - * package version. - */ -Def::Def(unsigned int level, unsigned int version, unsigned int pkgVersion) - : SBase(level, version) - , mLetter ("") - , mMess (NULL) -{ - setSBMLNamespacesAndOwn(new CopyPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new Def using the given CopyPkgNamespaces object. - */ -Def::Def(CopyPkgNamespaces *copyns) - : SBase(copyns) - , mLetter ("") - , mMess (NULL) -{ - setElementNamespace(copyns->getURI()); - connectToChild(); - loadPlugins(copyns); -} - - -/* - * Copy constructor for Def. - */ -Def::Def(const Def& orig) - : SBase( orig ) - , mLetter ( orig.mLetter ) - , mMess ( NULL ) -{ - if (orig.mMess != NULL) - { - mMess = orig.mMess->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for Def. - */ -Def& -Def::operator=(const Def& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mLetter = rhs.mLetter; - delete mMess; - if (rhs.mMess != NULL) - { - mMess = rhs.mMess->clone(); - } - else - { - mMess = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Def object. - */ -Def* -Def::clone() const -{ - return new Def(*this); -} - - -/* - * Destructor for Def. - */ -Def::~Def() -{ - delete mMess; - mMess = NULL; -} - - -/* - * Returns the value of the "letter" attribute of this Def. - */ -const std::string& -Def::getLetter() const -{ - return mLetter; -} - - -/* - * Predicate returning @c true if this Def's "letter" attribute is set. - */ -bool -Def::isSetLetter() const -{ - return (mLetter.empty() == false); -} - - -/* - * Sets the value of the "letter" attribute of this Def. - */ -int -Def::setLetter(const std::string& letter) -{ - mLetter = letter; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "letter" attribute of this Def. - */ -int -Def::unsetLetter() -{ - mLetter.erase(); - - if (mLetter.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "mess" element of this Def. - */ -const XMLNode* -Def::getMess() const -{ - return mMess; -} - - -/* - * Returns the value of the "mess" element of this Def. - */ -XMLNode* -Def::getMess() -{ - return mMess; -} - - -/* - * Predicate returning @c true if this Def's "mess" element is set. - */ -bool -Def::isSetMess() const -{ - return (mMess != NULL); -} - - -/* - * Sets the value of the "mess" element of this Def. - */ -int -Def::setMess(const XMLNode* mess) -{ - if (mMess == mess) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (mess == NULL) - { - delete mMess; - mMess = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mMess; - mMess = (mess != NULL) ? mess->clone() : NULL; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "mess" element of this Def. - */ -int -Def::unsetMess() -{ - delete mMess; - mMess = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this Def object. - */ -const std::string& -Def::getElementName() const -{ - static const string name = "def"; - return name; -} - - -/* - * Returns the libSBML type code for this Def object. - */ -int -Def::getTypeCode() const -{ - return SBML_COPY_ABC; -} - - -/* - * Predicate returning @c true if all the required attributes for this Def - * object have been set. - */ -bool -Def::hasRequiredAttributes() const -{ - bool allPresent = true; - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Def::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetMess() == true) - { - stream.startElement("mess"); - stream << *mMess; - stream.endElement("mess"); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Def::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Def::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Def::connectToChild() -{ - SBase::connectToChild(); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Def::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -Def::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Def. - */ -int -Def::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Def. - */ -int -Def::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Def. - */ -int -Def::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Def. - */ -int -Def::getAttribute(const std::string& attributeName, unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Def. - */ -int -Def::getAttribute(const std::string& attributeName, std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "letter") - { - value = getLetter(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Def's attribute "attributeName" is set. - */ -bool -Def::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "letter") - { - value = isSetLetter(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Def. - */ -int -Def::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Def. - */ -int -Def::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Def. - */ -int -Def::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Def. - */ -int -Def::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Def. - */ -int -Def::setAttribute(const std::string& attributeName, const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "letter") - { - return_value = setLetter(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Def. - */ -int -Def::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "letter") - { - value = unsetLetter(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Def::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("letter"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Def::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("copy", CopyDefAllowedAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("copy", CopyDefAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } - - // - // letter string (use = "optional" ) - // - - assigned = attributes.readInto("letter", mLetter); - - if (assigned == true) - { - if (mLetter.empty() == true) - { - logEmptyString(mLetter, level, version, ""); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads other XML such as math/notes etc. - */ -bool -Def::readOtherXML(XMLInputStream& stream) -{ - bool read = false; - const string& name = stream.peek().getName(); - - if (name == "mess") - { - const XMLToken& token = stream.next(); - stream.skipText(); - delete mMess; - XMLNode* xml = new XMLNode(stream); - mMess = new XMLNode(*(static_cast(xml))); - stream.skipPastEnd(token); - delete xml; - read = true; - } - - if (SBase::readOtherXML(stream)) - { - read = true; - } - - return read; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Def::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetLetter() == true) - { - stream.writeAttribute("letter", getPrefix(), mLetter); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Def_t using the given SBML Level, Version and - * “copy” package version. - */ -LIBSBML_EXTERN -Def_t * -Def_create(unsigned int level, unsigned int version, unsigned int pkgVersion) -{ - return new Def(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Def_t object. - */ -LIBSBML_EXTERN -Def_t* -Def_clone(const Def_t* d) -{ - if (d != NULL) - { - return static_cast(d->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Def_t object. - */ -LIBSBML_EXTERN -void -Def_free(Def_t* d) -{ - if (d != NULL) - { - delete d; - } -} - - -/* - * Returns the value of the "letter" attribute of this Def_t. - */ -LIBSBML_EXTERN -char * -Def_getLetter(const Def_t * d) -{ - if (d == NULL) - { - return NULL; - } - - return d->getLetter().empty() ? NULL : safe_strdup(d->getLetter().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this Def_t's "letter" attribute is set. - */ -LIBSBML_EXTERN -int -Def_isSetLetter(const Def_t * d) -{ - return (d != NULL) ? static_cast(d->isSetLetter()) : 0; -} - - -/* - * Sets the value of the "letter" attribute of this Def_t. - */ -LIBSBML_EXTERN -int -Def_setLetter(Def_t * d, const char * letter) -{ - return (d != NULL) ? d->setLetter(letter) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "letter" attribute of this Def_t. - */ -LIBSBML_EXTERN -int -Def_unsetLetter(Def_t * d) -{ - return (d != NULL) ? d->unsetLetter() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "mess" element of this Def_t. - */ -LIBSBML_EXTERN -const XMLNode_t* -Def_getMess(const Def_t * d) -{ - if (d == NULL) - { - return NULL; - } - - return (XMLNode_t*)(d->getMess()); -} - - -/* - * Predicate returning @c 1 (true) if this Def_t's "mess" element is set. - */ -LIBSBML_EXTERN -int -Def_isSetMess(const Def_t * d) -{ - return (d != NULL) ? static_cast(d->isSetMess()) : 0; -} - - -/* - * Sets the value of the "mess" element of this Def_t. - */ -LIBSBML_EXTERN -int -Def_setMess(Def_t * d, const XMLNode_t* mess) -{ - return (d != NULL) ? d->setMess(mess) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "mess" element of this Def_t. - */ -LIBSBML_EXTERN -int -Def_unsetMess(Def_t * d) -{ - return (d != NULL) ? d->unsetMess() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Def_t object have been set. - */ -LIBSBML_EXTERN -int -Def_hasRequiredAttributes(const Def_t * d) -{ - return (d != NULL) ? static_cast(d->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Def.cpp + * @brief Implementation of the Def class. + * @author SBMLTeam + * + * + */ +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Def using the given SBML Level, Version and “copy” + * package version. + */ +Def::Def(unsigned int level, unsigned int version, unsigned int pkgVersion) + : SBase(level, version) + , mLetter ("") + , mMess (NULL) +{ + setSBMLNamespacesAndOwn(new CopyPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new Def using the given CopyPkgNamespaces object. + */ +Def::Def(CopyPkgNamespaces *copyns) + : SBase(copyns) + , mLetter ("") + , mMess (NULL) +{ + setElementNamespace(copyns->getURI()); + connectToChild(); + loadPlugins(copyns); +} + + +/* + * Copy constructor for Def. + */ +Def::Def(const Def& orig) + : SBase( orig ) + , mLetter ( orig.mLetter ) + , mMess ( NULL ) +{ + if (orig.mMess != NULL) + { + mMess = orig.mMess->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for Def. + */ +Def& +Def::operator=(const Def& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mLetter = rhs.mLetter; + delete mMess; + if (rhs.mMess != NULL) + { + mMess = rhs.mMess->clone(); + } + else + { + mMess = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Def object. + */ +Def* +Def::clone() const +{ + return new Def(*this); +} + + +/* + * Destructor for Def. + */ +Def::~Def() +{ + delete mMess; + mMess = NULL; +} + + +/* + * Returns the value of the "letter" attribute of this Def. + */ +const std::string& +Def::getLetter() const +{ + return mLetter; +} + + +/* + * Predicate returning @c true if this Def's "letter" attribute is set. + */ +bool +Def::isSetLetter() const +{ + return (mLetter.empty() == false); +} + + +/* + * Sets the value of the "letter" attribute of this Def. + */ +int +Def::setLetter(const std::string& letter) +{ + mLetter = letter; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "letter" attribute of this Def. + */ +int +Def::unsetLetter() +{ + mLetter.erase(); + + if (mLetter.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "mess" element of this Def. + */ +const XMLNode* +Def::getMess() const +{ + return mMess; +} + + +/* + * Returns the value of the "mess" element of this Def. + */ +XMLNode* +Def::getMess() +{ + return mMess; +} + + +/* + * Predicate returning @c true if this Def's "mess" element is set. + */ +bool +Def::isSetMess() const +{ + return (mMess != NULL); +} + + +/* + * Sets the value of the "mess" element of this Def. + */ +int +Def::setMess(const XMLNode* mess) +{ + if (mMess == mess) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (mess == NULL) + { + delete mMess; + mMess = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mMess; + mMess = (mess != NULL) ? mess->clone() : NULL; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "mess" element of this Def. + */ +int +Def::unsetMess() +{ + delete mMess; + mMess = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this Def object. + */ +const std::string& +Def::getElementName() const +{ + static const string name = "def"; + return name; +} + + +/* + * Returns the libSBML type code for this Def object. + */ +int +Def::getTypeCode() const +{ + return SBML_COPY_ABC; +} + + +/* + * Predicate returning @c true if all the required attributes for this Def + * object have been set. + */ +bool +Def::hasRequiredAttributes() const +{ + bool allPresent = true; + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Def::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetMess() == true) + { + stream.startElement("mess"); + stream << *mMess; + stream.endElement("mess"); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Def::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Def::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Def::connectToChild() +{ + SBase::connectToChild(); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Def::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +Def::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Def. + */ +int +Def::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Def. + */ +int +Def::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Def. + */ +int +Def::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Def. + */ +int +Def::getAttribute(const std::string& attributeName, unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Def. + */ +int +Def::getAttribute(const std::string& attributeName, std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "letter") + { + value = getLetter(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Def's attribute "attributeName" is set. + */ +bool +Def::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "letter") + { + value = isSetLetter(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Def. + */ +int +Def::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Def. + */ +int +Def::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Def. + */ +int +Def::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Def. + */ +int +Def::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Def. + */ +int +Def::setAttribute(const std::string& attributeName, const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "letter") + { + return_value = setLetter(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Def. + */ +int +Def::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "letter") + { + value = unsetLetter(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Def::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("letter"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Def::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("copy", CopyDefAllowedAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("copy", CopyDefAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } + + // + // letter string (use = "optional" ) + // + + assigned = attributes.readInto("letter", mLetter); + + if (assigned == true) + { + if (mLetter.empty() == true) + { + logEmptyString(mLetter, level, version, ""); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads other XML such as math/notes etc. + */ +bool +Def::readOtherXML(XMLInputStream& stream) +{ + bool read = false; + const string& name = stream.peek().getName(); + + if (name == "mess") + { + const XMLToken& token = stream.next(); + stream.skipText(); + delete mMess; + XMLNode* xml = new XMLNode(stream); + mMess = new XMLNode(*(static_cast(xml))); + stream.skipPastEnd(token); + delete xml; + read = true; + } + + if (SBase::readOtherXML(stream)) + { + read = true; + } + + return read; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Def::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetLetter() == true) + { + stream.writeAttribute("letter", getPrefix(), mLetter); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Def_t using the given SBML Level, Version and + * “copy” package version. + */ +LIBSBML_EXTERN +Def_t * +Def_create(unsigned int level, unsigned int version, unsigned int pkgVersion) +{ + return new Def(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Def_t object. + */ +LIBSBML_EXTERN +Def_t* +Def_clone(const Def_t* d) +{ + if (d != NULL) + { + return static_cast(d->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Def_t object. + */ +LIBSBML_EXTERN +void +Def_free(Def_t* d) +{ + if (d != NULL) + { + delete d; + } +} + + +/* + * Returns the value of the "letter" attribute of this Def_t. + */ +LIBSBML_EXTERN +char * +Def_getLetter(const Def_t * d) +{ + if (d == NULL) + { + return NULL; + } + + return d->getLetter().empty() ? NULL : safe_strdup(d->getLetter().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this Def_t's "letter" attribute is set. + */ +LIBSBML_EXTERN +int +Def_isSetLetter(const Def_t * d) +{ + return (d != NULL) ? static_cast(d->isSetLetter()) : 0; +} + + +/* + * Sets the value of the "letter" attribute of this Def_t. + */ +LIBSBML_EXTERN +int +Def_setLetter(Def_t * d, const char * letter) +{ + return (d != NULL) ? d->setLetter(letter) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "letter" attribute of this Def_t. + */ +LIBSBML_EXTERN +int +Def_unsetLetter(Def_t * d) +{ + return (d != NULL) ? d->unsetLetter() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "mess" element of this Def_t. + */ +LIBSBML_EXTERN +const XMLNode_t* +Def_getMess(const Def_t * d) +{ + if (d == NULL) + { + return NULL; + } + + return (XMLNode_t*)(d->getMess()); +} + + +/* + * Predicate returning @c 1 (true) if this Def_t's "mess" element is set. + */ +LIBSBML_EXTERN +int +Def_isSetMess(const Def_t * d) +{ + return (d != NULL) ? static_cast(d->isSetMess()) : 0; +} + + +/* + * Sets the value of the "mess" element of this Def_t. + */ +LIBSBML_EXTERN +int +Def_setMess(Def_t * d, const XMLNode_t* mess) +{ + return (d != NULL) ? d->setMess(mess) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "mess" element of this Def_t. + */ +LIBSBML_EXTERN +int +Def_unsetMess(Def_t * d) +{ + return (d != NULL) ? d->unsetMess() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Def_t object have been set. + */ +LIBSBML_EXTERN +int +Def_hasRequiredAttributes(const Def_t * d) +{ + return (d != NULL) ? static_cast(d->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Def.h b/generator/tests/test_cpp_code/test-code/Def.h index 69e4562f..5c1cd21d 100644 --- a/generator/tests/test_cpp_code/test-code/Def.h +++ b/generator/tests/test_cpp_code/test-code/Def.h @@ -1,875 +1,875 @@ -/** - * @file Def.h - * @brief Definition of the Def class. - * @author SBMLTeam - * - * - * - * @class Def - * @sbmlbrief{copy} TODO:Definition of the Def class. - */ - - -#ifndef Def_H__ -#define Def_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Def : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - std::string mLetter; - XMLNode* mMess; - - /** @endcond */ - -public: - - /** - * Creates a new Def using the given SBML Level, Version and - * “copy” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Def. - * - * @param version an unsigned int, the SBML Version to assign to this Def. - * - * @param pkgVersion an unsigned int, the SBML Copy Version to assign to this - * Def. - * - * @copydetails doc_note_setting_lv_pkg - */ - Def(unsigned int level = CopyExtension::getDefaultLevel(), - unsigned int version = CopyExtension::getDefaultVersion(), - unsigned int pkgVersion = CopyExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Def using the given CopyPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param copyns the CopyPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Def(CopyPkgNamespaces *copyns); - - - /** - * Copy constructor for Def. - * - * @param orig the Def instance to copy. - */ - Def(const Def& orig); - - - /** - * Assignment operator for Def. - * - * @param rhs the Def object whose values are to be used as the basis of the - * assignment. - */ - Def& operator=(const Def& rhs); - - - /** - * Creates and returns a deep copy of this Def object. - * - * @return a (deep) copy of this Def object. - */ - virtual Def* clone() const; - - - /** - * Destructor for Def. - */ - virtual ~Def(); - - - /** - * Returns the value of the "letter" attribute of this Def. - * - * @return the value of the "letter" attribute of this Def as a string. - */ - const std::string& getLetter() const; - - - /** - * Predicate returning @c true if this Def's "letter" attribute is set. - * - * @return @c true if this Def's "letter" attribute has been set, otherwise - * @c false is returned. - */ - bool isSetLetter() const; - - - /** - * Sets the value of the "letter" attribute of this Def. - * - * @param letter std::string& value of the "letter" attribute to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p letter = @c NULL or an empty string is - * equivalent to calling unsetLetter(). - */ - int setLetter(const std::string& letter); - - - /** - * Unsets the value of the "letter" attribute of this Def. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetLetter(); - - - /** - * Returns the value of the "mess" element of this Def. - * - * @return the value of the "mess" element of this Def as a XMLNode*. - */ - const XMLNode* getMess() const; - - - /** - * Returns the value of the "mess" element of this Def. - * - * @return the value of the "mess" element of this Def as a XMLNode*. - */ - XMLNode* getMess(); - - - /** - * Predicate returning @c true if this Def's "mess" element is set. - * - * @return @c true if this Def's "mess" element has been set, otherwise - * @c false is returned. - */ - bool isSetMess() const; - - - /** - * Sets the value of the "mess" element of this Def. - * - * @param mess XMLNode* value of the "mess" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setMess(const XMLNode* mess); - - - /** - * Unsets the value of the "mess" element of this Def. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetMess(); - - - /** - * Returns the XML element name of this Def object. - * - * For Def, the XML element name is always @c "def". - * - * @return the name of this element, i.e. @c "def". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Def object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_COPY_ABC, SBMLCopyTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this Def - * object have been set. - * - * @return @c true to indicate that all the required attributes of this Def - * have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Def's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Def's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Def. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads other XML such as math/notes etc. - */ - virtual bool readOtherXML(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Def_t using the given SBML Level, Version and - * “copy” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Def_t. - * - * @param version an unsigned int, the SBML Version to assign to this Def_t. - * - * @param pkgVersion an unsigned int, the SBML Copy Version to assign to this - * Def_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Def_t - */ -LIBSBML_EXTERN -Def_t * -Def_create(unsigned int level, unsigned int version, unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Def_t object. - * - * @param d the Def_t structure. - * - * @return a (deep) copy of this Def_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Def_t - */ -LIBSBML_EXTERN -Def_t* -Def_clone(const Def_t* d); - - -/** - * Frees this Def_t object. - * - * @param d the Def_t structure. - * - * @memberof Def_t - */ -LIBSBML_EXTERN -void -Def_free(Def_t* d); - - -/** - * Returns the value of the "letter" attribute of this Def_t. - * - * @param d the Def_t structure whose letter is sought. - * - * @return the value of the "letter" attribute of this Def_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Def_t - */ -LIBSBML_EXTERN -char * -Def_getLetter(const Def_t * d); - - -/** - * Predicate returning @c 1 (true) if this Def_t's "letter" attribute is set. - * - * @param d the Def_t structure. - * - * @return @c 1 (true) if this Def_t's "letter" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Def_t - */ -LIBSBML_EXTERN -int -Def_isSetLetter(const Def_t * d); - - -/** - * Sets the value of the "letter" attribute of this Def_t. - * - * @param d the Def_t structure. - * - * @param letter const char * value of the "letter" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p letter = @c NULL or an empty string is - * equivalent to calling Def_unsetLetter(). - * - * @memberof Def_t - */ -LIBSBML_EXTERN -int -Def_setLetter(Def_t * d, const char * letter); - - -/** - * Unsets the value of the "letter" attribute of this Def_t. - * - * @param d the Def_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Def_t - */ -LIBSBML_EXTERN -int -Def_unsetLetter(Def_t * d); - - -/** - * Returns the value of the "mess" element of this Def_t. - * - * @param d the Def_t structure whose mess is sought. - * - * @return the value of the "mess" element of this Def_t as a XMLNode*. - * - * @memberof Def_t - */ -LIBSBML_EXTERN -const XMLNode_t* -Def_getMess(const Def_t * d); - - -/** - * Predicate returning @c 1 (true) if this Def_t's "mess" element is set. - * - * @param d the Def_t structure. - * - * @return @c 1 (true) if this Def_t's "mess" element has been set, otherwise - * @c 0 (false) is returned. - * - * @memberof Def_t - */ -LIBSBML_EXTERN -int -Def_isSetMess(const Def_t * d); - - -/** - * Sets the value of the "mess" element of this Def_t. - * - * @param d the Def_t structure. - * - * @param mess XMLNode_t* value of the "mess" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Def_t - */ -LIBSBML_EXTERN -int -Def_setMess(Def_t * d, const XMLNode_t* mess); - - -/** - * Unsets the value of the "mess" element of this Def_t. - * - * @param d the Def_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Def_t - */ -LIBSBML_EXTERN -int -Def_unsetMess(Def_t * d); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Def_t object have been set. - * - * @param d the Def_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Def_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof Def_t - */ -LIBSBML_EXTERN -int -Def_hasRequiredAttributes(const Def_t * d); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Def_H__ */ - - +/** + * @file Def.h + * @brief Definition of the Def class. + * @author SBMLTeam + * + * + * + * @class Def + * @sbmlbrief{copy} TODO:Definition of the Def class. + */ + + +#ifndef Def_H__ +#define Def_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Def : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + std::string mLetter; + XMLNode* mMess; + + /** @endcond */ + +public: + + /** + * Creates a new Def using the given SBML Level, Version and + * “copy” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Def. + * + * @param version an unsigned int, the SBML Version to assign to this Def. + * + * @param pkgVersion an unsigned int, the SBML Copy Version to assign to this + * Def. + * + * @copydetails doc_note_setting_lv_pkg + */ + Def(unsigned int level = CopyExtension::getDefaultLevel(), + unsigned int version = CopyExtension::getDefaultVersion(), + unsigned int pkgVersion = CopyExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Def using the given CopyPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param copyns the CopyPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Def(CopyPkgNamespaces *copyns); + + + /** + * Copy constructor for Def. + * + * @param orig the Def instance to copy. + */ + Def(const Def& orig); + + + /** + * Assignment operator for Def. + * + * @param rhs the Def object whose values are to be used as the basis of the + * assignment. + */ + Def& operator=(const Def& rhs); + + + /** + * Creates and returns a deep copy of this Def object. + * + * @return a (deep) copy of this Def object. + */ + virtual Def* clone() const; + + + /** + * Destructor for Def. + */ + virtual ~Def(); + + + /** + * Returns the value of the "letter" attribute of this Def. + * + * @return the value of the "letter" attribute of this Def as a string. + */ + const std::string& getLetter() const; + + + /** + * Predicate returning @c true if this Def's "letter" attribute is set. + * + * @return @c true if this Def's "letter" attribute has been set, otherwise + * @c false is returned. + */ + bool isSetLetter() const; + + + /** + * Sets the value of the "letter" attribute of this Def. + * + * @param letter std::string& value of the "letter" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p letter = @c NULL or an empty string is + * equivalent to calling unsetLetter(). + */ + int setLetter(const std::string& letter); + + + /** + * Unsets the value of the "letter" attribute of this Def. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetLetter(); + + + /** + * Returns the value of the "mess" element of this Def. + * + * @return the value of the "mess" element of this Def as a XMLNode*. + */ + const XMLNode* getMess() const; + + + /** + * Returns the value of the "mess" element of this Def. + * + * @return the value of the "mess" element of this Def as a XMLNode*. + */ + XMLNode* getMess(); + + + /** + * Predicate returning @c true if this Def's "mess" element is set. + * + * @return @c true if this Def's "mess" element has been set, otherwise + * @c false is returned. + */ + bool isSetMess() const; + + + /** + * Sets the value of the "mess" element of this Def. + * + * @param mess XMLNode* value of the "mess" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setMess(const XMLNode* mess); + + + /** + * Unsets the value of the "mess" element of this Def. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetMess(); + + + /** + * Returns the XML element name of this Def object. + * + * For Def, the XML element name is always @c "def". + * + * @return the name of this element, i.e. @c "def". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Def object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_COPY_ABC, SBMLCopyTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this Def + * object have been set. + * + * @return @c true to indicate that all the required attributes of this Def + * have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Def's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Def's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Def. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads other XML such as math/notes etc. + */ + virtual bool readOtherXML(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Def_t using the given SBML Level, Version and + * “copy” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Def_t. + * + * @param version an unsigned int, the SBML Version to assign to this Def_t. + * + * @param pkgVersion an unsigned int, the SBML Copy Version to assign to this + * Def_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Def_t + */ +LIBSBML_EXTERN +Def_t * +Def_create(unsigned int level, unsigned int version, unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Def_t object. + * + * @param d the Def_t structure. + * + * @return a (deep) copy of this Def_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Def_t + */ +LIBSBML_EXTERN +Def_t* +Def_clone(const Def_t* d); + + +/** + * Frees this Def_t object. + * + * @param d the Def_t structure. + * + * @memberof Def_t + */ +LIBSBML_EXTERN +void +Def_free(Def_t* d); + + +/** + * Returns the value of the "letter" attribute of this Def_t. + * + * @param d the Def_t structure whose letter is sought. + * + * @return the value of the "letter" attribute of this Def_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Def_t + */ +LIBSBML_EXTERN +char * +Def_getLetter(const Def_t * d); + + +/** + * Predicate returning @c 1 (true) if this Def_t's "letter" attribute is set. + * + * @param d the Def_t structure. + * + * @return @c 1 (true) if this Def_t's "letter" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Def_t + */ +LIBSBML_EXTERN +int +Def_isSetLetter(const Def_t * d); + + +/** + * Sets the value of the "letter" attribute of this Def_t. + * + * @param d the Def_t structure. + * + * @param letter const char * value of the "letter" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p letter = @c NULL or an empty string is + * equivalent to calling Def_unsetLetter(). + * + * @memberof Def_t + */ +LIBSBML_EXTERN +int +Def_setLetter(Def_t * d, const char * letter); + + +/** + * Unsets the value of the "letter" attribute of this Def_t. + * + * @param d the Def_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Def_t + */ +LIBSBML_EXTERN +int +Def_unsetLetter(Def_t * d); + + +/** + * Returns the value of the "mess" element of this Def_t. + * + * @param d the Def_t structure whose mess is sought. + * + * @return the value of the "mess" element of this Def_t as a XMLNode*. + * + * @memberof Def_t + */ +LIBSBML_EXTERN +const XMLNode_t* +Def_getMess(const Def_t * d); + + +/** + * Predicate returning @c 1 (true) if this Def_t's "mess" element is set. + * + * @param d the Def_t structure. + * + * @return @c 1 (true) if this Def_t's "mess" element has been set, otherwise + * @c 0 (false) is returned. + * + * @memberof Def_t + */ +LIBSBML_EXTERN +int +Def_isSetMess(const Def_t * d); + + +/** + * Sets the value of the "mess" element of this Def_t. + * + * @param d the Def_t structure. + * + * @param mess XMLNode_t* value of the "mess" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Def_t + */ +LIBSBML_EXTERN +int +Def_setMess(Def_t * d, const XMLNode_t* mess); + + +/** + * Unsets the value of the "mess" element of this Def_t. + * + * @param d the Def_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Def_t + */ +LIBSBML_EXTERN +int +Def_unsetMess(Def_t * d); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Def_t object have been set. + * + * @param d the Def_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Def_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof Def_t + */ +LIBSBML_EXTERN +int +Def_hasRequiredAttributes(const Def_t * d); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Def_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/DefaultValues.cpp b/generator/tests/test_cpp_code/test-code/DefaultValues.cpp index d087d86c..b4fa3215 100644 --- a/generator/tests/test_cpp_code/test-code/DefaultValues.cpp +++ b/generator/tests/test_cpp_code/test-code/DefaultValues.cpp @@ -1,1416 +1,1416 @@ -/** - * @file DefaultValues.cpp - * @brief Implementation of the DefaultValues class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new DefaultValues using the given SBML Level, Version and - * “render” package version. - */ -DefaultValues::DefaultValues(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mStrokeWidth (util_NaN()) - , mIsSetStrokeWidth (false) - , mFontSize (NULL) - , mStartHead ("") -{ - setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new DefaultValues using the given RenderPkgNamespaces object. - */ -DefaultValues::DefaultValues(RenderPkgNamespaces *renderns) - : SBase(renderns) - , mStrokeWidth (util_NaN()) - , mIsSetStrokeWidth (false) - , mFontSize (NULL) - , mStartHead ("") -{ - setElementNamespace(renderns->getURI()); - connectToChild(); - loadPlugins(renderns); -} - - -/* - * Copy constructor for DefaultValues. - */ -DefaultValues::DefaultValues(const DefaultValues& orig) - : SBase( orig ) - , mStrokeWidth ( orig.mStrokeWidth ) - , mIsSetStrokeWidth ( orig.mIsSetStrokeWidth ) - , mFontSize ( NULL ) - , mStartHead ( orig.mStartHead ) -{ - if (orig.mFontSize != NULL) - { - mFontSize = orig.mFontSize->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for DefaultValues. - */ -DefaultValues& -DefaultValues::operator=(const DefaultValues& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mStrokeWidth = rhs.mStrokeWidth; - mIsSetStrokeWidth = rhs.mIsSetStrokeWidth; - mStartHead = rhs.mStartHead; - delete mFontSize; - if (rhs.mFontSize != NULL) - { - mFontSize = rhs.mFontSize->clone(); - } - else - { - mFontSize = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this DefaultValues object. - */ -DefaultValues* -DefaultValues::clone() const -{ - return new DefaultValues(*this); -} - - -/* - * Destructor for DefaultValues. - */ -DefaultValues::~DefaultValues() -{ - delete mFontSize; - mFontSize = NULL; -} - - -/* - * Returns the value of the "stroke-width" attribute of this DefaultValues. - */ -double -DefaultValues::getStrokeWidth() const -{ - return mStrokeWidth; -} - - -/* - * Returns the value of the "startHead" attribute of this DefaultValues. - */ -const std::string& -DefaultValues::getStartHead() const -{ - return mStartHead; -} - - -/* - * Predicate returning @c true if this DefaultValues's "stroke-width" attribute - * is set. - */ -bool -DefaultValues::isSetStrokeWidth() const -{ - return mIsSetStrokeWidth; -} - - -/* - * Predicate returning @c true if this DefaultValues's "startHead" attribute is - * set. - */ -bool -DefaultValues::isSetStartHead() const -{ - return (mStartHead.empty() == false); -} - - -/* - * Sets the value of the "stroke-width" attribute of this DefaultValues. - */ -int -DefaultValues::setStrokeWidth(double strokeWidth) -{ - mStrokeWidth = strokeWidth; - mIsSetStrokeWidth = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "startHead" attribute of this DefaultValues. - */ -int -DefaultValues::setStartHead(const std::string& startHead) -{ - if (!(SyntaxChecker::isValidInternalSId(startHead))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mStartHead = startHead; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "stroke-width" attribute of this DefaultValues. - */ -int -DefaultValues::unsetStrokeWidth() -{ - mStrokeWidth = util_NaN(); - mIsSetStrokeWidth = false; - - if (isSetStrokeWidth() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "startHead" attribute of this DefaultValues. - */ -int -DefaultValues::unsetStartHead() -{ - mStartHead.erase(); - - if (mStartHead.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "font-size" element of this DefaultValues. - */ -const RelAbsVector* -DefaultValues::getFontSize() const -{ - return mFontSize; -} - - -/* - * Returns the value of the "font-size" element of this DefaultValues. - */ -RelAbsVector* -DefaultValues::getFontSize() -{ - return mFontSize; -} - - -/* - * Predicate returning @c true if this DefaultValues's "font-size" element is - * set. - */ -bool -DefaultValues::isSetFontSize() const -{ - return (mFontSize != NULL); -} - - -/* - * Sets the value of the "font-size" element of this DefaultValues. - */ -int -DefaultValues::setFontSize(const RelAbsVector* fontSize) -{ - if (mFontSize == fontSize) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (fontSize == NULL) - { - delete mFontSize; - mFontSize = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mFontSize; - mFontSize = (fontSize != NULL) ? fontSize->clone() : NULL; - if (mFontSize != NULL) - { - mFontSize->setElementName("fontSize"); - mFontSize->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new RelAbsVector object, adds it to this DefaultValues object and - * returns the RelAbsVector object created. - */ -RelAbsVector* -DefaultValues::createFontSize() -{ - if (mFontSize != NULL) - { - delete mFontSize; - } - - RENDER_CREATE_NS(renderns, getSBMLNamespaces()); - mFontSize = new RelAbsVector(renderns); - - mFontSize->setElementName("font-size"); - - delete renderns; - - connectToChild(); - - return mFontSize; -} - - -/* - * Unsets the value of the "font-size" element of this DefaultValues. - */ -int -DefaultValues::unsetFontSize() -{ - delete mFontSize; - mFontSize = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -DefaultValues::renameSIdRefs(const std::string& oldid, - const std::string& newid) -{ - if (isSetStartHead() && mStartHead == oldid) - { - setStartHead(newid); - } -} - - -/* - * Returns the XML element name of this DefaultValues object. - */ -const std::string& -DefaultValues::getElementName() const -{ - static const string name = "defaultValues"; - return name; -} - - -/* - * Returns the libSBML type code for this DefaultValues object. - */ -int -DefaultValues::getTypeCode() const -{ - return SBML_RENDER_DEFAULTS; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * DefaultValues object have been set. - */ -bool -DefaultValues::hasRequiredAttributes() const -{ - bool allPresent = true; - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -DefaultValues::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetFontSize() == true) - { - mFontSize->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -DefaultValues::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mFontSize != NULL) - { - mFontSize->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -DefaultValues::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mFontSize != NULL) - { - mFontSize->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -DefaultValues::connectToChild() -{ - SBase::connectToChild(); - - if (mFontSize != NULL) - { - mFontSize->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -DefaultValues::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetFontSize()) - { - mFontSize->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -DefaultValues::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mFontSize != NULL) - { - mFontSize->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "stroke-width") - { - value = getStrokeWidth(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "startHead") - { - value = getStartHead(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this DefaultValues's attribute - * "attributeName" is set. - */ -bool -DefaultValues::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "stroke-width") - { - value = isSetStrokeWidth(); - } - else if (attributeName == "startHead") - { - value = isSetStartHead(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "stroke-width") - { - return_value = setStrokeWidth(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "startHead") - { - return_value = setStartHead(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this DefaultValues. - */ -int -DefaultValues::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "stroke-width") - { - value = unsetStrokeWidth(); - } - else if (attributeName == "startHead") - { - value = unsetStartHead(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this DefaultValues. - */ -SBase* -DefaultValues::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "font-size") - { - return createFontSize(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this DefaultValues. - */ -int -DefaultValues::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "font-size" && element->getTypeCode() == - SBML_RENDER_RELABSVECTOR) - { - return setFontSize((const RelAbsVector*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * DefaultValues. - */ -SBase* -DefaultValues::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "font-size") - { - RelAbsVector * obj = mFontSize; - mFontSize = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this DefaultValues. - */ -unsigned int -DefaultValues::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "font-size") - { - if (isSetFontSize()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this DefaultValues. - */ -SBase* -DefaultValues::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "font-size") - { - return getFontSize(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -DefaultValues::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mFontSize != NULL) - { - if (mFontSize->getId() == id) - { - return mFontSize; - } - - obj = mFontSize->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -DefaultValues::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mFontSize != NULL) - { - if (mFontSize->getMetaId() == metaid) - { - return mFontSize; - } - - obj = mFontSize->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -DefaultValues::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mFontSize, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -DefaultValues::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - RENDER_CREATE_NS(renderns, getSBMLNamespaces()); - - if (name == "font-size") - { - if (getErrorLog() && isSetFontSize()) - { - getErrorLog()->logPackageError("render", - RenderDefaultValuesAllowedAttributes, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mFontSize; - mFontSize = new RelAbsVector(renderns); - mFontSize->setElementName(name); - obj = mFontSize; - } - - delete renderns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -DefaultValues::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("stroke-width"); - - attributes.add("startHead"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -DefaultValues::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("render", RenderDefaultValuesAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("render", - RenderDefaultValuesAllowedCoreAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - } - } - - // - // stroke-width double (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetStrokeWidth = attributes.readInto("stroke-width", mStrokeWidth); - - if ( mIsSetStrokeWidth == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Render attribute 'stroke-width' from the " - " element must be an integer."; - log->logPackageError("render", - RenderDefaultValuesStrokeWidthMustBeDouble, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // startHead SIdRef (use = "optional" ) - // - - assigned = attributes.readInto("startHead", mStartHead); - - if (assigned == true) - { - if (mStartHead.empty() == true) - { - logEmptyString(mStartHead, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mStartHead) == false) - { - std::string msg = "The startHead attribute on the <" + getElementName() + - ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mStartHead + "', which does not conform to the syntax."; - log->logPackageError("render", - RenderDefaultValuesStartHeadMustBeLineEnding, pkgVersion, level, version, - msg, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -DefaultValues::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetStrokeWidth() == true) - { - stream.writeAttribute("stroke-width", getPrefix(), mStrokeWidth); - } - - if (isSetStartHead() == true) - { - stream.writeAttribute("startHead", getPrefix(), mStartHead); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new DefaultValues_t using the given SBML Level, Version and - * “render” package version. - */ -LIBSBML_EXTERN -DefaultValues_t * -DefaultValues_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new DefaultValues(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this DefaultValues_t object. - */ -LIBSBML_EXTERN -DefaultValues_t* -DefaultValues_clone(const DefaultValues_t* dv) -{ - if (dv != NULL) - { - return static_cast(dv->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this DefaultValues_t object. - */ -LIBSBML_EXTERN -void -DefaultValues_free(DefaultValues_t* dv) -{ - if (dv != NULL) - { - delete dv; - } -} - - -/* - * Returns the value of the "stroke-width" attribute of this DefaultValues_t. - */ -LIBSBML_EXTERN -double -DefaultValues_getStrokeWidth(const DefaultValues_t * dv) -{ - return (dv != NULL) ? dv->getStrokeWidth() : util_NaN(); -} - - -/* - * Returns the value of the "startHead" attribute of this DefaultValues_t. - */ -LIBSBML_EXTERN -char * -DefaultValues_getStartHead(const DefaultValues_t * dv) -{ - if (dv == NULL) - { - return NULL; - } - - return dv->getStartHead().empty() ? NULL : - safe_strdup(dv->getStartHead().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this DefaultValues_t's "stroke-width" - * attribute is set. - */ -LIBSBML_EXTERN -int -DefaultValues_isSetStrokeWidth(const DefaultValues_t * dv) -{ - return (dv != NULL) ? static_cast(dv->isSetStrokeWidth()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this DefaultValues_t's "startHead" - * attribute is set. - */ -LIBSBML_EXTERN -int -DefaultValues_isSetStartHead(const DefaultValues_t * dv) -{ - return (dv != NULL) ? static_cast(dv->isSetStartHead()) : 0; -} - - -/* - * Sets the value of the "stroke-width" attribute of this DefaultValues_t. - */ -LIBSBML_EXTERN -int -DefaultValues_setStrokeWidth(DefaultValues_t * dv, double strokeWidth) -{ - return (dv != NULL) ? dv->setStrokeWidth(strokeWidth) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "startHead" attribute of this DefaultValues_t. - */ -LIBSBML_EXTERN -int -DefaultValues_setStartHead(DefaultValues_t * dv, const char * startHead) -{ - return (dv != NULL) ? dv->setStartHead(startHead) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "stroke-width" attribute of this DefaultValues_t. - */ -LIBSBML_EXTERN -int -DefaultValues_unsetStrokeWidth(DefaultValues_t * dv) -{ - return (dv != NULL) ? dv->unsetStrokeWidth() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "startHead" attribute of this DefaultValues_t. - */ -LIBSBML_EXTERN -int -DefaultValues_unsetStartHead(DefaultValues_t * dv) -{ - return (dv != NULL) ? dv->unsetStartHead() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "font-size" element of this DefaultValues_t. - */ -LIBSBML_EXTERN -const RelAbsVector_t* -DefaultValues_getFontSize(const DefaultValues_t * dv) -{ - if (dv == NULL) - { - return NULL; - } - - return (RelAbsVector_t*)(dv->getFontSize()); -} - - -/* - * Predicate returning @c 1 (true) if this DefaultValues_t's "font-size" - * element is set. - */ -LIBSBML_EXTERN -int -DefaultValues_isSetFontSize(const DefaultValues_t * dv) -{ - return (dv != NULL) ? static_cast(dv->isSetFontSize()) : 0; -} - - -/* - * Sets the value of the "font-size" element of this DefaultValues_t. - */ -LIBSBML_EXTERN -int -DefaultValues_setFontSize(DefaultValues_t * dv, - const RelAbsVector_t* fontSize) -{ - return (dv != NULL) ? dv->setFontSize(fontSize) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new RelAbsVector_t object, adds it to this DefaultValues_t object - * and returns the RelAbsVector_t object created. - */ -LIBSBML_EXTERN -RelAbsVector_t* -DefaultValues_createFontSize(DefaultValues_t* dv) -{ - if (dv == NULL) - { - return NULL; - } - - return (RelAbsVector_t*)(dv->createFontSize()); -} - - -/* - * Unsets the value of the "font-size" element of this DefaultValues_t. - */ -LIBSBML_EXTERN -int -DefaultValues_unsetFontSize(DefaultValues_t * dv) -{ - return (dv != NULL) ? dv->unsetFontSize() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * DefaultValues_t object have been set. - */ -LIBSBML_EXTERN -int -DefaultValues_hasRequiredAttributes(const DefaultValues_t * dv) -{ - return (dv != NULL) ? static_cast(dv->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file DefaultValues.cpp + * @brief Implementation of the DefaultValues class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new DefaultValues using the given SBML Level, Version and + * “render” package version. + */ +DefaultValues::DefaultValues(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mStrokeWidth (util_NaN()) + , mIsSetStrokeWidth (false) + , mFontSize (NULL) + , mStartHead ("") +{ + setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new DefaultValues using the given RenderPkgNamespaces object. + */ +DefaultValues::DefaultValues(RenderPkgNamespaces *renderns) + : SBase(renderns) + , mStrokeWidth (util_NaN()) + , mIsSetStrokeWidth (false) + , mFontSize (NULL) + , mStartHead ("") +{ + setElementNamespace(renderns->getURI()); + connectToChild(); + loadPlugins(renderns); +} + + +/* + * Copy constructor for DefaultValues. + */ +DefaultValues::DefaultValues(const DefaultValues& orig) + : SBase( orig ) + , mStrokeWidth ( orig.mStrokeWidth ) + , mIsSetStrokeWidth ( orig.mIsSetStrokeWidth ) + , mFontSize ( NULL ) + , mStartHead ( orig.mStartHead ) +{ + if (orig.mFontSize != NULL) + { + mFontSize = orig.mFontSize->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for DefaultValues. + */ +DefaultValues& +DefaultValues::operator=(const DefaultValues& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mStrokeWidth = rhs.mStrokeWidth; + mIsSetStrokeWidth = rhs.mIsSetStrokeWidth; + mStartHead = rhs.mStartHead; + delete mFontSize; + if (rhs.mFontSize != NULL) + { + mFontSize = rhs.mFontSize->clone(); + } + else + { + mFontSize = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this DefaultValues object. + */ +DefaultValues* +DefaultValues::clone() const +{ + return new DefaultValues(*this); +} + + +/* + * Destructor for DefaultValues. + */ +DefaultValues::~DefaultValues() +{ + delete mFontSize; + mFontSize = NULL; +} + + +/* + * Returns the value of the "stroke-width" attribute of this DefaultValues. + */ +double +DefaultValues::getStrokeWidth() const +{ + return mStrokeWidth; +} + + +/* + * Returns the value of the "startHead" attribute of this DefaultValues. + */ +const std::string& +DefaultValues::getStartHead() const +{ + return mStartHead; +} + + +/* + * Predicate returning @c true if this DefaultValues's "stroke-width" attribute + * is set. + */ +bool +DefaultValues::isSetStrokeWidth() const +{ + return mIsSetStrokeWidth; +} + + +/* + * Predicate returning @c true if this DefaultValues's "startHead" attribute is + * set. + */ +bool +DefaultValues::isSetStartHead() const +{ + return (mStartHead.empty() == false); +} + + +/* + * Sets the value of the "stroke-width" attribute of this DefaultValues. + */ +int +DefaultValues::setStrokeWidth(double strokeWidth) +{ + mStrokeWidth = strokeWidth; + mIsSetStrokeWidth = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "startHead" attribute of this DefaultValues. + */ +int +DefaultValues::setStartHead(const std::string& startHead) +{ + if (!(SyntaxChecker::isValidInternalSId(startHead))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mStartHead = startHead; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "stroke-width" attribute of this DefaultValues. + */ +int +DefaultValues::unsetStrokeWidth() +{ + mStrokeWidth = util_NaN(); + mIsSetStrokeWidth = false; + + if (isSetStrokeWidth() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "startHead" attribute of this DefaultValues. + */ +int +DefaultValues::unsetStartHead() +{ + mStartHead.erase(); + + if (mStartHead.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "font-size" element of this DefaultValues. + */ +const RelAbsVector* +DefaultValues::getFontSize() const +{ + return mFontSize; +} + + +/* + * Returns the value of the "font-size" element of this DefaultValues. + */ +RelAbsVector* +DefaultValues::getFontSize() +{ + return mFontSize; +} + + +/* + * Predicate returning @c true if this DefaultValues's "font-size" element is + * set. + */ +bool +DefaultValues::isSetFontSize() const +{ + return (mFontSize != NULL); +} + + +/* + * Sets the value of the "font-size" element of this DefaultValues. + */ +int +DefaultValues::setFontSize(const RelAbsVector* fontSize) +{ + if (mFontSize == fontSize) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (fontSize == NULL) + { + delete mFontSize; + mFontSize = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mFontSize; + mFontSize = (fontSize != NULL) ? fontSize->clone() : NULL; + if (mFontSize != NULL) + { + mFontSize->setElementName("fontSize"); + mFontSize->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new RelAbsVector object, adds it to this DefaultValues object and + * returns the RelAbsVector object created. + */ +RelAbsVector* +DefaultValues::createFontSize() +{ + if (mFontSize != NULL) + { + delete mFontSize; + } + + RENDER_CREATE_NS(renderns, getSBMLNamespaces()); + mFontSize = new RelAbsVector(renderns); + + mFontSize->setElementName("font-size"); + + delete renderns; + + connectToChild(); + + return mFontSize; +} + + +/* + * Unsets the value of the "font-size" element of this DefaultValues. + */ +int +DefaultValues::unsetFontSize() +{ + delete mFontSize; + mFontSize = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +DefaultValues::renameSIdRefs(const std::string& oldid, + const std::string& newid) +{ + if (isSetStartHead() && mStartHead == oldid) + { + setStartHead(newid); + } +} + + +/* + * Returns the XML element name of this DefaultValues object. + */ +const std::string& +DefaultValues::getElementName() const +{ + static const string name = "defaultValues"; + return name; +} + + +/* + * Returns the libSBML type code for this DefaultValues object. + */ +int +DefaultValues::getTypeCode() const +{ + return SBML_RENDER_DEFAULTS; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * DefaultValues object have been set. + */ +bool +DefaultValues::hasRequiredAttributes() const +{ + bool allPresent = true; + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +DefaultValues::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetFontSize() == true) + { + mFontSize->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +DefaultValues::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mFontSize != NULL) + { + mFontSize->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +DefaultValues::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mFontSize != NULL) + { + mFontSize->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +DefaultValues::connectToChild() +{ + SBase::connectToChild(); + + if (mFontSize != NULL) + { + mFontSize->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +DefaultValues::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetFontSize()) + { + mFontSize->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +DefaultValues::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mFontSize != NULL) + { + mFontSize->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "stroke-width") + { + value = getStrokeWidth(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "startHead") + { + value = getStartHead(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this DefaultValues's attribute + * "attributeName" is set. + */ +bool +DefaultValues::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "stroke-width") + { + value = isSetStrokeWidth(); + } + else if (attributeName == "startHead") + { + value = isSetStartHead(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "stroke-width") + { + return_value = setStrokeWidth(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "startHead") + { + return_value = setStartHead(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this DefaultValues. + */ +int +DefaultValues::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "stroke-width") + { + value = unsetStrokeWidth(); + } + else if (attributeName == "startHead") + { + value = unsetStartHead(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this DefaultValues. + */ +SBase* +DefaultValues::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "font-size") + { + return createFontSize(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this DefaultValues. + */ +int +DefaultValues::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "font-size" && element->getTypeCode() == + SBML_RENDER_RELABSVECTOR) + { + return setFontSize((const RelAbsVector*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * DefaultValues. + */ +SBase* +DefaultValues::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "font-size") + { + RelAbsVector * obj = mFontSize; + mFontSize = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this DefaultValues. + */ +unsigned int +DefaultValues::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "font-size") + { + if (isSetFontSize()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this DefaultValues. + */ +SBase* +DefaultValues::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "font-size") + { + return getFontSize(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +DefaultValues::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mFontSize != NULL) + { + if (mFontSize->getId() == id) + { + return mFontSize; + } + + obj = mFontSize->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +DefaultValues::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mFontSize != NULL) + { + if (mFontSize->getMetaId() == metaid) + { + return mFontSize; + } + + obj = mFontSize->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +DefaultValues::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mFontSize, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +DefaultValues::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + RENDER_CREATE_NS(renderns, getSBMLNamespaces()); + + if (name == "font-size") + { + if (getErrorLog() && isSetFontSize()) + { + getErrorLog()->logPackageError("render", + RenderDefaultValuesAllowedAttributes, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mFontSize; + mFontSize = new RelAbsVector(renderns); + mFontSize->setElementName(name); + obj = mFontSize; + } + + delete renderns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +DefaultValues::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("stroke-width"); + + attributes.add("startHead"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +DefaultValues::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("render", RenderDefaultValuesAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("render", + RenderDefaultValuesAllowedCoreAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + } + } + + // + // stroke-width double (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetStrokeWidth = attributes.readInto("stroke-width", mStrokeWidth); + + if ( mIsSetStrokeWidth == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Render attribute 'stroke-width' from the " + " element must be an integer."; + log->logPackageError("render", + RenderDefaultValuesStrokeWidthMustBeDouble, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // startHead SIdRef (use = "optional" ) + // + + assigned = attributes.readInto("startHead", mStartHead); + + if (assigned == true) + { + if (mStartHead.empty() == true) + { + logEmptyString(mStartHead, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mStartHead) == false) + { + std::string msg = "The startHead attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mStartHead + "', which does not conform to the syntax."; + log->logPackageError("render", + RenderDefaultValuesStartHeadMustBeLineEnding, pkgVersion, level, version, + msg, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +DefaultValues::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetStrokeWidth() == true) + { + stream.writeAttribute("stroke-width", getPrefix(), mStrokeWidth); + } + + if (isSetStartHead() == true) + { + stream.writeAttribute("startHead", getPrefix(), mStartHead); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new DefaultValues_t using the given SBML Level, Version and + * “render” package version. + */ +LIBSBML_EXTERN +DefaultValues_t * +DefaultValues_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new DefaultValues(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this DefaultValues_t object. + */ +LIBSBML_EXTERN +DefaultValues_t* +DefaultValues_clone(const DefaultValues_t* dv) +{ + if (dv != NULL) + { + return static_cast(dv->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this DefaultValues_t object. + */ +LIBSBML_EXTERN +void +DefaultValues_free(DefaultValues_t* dv) +{ + if (dv != NULL) + { + delete dv; + } +} + + +/* + * Returns the value of the "stroke-width" attribute of this DefaultValues_t. + */ +LIBSBML_EXTERN +double +DefaultValues_getStrokeWidth(const DefaultValues_t * dv) +{ + return (dv != NULL) ? dv->getStrokeWidth() : util_NaN(); +} + + +/* + * Returns the value of the "startHead" attribute of this DefaultValues_t. + */ +LIBSBML_EXTERN +char * +DefaultValues_getStartHead(const DefaultValues_t * dv) +{ + if (dv == NULL) + { + return NULL; + } + + return dv->getStartHead().empty() ? NULL : + safe_strdup(dv->getStartHead().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this DefaultValues_t's "stroke-width" + * attribute is set. + */ +LIBSBML_EXTERN +int +DefaultValues_isSetStrokeWidth(const DefaultValues_t * dv) +{ + return (dv != NULL) ? static_cast(dv->isSetStrokeWidth()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this DefaultValues_t's "startHead" + * attribute is set. + */ +LIBSBML_EXTERN +int +DefaultValues_isSetStartHead(const DefaultValues_t * dv) +{ + return (dv != NULL) ? static_cast(dv->isSetStartHead()) : 0; +} + + +/* + * Sets the value of the "stroke-width" attribute of this DefaultValues_t. + */ +LIBSBML_EXTERN +int +DefaultValues_setStrokeWidth(DefaultValues_t * dv, double strokeWidth) +{ + return (dv != NULL) ? dv->setStrokeWidth(strokeWidth) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "startHead" attribute of this DefaultValues_t. + */ +LIBSBML_EXTERN +int +DefaultValues_setStartHead(DefaultValues_t * dv, const char * startHead) +{ + return (dv != NULL) ? dv->setStartHead(startHead) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "stroke-width" attribute of this DefaultValues_t. + */ +LIBSBML_EXTERN +int +DefaultValues_unsetStrokeWidth(DefaultValues_t * dv) +{ + return (dv != NULL) ? dv->unsetStrokeWidth() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "startHead" attribute of this DefaultValues_t. + */ +LIBSBML_EXTERN +int +DefaultValues_unsetStartHead(DefaultValues_t * dv) +{ + return (dv != NULL) ? dv->unsetStartHead() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "font-size" element of this DefaultValues_t. + */ +LIBSBML_EXTERN +const RelAbsVector_t* +DefaultValues_getFontSize(const DefaultValues_t * dv) +{ + if (dv == NULL) + { + return NULL; + } + + return (RelAbsVector_t*)(dv->getFontSize()); +} + + +/* + * Predicate returning @c 1 (true) if this DefaultValues_t's "font-size" + * element is set. + */ +LIBSBML_EXTERN +int +DefaultValues_isSetFontSize(const DefaultValues_t * dv) +{ + return (dv != NULL) ? static_cast(dv->isSetFontSize()) : 0; +} + + +/* + * Sets the value of the "font-size" element of this DefaultValues_t. + */ +LIBSBML_EXTERN +int +DefaultValues_setFontSize(DefaultValues_t * dv, + const RelAbsVector_t* fontSize) +{ + return (dv != NULL) ? dv->setFontSize(fontSize) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new RelAbsVector_t object, adds it to this DefaultValues_t object + * and returns the RelAbsVector_t object created. + */ +LIBSBML_EXTERN +RelAbsVector_t* +DefaultValues_createFontSize(DefaultValues_t* dv) +{ + if (dv == NULL) + { + return NULL; + } + + return (RelAbsVector_t*)(dv->createFontSize()); +} + + +/* + * Unsets the value of the "font-size" element of this DefaultValues_t. + */ +LIBSBML_EXTERN +int +DefaultValues_unsetFontSize(DefaultValues_t * dv) +{ + return (dv != NULL) ? dv->unsetFontSize() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * DefaultValues_t object have been set. + */ +LIBSBML_EXTERN +int +DefaultValues_hasRequiredAttributes(const DefaultValues_t * dv) +{ + return (dv != NULL) ? static_cast(dv->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/DefaultValues.h b/generator/tests/test_cpp_code/test-code/DefaultValues.h index 07290c62..1bb6cc16 100644 --- a/generator/tests/test_cpp_code/test-code/DefaultValues.h +++ b/generator/tests/test_cpp_code/test-code/DefaultValues.h @@ -1,1150 +1,1150 @@ -/** - * @file DefaultValues.h - * @brief Definition of the DefaultValues class. - * @author SBMLTeam - * - * - * - * @class DefaultValues - * @sbmlbrief{render} TODO:Definition of the DefaultValues class. - */ - - -#ifndef DefaultValues_H__ -#define DefaultValues_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN DefaultValues : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - double mStrokeWidth; - bool mIsSetStrokeWidth; - RelAbsVector* mFontSize; - std::string mStartHead; - - /** @endcond */ - -public: - - /** - * Creates a new DefaultValues using the given SBML Level, Version and - * “render” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * DefaultValues. - * - * @param version an unsigned int, the SBML Version to assign to this - * DefaultValues. - * - * @param pkgVersion an unsigned int, the SBML Render Version to assign to - * this DefaultValues. - * - * @copydetails doc_note_setting_lv_pkg - */ - DefaultValues(unsigned int level = RenderExtension::getDefaultLevel(), - unsigned int version = RenderExtension::getDefaultVersion(), - unsigned int pkgVersion = - RenderExtension::getDefaultPackageVersion()); - - - /** - * Creates a new DefaultValues using the given RenderPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param renderns the RenderPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - DefaultValues(RenderPkgNamespaces *renderns); - - - /** - * Copy constructor for DefaultValues. - * - * @param orig the DefaultValues instance to copy. - */ - DefaultValues(const DefaultValues& orig); - - - /** - * Assignment operator for DefaultValues. - * - * @param rhs the DefaultValues object whose values are to be used as the - * basis of the assignment. - */ - DefaultValues& operator=(const DefaultValues& rhs); - - - /** - * Creates and returns a deep copy of this DefaultValues object. - * - * @return a (deep) copy of this DefaultValues object. - */ - virtual DefaultValues* clone() const; - - - /** - * Destructor for DefaultValues. - */ - virtual ~DefaultValues(); - - - /** - * Returns the value of the "stroke-width" attribute of this DefaultValues. - * - * @return the value of the "stroke-width" attribute of this DefaultValues as - * a double. - */ - double getStrokeWidth() const; - - - /** - * Returns the value of the "startHead" attribute of this DefaultValues. - * - * @return the value of the "startHead" attribute of this DefaultValues as a - * string. - */ - const std::string& getStartHead() const; - - - /** - * Predicate returning @c true if this DefaultValues's "stroke-width" - * attribute is set. - * - * @return @c true if this DefaultValues's "stroke-width" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetStrokeWidth() const; - - - /** - * Predicate returning @c true if this DefaultValues's "startHead" attribute - * is set. - * - * @return @c true if this DefaultValues's "startHead" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetStartHead() const; - - - /** - * Sets the value of the "stroke-width" attribute of this DefaultValues. - * - * @param strokeWidth double value of the "stroke-width" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setStrokeWidth(double strokeWidth); - - - /** - * Sets the value of the "startHead" attribute of this DefaultValues. - * - * @param startHead std::string& value of the "startHead" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setStartHead(const std::string& startHead); - - - /** - * Unsets the value of the "stroke-width" attribute of this DefaultValues. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetStrokeWidth(); - - - /** - * Unsets the value of the "startHead" attribute of this DefaultValues. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetStartHead(); - - - /** - * Returns the value of the "font-size" element of this DefaultValues. - * - * @return the value of the "font-size" element of this DefaultValues as a - * RelAbsVector*. - */ - const RelAbsVector* getFontSize() const; - - - /** - * Returns the value of the "font-size" element of this DefaultValues. - * - * @return the value of the "font-size" element of this DefaultValues as a - * RelAbsVector*. - */ - RelAbsVector* getFontSize(); - - - /** - * Predicate returning @c true if this DefaultValues's "font-size" element is - * set. - * - * @return @c true if this DefaultValues's "font-size" element has been set, - * otherwise @c false is returned. - */ - bool isSetFontSize() const; - - - /** - * Sets the value of the "font-size" element of this DefaultValues. - * - * @param fontSize RelAbsVector* value of the "font-size" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setFontSize(const RelAbsVector* fontSize); - - - /** - * Creates a new RelAbsVector object, adds it to this DefaultValues object - * and returns the RelAbsVector object created. - * - * @return a new RelAbsVector object instance. - */ - RelAbsVector* createFontSize(); - - - /** - * Unsets the value of the "font-size" element of this DefaultValues. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetFontSize(); - - - /** - * @copydoc doc_renamesidref_common - */ - virtual void renameSIdRefs(const std::string& oldid, - const std::string& newid); - - - /** - * Returns the XML element name of this DefaultValues object. - * - * For DefaultValues, the XML element name is always @c "defaultValues". - * - * @return the name of this element, i.e. @c "defaultValues". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this DefaultValues object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_RENDER_DEFAULTS, SBMLRenderTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * DefaultValues object have been set. - * - * @return @c true to indicate that all the required attributes of this - * DefaultValues have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this DefaultValues's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this DefaultValues's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this DefaultValues. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this DefaultValues. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this DefaultValues. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * DefaultValues. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this DefaultValues. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this DefaultValues. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new DefaultValues_t using the given SBML Level, Version and - * “render” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * DefaultValues_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * DefaultValues_t. - * - * @param pkgVersion an unsigned int, the SBML Render Version to assign to this - * DefaultValues_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -DefaultValues_t * -DefaultValues_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this DefaultValues_t object. - * - * @param dv the DefaultValues_t structure. - * - * @return a (deep) copy of this DefaultValues_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -DefaultValues_t* -DefaultValues_clone(const DefaultValues_t* dv); - - -/** - * Frees this DefaultValues_t object. - * - * @param dv the DefaultValues_t structure. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -void -DefaultValues_free(DefaultValues_t* dv); - - -/** - * Returns the value of the "stroke-width" attribute of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure whose stroke-width is sought. - * - * @return the value of the "stroke-width" attribute of this DefaultValues_t as - * a double. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -double -DefaultValues_getStrokeWidth(const DefaultValues_t * dv); - - -/** - * Returns the value of the "startHead" attribute of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure whose startHead is sought. - * - * @return the value of the "startHead" attribute of this DefaultValues_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -char * -DefaultValues_getStartHead(const DefaultValues_t * dv); - - -/** - * Predicate returning @c 1 (true) if this DefaultValues_t's "stroke-width" - * attribute is set. - * - * @param dv the DefaultValues_t structure. - * - * @return @c 1 (true) if this DefaultValues_t's "stroke-width" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_isSetStrokeWidth(const DefaultValues_t * dv); - - -/** - * Predicate returning @c 1 (true) if this DefaultValues_t's "startHead" - * attribute is set. - * - * @param dv the DefaultValues_t structure. - * - * @return @c 1 (true) if this DefaultValues_t's "startHead" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_isSetStartHead(const DefaultValues_t * dv); - - -/** - * Sets the value of the "stroke-width" attribute of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure. - * - * @param strokeWidth double value of the "stroke-width" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_setStrokeWidth(DefaultValues_t * dv, double strokeWidth); - - -/** - * Sets the value of the "startHead" attribute of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure. - * - * @param startHead const char * value of the "startHead" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_setStartHead(DefaultValues_t * dv, const char * startHead); - - -/** - * Unsets the value of the "stroke-width" attribute of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_unsetStrokeWidth(DefaultValues_t * dv); - - -/** - * Unsets the value of the "startHead" attribute of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_unsetStartHead(DefaultValues_t * dv); - - -/** - * Returns the value of the "font-size" element of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure whose font-size is sought. - * - * @return the value of the "font-size" element of this DefaultValues_t as a - * RelAbsVector*. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -const RelAbsVector_t* -DefaultValues_getFontSize(const DefaultValues_t * dv); - - -/** - * Predicate returning @c 1 (true) if this DefaultValues_t's "font-size" - * element is set. - * - * @param dv the DefaultValues_t structure. - * - * @return @c 1 (true) if this DefaultValues_t's "font-size" element has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_isSetFontSize(const DefaultValues_t * dv); - - -/** - * Sets the value of the "font-size" element of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure. - * - * @param fontSize RelAbsVector_t* value of the "font-size" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_setFontSize(DefaultValues_t * dv, - const RelAbsVector_t* fontSize); - - -/** - * Creates a new RelAbsVector_t object, adds it to this DefaultValues_t object - * and returns the RelAbsVector_t object created. - * - * @param dv the DefaultValues_t structure to which the RelAbsVector_t should - * be added. - * - * @return a new RelAbsVector_t object instance. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -RelAbsVector_t* -DefaultValues_createFontSize(DefaultValues_t* dv); - - -/** - * Unsets the value of the "font-size" element of this DefaultValues_t. - * - * @param dv the DefaultValues_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_unsetFontSize(DefaultValues_t * dv); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * DefaultValues_t object have been set. - * - * @param dv the DefaultValues_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * DefaultValues_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof DefaultValues_t - */ -LIBSBML_EXTERN -int -DefaultValues_hasRequiredAttributes(const DefaultValues_t * dv); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !DefaultValues_H__ */ - - +/** + * @file DefaultValues.h + * @brief Definition of the DefaultValues class. + * @author SBMLTeam + * + * + * + * @class DefaultValues + * @sbmlbrief{render} TODO:Definition of the DefaultValues class. + */ + + +#ifndef DefaultValues_H__ +#define DefaultValues_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN DefaultValues : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + double mStrokeWidth; + bool mIsSetStrokeWidth; + RelAbsVector* mFontSize; + std::string mStartHead; + + /** @endcond */ + +public: + + /** + * Creates a new DefaultValues using the given SBML Level, Version and + * “render” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * DefaultValues. + * + * @param version an unsigned int, the SBML Version to assign to this + * DefaultValues. + * + * @param pkgVersion an unsigned int, the SBML Render Version to assign to + * this DefaultValues. + * + * @copydetails doc_note_setting_lv_pkg + */ + DefaultValues(unsigned int level = RenderExtension::getDefaultLevel(), + unsigned int version = RenderExtension::getDefaultVersion(), + unsigned int pkgVersion = + RenderExtension::getDefaultPackageVersion()); + + + /** + * Creates a new DefaultValues using the given RenderPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param renderns the RenderPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + DefaultValues(RenderPkgNamespaces *renderns); + + + /** + * Copy constructor for DefaultValues. + * + * @param orig the DefaultValues instance to copy. + */ + DefaultValues(const DefaultValues& orig); + + + /** + * Assignment operator for DefaultValues. + * + * @param rhs the DefaultValues object whose values are to be used as the + * basis of the assignment. + */ + DefaultValues& operator=(const DefaultValues& rhs); + + + /** + * Creates and returns a deep copy of this DefaultValues object. + * + * @return a (deep) copy of this DefaultValues object. + */ + virtual DefaultValues* clone() const; + + + /** + * Destructor for DefaultValues. + */ + virtual ~DefaultValues(); + + + /** + * Returns the value of the "stroke-width" attribute of this DefaultValues. + * + * @return the value of the "stroke-width" attribute of this DefaultValues as + * a double. + */ + double getStrokeWidth() const; + + + /** + * Returns the value of the "startHead" attribute of this DefaultValues. + * + * @return the value of the "startHead" attribute of this DefaultValues as a + * string. + */ + const std::string& getStartHead() const; + + + /** + * Predicate returning @c true if this DefaultValues's "stroke-width" + * attribute is set. + * + * @return @c true if this DefaultValues's "stroke-width" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetStrokeWidth() const; + + + /** + * Predicate returning @c true if this DefaultValues's "startHead" attribute + * is set. + * + * @return @c true if this DefaultValues's "startHead" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetStartHead() const; + + + /** + * Sets the value of the "stroke-width" attribute of this DefaultValues. + * + * @param strokeWidth double value of the "stroke-width" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setStrokeWidth(double strokeWidth); + + + /** + * Sets the value of the "startHead" attribute of this DefaultValues. + * + * @param startHead std::string& value of the "startHead" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setStartHead(const std::string& startHead); + + + /** + * Unsets the value of the "stroke-width" attribute of this DefaultValues. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetStrokeWidth(); + + + /** + * Unsets the value of the "startHead" attribute of this DefaultValues. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetStartHead(); + + + /** + * Returns the value of the "font-size" element of this DefaultValues. + * + * @return the value of the "font-size" element of this DefaultValues as a + * RelAbsVector*. + */ + const RelAbsVector* getFontSize() const; + + + /** + * Returns the value of the "font-size" element of this DefaultValues. + * + * @return the value of the "font-size" element of this DefaultValues as a + * RelAbsVector*. + */ + RelAbsVector* getFontSize(); + + + /** + * Predicate returning @c true if this DefaultValues's "font-size" element is + * set. + * + * @return @c true if this DefaultValues's "font-size" element has been set, + * otherwise @c false is returned. + */ + bool isSetFontSize() const; + + + /** + * Sets the value of the "font-size" element of this DefaultValues. + * + * @param fontSize RelAbsVector* value of the "font-size" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setFontSize(const RelAbsVector* fontSize); + + + /** + * Creates a new RelAbsVector object, adds it to this DefaultValues object + * and returns the RelAbsVector object created. + * + * @return a new RelAbsVector object instance. + */ + RelAbsVector* createFontSize(); + + + /** + * Unsets the value of the "font-size" element of this DefaultValues. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetFontSize(); + + + /** + * @copydoc doc_renamesidref_common + */ + virtual void renameSIdRefs(const std::string& oldid, + const std::string& newid); + + + /** + * Returns the XML element name of this DefaultValues object. + * + * For DefaultValues, the XML element name is always @c "defaultValues". + * + * @return the name of this element, i.e. @c "defaultValues". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this DefaultValues object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_RENDER_DEFAULTS, SBMLRenderTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * DefaultValues object have been set. + * + * @return @c true to indicate that all the required attributes of this + * DefaultValues have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this DefaultValues's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this DefaultValues's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this DefaultValues. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this DefaultValues. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this DefaultValues. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * DefaultValues. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this DefaultValues. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this DefaultValues. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new DefaultValues_t using the given SBML Level, Version and + * “render” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * DefaultValues_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * DefaultValues_t. + * + * @param pkgVersion an unsigned int, the SBML Render Version to assign to this + * DefaultValues_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +DefaultValues_t * +DefaultValues_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this DefaultValues_t object. + * + * @param dv the DefaultValues_t structure. + * + * @return a (deep) copy of this DefaultValues_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +DefaultValues_t* +DefaultValues_clone(const DefaultValues_t* dv); + + +/** + * Frees this DefaultValues_t object. + * + * @param dv the DefaultValues_t structure. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +void +DefaultValues_free(DefaultValues_t* dv); + + +/** + * Returns the value of the "stroke-width" attribute of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure whose stroke-width is sought. + * + * @return the value of the "stroke-width" attribute of this DefaultValues_t as + * a double. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +double +DefaultValues_getStrokeWidth(const DefaultValues_t * dv); + + +/** + * Returns the value of the "startHead" attribute of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure whose startHead is sought. + * + * @return the value of the "startHead" attribute of this DefaultValues_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +char * +DefaultValues_getStartHead(const DefaultValues_t * dv); + + +/** + * Predicate returning @c 1 (true) if this DefaultValues_t's "stroke-width" + * attribute is set. + * + * @param dv the DefaultValues_t structure. + * + * @return @c 1 (true) if this DefaultValues_t's "stroke-width" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_isSetStrokeWidth(const DefaultValues_t * dv); + + +/** + * Predicate returning @c 1 (true) if this DefaultValues_t's "startHead" + * attribute is set. + * + * @param dv the DefaultValues_t structure. + * + * @return @c 1 (true) if this DefaultValues_t's "startHead" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_isSetStartHead(const DefaultValues_t * dv); + + +/** + * Sets the value of the "stroke-width" attribute of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure. + * + * @param strokeWidth double value of the "stroke-width" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_setStrokeWidth(DefaultValues_t * dv, double strokeWidth); + + +/** + * Sets the value of the "startHead" attribute of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure. + * + * @param startHead const char * value of the "startHead" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_setStartHead(DefaultValues_t * dv, const char * startHead); + + +/** + * Unsets the value of the "stroke-width" attribute of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_unsetStrokeWidth(DefaultValues_t * dv); + + +/** + * Unsets the value of the "startHead" attribute of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_unsetStartHead(DefaultValues_t * dv); + + +/** + * Returns the value of the "font-size" element of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure whose font-size is sought. + * + * @return the value of the "font-size" element of this DefaultValues_t as a + * RelAbsVector*. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +const RelAbsVector_t* +DefaultValues_getFontSize(const DefaultValues_t * dv); + + +/** + * Predicate returning @c 1 (true) if this DefaultValues_t's "font-size" + * element is set. + * + * @param dv the DefaultValues_t structure. + * + * @return @c 1 (true) if this DefaultValues_t's "font-size" element has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_isSetFontSize(const DefaultValues_t * dv); + + +/** + * Sets the value of the "font-size" element of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure. + * + * @param fontSize RelAbsVector_t* value of the "font-size" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_setFontSize(DefaultValues_t * dv, + const RelAbsVector_t* fontSize); + + +/** + * Creates a new RelAbsVector_t object, adds it to this DefaultValues_t object + * and returns the RelAbsVector_t object created. + * + * @param dv the DefaultValues_t structure to which the RelAbsVector_t should + * be added. + * + * @return a new RelAbsVector_t object instance. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +RelAbsVector_t* +DefaultValues_createFontSize(DefaultValues_t* dv); + + +/** + * Unsets the value of the "font-size" element of this DefaultValues_t. + * + * @param dv the DefaultValues_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_unsetFontSize(DefaultValues_t * dv); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * DefaultValues_t object have been set. + * + * @param dv the DefaultValues_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * DefaultValues_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof DefaultValues_t + */ +LIBSBML_EXTERN +int +DefaultValues_hasRequiredAttributes(const DefaultValues_t * dv); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !DefaultValues_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.cpp b/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.cpp index 32220098..e8396bb3 100644 --- a/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.cpp +++ b/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.cpp @@ -1,1543 +1,1543 @@ -/** - * @file DiscreteUnivariateDistribution.cpp - * @brief Implementation of the DiscreteUnivariateDistribution class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new DiscreteUnivariateDistribution using the given SBML Level, - * Version and “distrib” package version. - */ -DiscreteUnivariateDistribution::DiscreteUnivariateDistribution( - unsigned int - level, - unsigned int - version, - unsigned int - pkgVersion) - : UnivariateDistribution(level, version, pkgVersion) - , mTruncationLowerBound (NULL) - , mTruncationUpperBound (NULL) - , mElementName("discreteUnivariateDistribution") -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new DiscreteUnivariateDistribution using the given - * DistribPkgNamespaces object. - */ -DiscreteUnivariateDistribution::DiscreteUnivariateDistribution(DistribPkgNamespaces - *distribns) - : UnivariateDistribution(distribns) - , mTruncationLowerBound (NULL) - , mTruncationUpperBound (NULL) - , mElementName("discreteUnivariateDistribution") -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for DiscreteUnivariateDistribution. - */ -DiscreteUnivariateDistribution::DiscreteUnivariateDistribution(const - DiscreteUnivariateDistribution& orig) - : UnivariateDistribution( orig ) - , mTruncationLowerBound ( NULL ) - , mTruncationUpperBound ( NULL ) - , mElementName ( orig.mElementName ) -{ - if (orig.mTruncationLowerBound != NULL) - { - mTruncationLowerBound = orig.mTruncationLowerBound->clone(); - } - - if (orig.mTruncationUpperBound != NULL) - { - mTruncationUpperBound = orig.mTruncationUpperBound->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for DiscreteUnivariateDistribution. - */ -DiscreteUnivariateDistribution& -DiscreteUnivariateDistribution::operator=(const DiscreteUnivariateDistribution& - rhs) -{ - if (&rhs != this) - { - UnivariateDistribution::operator=(rhs); - mElementName = rhs.mElementName; - delete mTruncationLowerBound; - if (rhs.mTruncationLowerBound != NULL) - { - mTruncationLowerBound = rhs.mTruncationLowerBound->clone(); - } - else - { - mTruncationLowerBound = NULL; - } - - delete mTruncationUpperBound; - if (rhs.mTruncationUpperBound != NULL) - { - mTruncationUpperBound = rhs.mTruncationUpperBound->clone(); - } - else - { - mTruncationUpperBound = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this DiscreteUnivariateDistribution - * object. - */ -DiscreteUnivariateDistribution* -DiscreteUnivariateDistribution::clone() const -{ - return new DiscreteUnivariateDistribution(*this); -} - - -/* - * Destructor for DiscreteUnivariateDistribution. - */ -DiscreteUnivariateDistribution::~DiscreteUnivariateDistribution() -{ - delete mTruncationLowerBound; - mTruncationLowerBound = NULL; - delete mTruncationUpperBound; - mTruncationUpperBound = NULL; -} - - -/* - * Returns the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - */ -const UncertBound* -DiscreteUnivariateDistribution::getTruncationLowerBound() const -{ - return mTruncationLowerBound; -} - - -/* - * Returns the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - */ -UncertBound* -DiscreteUnivariateDistribution::getTruncationLowerBound() -{ - return mTruncationLowerBound; -} - - -/* - * Returns the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - */ -const UncertBound* -DiscreteUnivariateDistribution::getTruncationUpperBound() const -{ - return mTruncationUpperBound; -} - - -/* - * Returns the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - */ -UncertBound* -DiscreteUnivariateDistribution::getTruncationUpperBound() -{ - return mTruncationUpperBound; -} - - -/* - * Predicate returning @c true if this DiscreteUnivariateDistribution's - * "truncationLowerBound" element is set. - */ -bool -DiscreteUnivariateDistribution::isSetTruncationLowerBound() const -{ - return (mTruncationLowerBound != NULL); -} - - -/* - * Predicate returning @c true if this DiscreteUnivariateDistribution's - * "truncationUpperBound" element is set. - */ -bool -DiscreteUnivariateDistribution::isSetTruncationUpperBound() const -{ - return (mTruncationUpperBound != NULL); -} - - -/* - * Sets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::setTruncationLowerBound(const UncertBound* - truncationLowerBound) -{ - if (mTruncationLowerBound == truncationLowerBound) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (truncationLowerBound == NULL) - { - delete mTruncationLowerBound; - mTruncationLowerBound = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mTruncationLowerBound; - mTruncationLowerBound = (truncationLowerBound != NULL) ? - truncationLowerBound->clone() : NULL; - if (mTruncationLowerBound != NULL) - { - mTruncationLowerBound->setElementName("truncationLowerBound"); - mTruncationLowerBound->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::setTruncationUpperBound(const UncertBound* - truncationUpperBound) -{ - if (mTruncationUpperBound == truncationUpperBound) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (truncationUpperBound == NULL) - { - delete mTruncationUpperBound; - mTruncationUpperBound = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mTruncationUpperBound; - mTruncationUpperBound = (truncationUpperBound != NULL) ? - truncationUpperBound->clone() : NULL; - if (mTruncationUpperBound != NULL) - { - mTruncationUpperBound->setElementName("truncationUpperBound"); - mTruncationUpperBound->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new UncertBound object, adds it to this - * DiscreteUnivariateDistribution object and returns the UncertBound object - * created. - */ -UncertBound* -DiscreteUnivariateDistribution::createTruncationLowerBound() -{ - if (mTruncationLowerBound != NULL) - { - delete mTruncationLowerBound; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mTruncationLowerBound = new UncertBound(distribns); - - mTruncationLowerBound->setElementName("truncationLowerBound"); - - delete distribns; - - connectToChild(); - - return mTruncationLowerBound; -} - - -/* - * Creates a new UncertBound object, adds it to this - * DiscreteUnivariateDistribution object and returns the UncertBound object - * created. - */ -UncertBound* -DiscreteUnivariateDistribution::createTruncationUpperBound() -{ - if (mTruncationUpperBound != NULL) - { - delete mTruncationUpperBound; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mTruncationUpperBound = new UncertBound(distribns); - - mTruncationUpperBound->setElementName("truncationUpperBound"); - - delete distribns; - - connectToChild(); - - return mTruncationUpperBound; -} - - -/* - * Unsets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::unsetTruncationLowerBound() -{ - delete mTruncationLowerBound; - mTruncationLowerBound = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::unsetTruncationUpperBound() -{ - delete mTruncationUpperBound; - mTruncationUpperBound = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Predicate returning @c true if this abstract - * "DiscreteUnivariateDistribution" is of type BinomialDistribution - */ -bool -DiscreteUnivariateDistribution::isBinomialDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract - * "DiscreteUnivariateDistribution" is of type GeometricDistribution - */ -bool -DiscreteUnivariateDistribution::isGeometricDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Returns the XML element name of this DiscreteUnivariateDistribution object. - */ -const std::string& -DiscreteUnivariateDistribution::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this DiscreteUnivariateDistribution object. - */ -void -DiscreteUnivariateDistribution::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this DiscreteUnivariateDistribution - * object. - */ -int -DiscreteUnivariateDistribution::getTypeCode() const -{ - return SBML_DISTRIB_DISCRETEUNIVARIATEDISTRIBUTION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * DiscreteUnivariateDistribution object have been set. - */ -bool -DiscreteUnivariateDistribution::hasRequiredAttributes() const -{ - bool allPresent = UnivariateDistribution::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * DiscreteUnivariateDistribution object have been set. - */ -bool -DiscreteUnivariateDistribution::hasRequiredElements() const -{ - bool allPresent = UnivariateDistribution::hasRequiredElements(); - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -DiscreteUnivariateDistribution::writeElements(XMLOutputStream& stream) const -{ - UnivariateDistribution::writeElements(stream); - - if (isSetTruncationLowerBound() == true) - { - mTruncationLowerBound->write(stream); - } - - if (isSetTruncationUpperBound() == true) - { - mTruncationUpperBound->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -DiscreteUnivariateDistribution::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mTruncationLowerBound != NULL) - { - mTruncationLowerBound->accept(v); - } - - if (mTruncationUpperBound != NULL) - { - mTruncationUpperBound->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -DiscreteUnivariateDistribution::setSBMLDocument(SBMLDocument* d) -{ - UnivariateDistribution::setSBMLDocument(d); - - if (mTruncationLowerBound != NULL) - { - mTruncationLowerBound->setSBMLDocument(d); - } - - if (mTruncationUpperBound != NULL) - { - mTruncationUpperBound->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -DiscreteUnivariateDistribution::connectToChild() -{ - UnivariateDistribution::connectToChild(); - - if (mTruncationLowerBound != NULL) - { - mTruncationLowerBound->connectToParent(this); - } - - if (mTruncationUpperBound != NULL) - { - mTruncationUpperBound->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -DiscreteUnivariateDistribution::enablePackageInternal( - const std::string& - pkgURI, - const std::string& - pkgPrefix, - bool flag) -{ - UnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetTruncationLowerBound()) - { - mTruncationLowerBound->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - if (isSetTruncationUpperBound()) - { - mTruncationUpperBound->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -DiscreteUnivariateDistribution::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - UnivariateDistribution::updateSBMLNamespace(package, level, version); - - if (mTruncationLowerBound != NULL) - { - mTruncationLowerBound->updateSBMLNamespace(package, level, version); - } - - if (mTruncationUpperBound != NULL) - { - mTruncationUpperBound->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = UnivariateDistribution::getAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = UnivariateDistribution::getAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = UnivariateDistribution::getAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = UnivariateDistribution::getAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = UnivariateDistribution::getAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this DiscreteUnivariateDistribution's - * attribute "attributeName" is set. - */ -bool -DiscreteUnivariateDistribution::isSetAttribute(const std::string& - attributeName) const -{ - bool value = UnivariateDistribution::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = UnivariateDistribution::setAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, - int value) -{ - int return_value = UnivariateDistribution::setAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = UnivariateDistribution::setAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = UnivariateDistribution::setAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = UnivariateDistribution::setAttribute(attributeName, - value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::unsetAttribute(const std::string& - attributeName) -{ - int value = UnivariateDistribution::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this - * DiscreteUnivariateDistribution. - */ -SBase* -DiscreteUnivariateDistribution::createChildObject(const std::string& - elementName) -{ - UnivariateDistribution* obj = NULL; - - if (elementName == "truncationLowerBound") - { - return createTruncationLowerBound(); - } - else if (elementName == "truncationUpperBound") - { - return createTruncationUpperBound(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this DiscreteUnivariateDistribution. - */ -int -DiscreteUnivariateDistribution::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "truncationLowerBound" && element->getTypeCode() == - SBML_DISTRIB_UNCERTBOUND) - { - return setTruncationLowerBound((const UncertBound*)(element)); - } - else if (elementName == "truncationUpperBound" && element->getTypeCode() == - SBML_DISTRIB_UNCERTBOUND) - { - return setTruncationUpperBound((const UncertBound*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * DiscreteUnivariateDistribution. - */ -SBase* -DiscreteUnivariateDistribution::removeChildObject( - const std::string& - elementName, - const std::string& id) -{ - if (elementName == "truncationLowerBound") - { - UncertBound * obj = mTruncationLowerBound; - mTruncationLowerBound = NULL; return obj; - } - else if (elementName == "truncationUpperBound") - { - UncertBound * obj = mTruncationUpperBound; - mTruncationUpperBound = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this DiscreteUnivariateDistribution. - */ -unsigned int -DiscreteUnivariateDistribution::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "truncationLowerBound") - { - if (isSetTruncationLowerBound()) - { - return 1; - } - } - else if (elementName == "truncationUpperBound") - { - if (isSetTruncationUpperBound()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this - * DiscreteUnivariateDistribution. - */ -SBase* -DiscreteUnivariateDistribution::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "truncationLowerBound") - { - return getTruncationLowerBound(); - } - else if (elementName == "truncationUpperBound") - { - return getTruncationUpperBound(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -DiscreteUnivariateDistribution::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mTruncationLowerBound != NULL) - { - if (mTruncationLowerBound->getId() == id) - { - return mTruncationLowerBound; - } - - obj = mTruncationLowerBound->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mTruncationUpperBound != NULL) - { - if (mTruncationUpperBound->getId() == id) - { - return mTruncationUpperBound; - } - - obj = mTruncationUpperBound->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -DiscreteUnivariateDistribution::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mTruncationLowerBound != NULL) - { - if (mTruncationLowerBound->getMetaId() == metaid) - { - return mTruncationLowerBound; - } - - obj = mTruncationLowerBound->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mTruncationUpperBound != NULL) - { - if (mTruncationUpperBound->getMetaId() == metaid) - { - return mTruncationUpperBound; - } - - obj = mTruncationUpperBound->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -DiscreteUnivariateDistribution::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mTruncationLowerBound, filter); - ADD_FILTERED_POINTER(ret, sublist, mTruncationUpperBound, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -DiscreteUnivariateDistribution::createObject(XMLInputStream& stream) -{ - SBase* obj = UnivariateDistribution::createObject(stream); - - const std::string& name = stream.peek().getName(); - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - - if (name == "truncationLowerBound") - { - if (getErrorLog() && isSetTruncationLowerBound()) - { - getErrorLog()->logPackageError("distrib", - DistribDiscreteUnivariateDistributionAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mTruncationLowerBound; - mTruncationLowerBound = new UncertBound(distribns); - mTruncationLowerBound->setElementName(name); - obj = mTruncationLowerBound; - } - else if (name == "truncationUpperBound") - { - if (getErrorLog() && isSetTruncationUpperBound()) - { - getErrorLog()->logPackageError("distrib", - DistribDiscreteUnivariateDistributionAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mTruncationUpperBound; - mTruncationUpperBound = new UncertBound(distribns); - mTruncationUpperBound->setElementName(name); - obj = mTruncationUpperBound; - } - - delete distribns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -DiscreteUnivariateDistribution::addExpectedAttributes(ExpectedAttributes& - attributes) -{ - UnivariateDistribution::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -DiscreteUnivariateDistribution::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - UnivariateDistribution::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribDiscreteUnivariateDistributionAllowedAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribDiscreteUnivariateDistributionAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -DiscreteUnivariateDistribution::writeAttributes(XMLOutputStream& stream) const -{ - UnivariateDistribution::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new DiscreteUnivariateDistribution_t using the given SBML Level, - * Version and “distrib” package version. - */ -LIBSBML_EXTERN -DiscreteUnivariateDistribution_t * -DiscreteUnivariateDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new DiscreteUnivariateDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this DiscreteUnivariateDistribution_t - * object. - */ -LIBSBML_EXTERN -DiscreteUnivariateDistribution_t* -DiscreteUnivariateDistribution_clone(const DiscreteUnivariateDistribution_t* - dud) -{ - if (dud != NULL) - { - return static_cast(dud->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this DiscreteUnivariateDistribution_t object. - */ -LIBSBML_EXTERN -void -DiscreteUnivariateDistribution_free(DiscreteUnivariateDistribution_t* dud) -{ - if (dud != NULL) - { - delete dud; - } -} - - -/* - * Returns the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution_t. - */ -LIBSBML_EXTERN -const UncertBound_t* -DiscreteUnivariateDistribution_getTruncationLowerBound(const - DiscreteUnivariateDistribution_t * dud) -{ - if (dud == NULL) - { - return NULL; - } - - return (UncertBound_t*)(dud->getTruncationLowerBound()); -} - - -/* - * Returns the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution_t. - */ -LIBSBML_EXTERN -const UncertBound_t* -DiscreteUnivariateDistribution_getTruncationUpperBound(const - DiscreteUnivariateDistribution_t * dud) -{ - if (dud == NULL) - { - return NULL; - } - - return (UncertBound_t*)(dud->getTruncationUpperBound()); -} - - -/* - * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's - * "truncationLowerBound" element is set. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isSetTruncationLowerBound(const - DiscreteUnivariateDistribution_t * dud) -{ - return (dud != NULL) ? static_cast(dud->isSetTruncationLowerBound()) : - 0; -} - - -/* - * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's - * "truncationUpperBound" element is set. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isSetTruncationUpperBound(const - DiscreteUnivariateDistribution_t * dud) -{ - return (dud != NULL) ? static_cast(dud->isSetTruncationUpperBound()) : - 0; -} - - -/* - * Sets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution_t. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_setTruncationLowerBound( - DiscreteUnivariateDistribution_t - * dud, - const UncertBound_t* truncationLowerBound) -{ - return (dud != NULL) ? dud->setTruncationLowerBound(truncationLowerBound) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution_t. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_setTruncationUpperBound( - DiscreteUnivariateDistribution_t - * dud, - const UncertBound_t* truncationUpperBound) -{ - return (dud != NULL) ? dud->setTruncationUpperBound(truncationUpperBound) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new UncertBound_t object, adds it to this - * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object - * created. - */ -LIBSBML_EXTERN -UncertBound_t* -DiscreteUnivariateDistribution_createTruncationLowerBound(DiscreteUnivariateDistribution_t* - dud) -{ - if (dud == NULL) - { - return NULL; - } - - return (UncertBound_t*)(dud->createTruncationLowerBound()); -} - - -/* - * Creates a new UncertBound_t object, adds it to this - * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object - * created. - */ -LIBSBML_EXTERN -UncertBound_t* -DiscreteUnivariateDistribution_createTruncationUpperBound(DiscreteUnivariateDistribution_t* - dud) -{ - if (dud == NULL) - { - return NULL; - } - - return (UncertBound_t*)(dud->createTruncationUpperBound()); -} - - -/* - * Unsets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution_t. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_unsetTruncationLowerBound(DiscreteUnivariateDistribution_t - * dud) -{ - return (dud != NULL) ? dud->unsetTruncationLowerBound() : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution_t. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_unsetTruncationUpperBound(DiscreteUnivariateDistribution_t - * dud) -{ - return (dud != NULL) ? dud->unsetTruncationUpperBound() : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type - * BinomialDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isBinomialDistribution(const - DiscreteUnivariateDistribution_t * dud) -{ - return (dud != NULL) ? static_cast(dud->isBinomialDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type - * GeometricDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isGeometricDistribution(const - DiscreteUnivariateDistribution_t * dud) -{ - return (dud != NULL) ? static_cast(dud->isGeometricDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * DiscreteUnivariateDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_hasRequiredAttributes(const - DiscreteUnivariateDistribution_t * dud) -{ - return (dud != NULL) ? static_cast(dud->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * DiscreteUnivariateDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_hasRequiredElements(const - DiscreteUnivariateDistribution_t * dud) -{ - return (dud != NULL) ? static_cast(dud->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file DiscreteUnivariateDistribution.cpp + * @brief Implementation of the DiscreteUnivariateDistribution class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new DiscreteUnivariateDistribution using the given SBML Level, + * Version and “distrib” package version. + */ +DiscreteUnivariateDistribution::DiscreteUnivariateDistribution( + unsigned int + level, + unsigned int + version, + unsigned int + pkgVersion) + : UnivariateDistribution(level, version, pkgVersion) + , mTruncationLowerBound (NULL) + , mTruncationUpperBound (NULL) + , mElementName("discreteUnivariateDistribution") +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new DiscreteUnivariateDistribution using the given + * DistribPkgNamespaces object. + */ +DiscreteUnivariateDistribution::DiscreteUnivariateDistribution(DistribPkgNamespaces + *distribns) + : UnivariateDistribution(distribns) + , mTruncationLowerBound (NULL) + , mTruncationUpperBound (NULL) + , mElementName("discreteUnivariateDistribution") +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for DiscreteUnivariateDistribution. + */ +DiscreteUnivariateDistribution::DiscreteUnivariateDistribution(const + DiscreteUnivariateDistribution& orig) + : UnivariateDistribution( orig ) + , mTruncationLowerBound ( NULL ) + , mTruncationUpperBound ( NULL ) + , mElementName ( orig.mElementName ) +{ + if (orig.mTruncationLowerBound != NULL) + { + mTruncationLowerBound = orig.mTruncationLowerBound->clone(); + } + + if (orig.mTruncationUpperBound != NULL) + { + mTruncationUpperBound = orig.mTruncationUpperBound->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for DiscreteUnivariateDistribution. + */ +DiscreteUnivariateDistribution& +DiscreteUnivariateDistribution::operator=(const DiscreteUnivariateDistribution& + rhs) +{ + if (&rhs != this) + { + UnivariateDistribution::operator=(rhs); + mElementName = rhs.mElementName; + delete mTruncationLowerBound; + if (rhs.mTruncationLowerBound != NULL) + { + mTruncationLowerBound = rhs.mTruncationLowerBound->clone(); + } + else + { + mTruncationLowerBound = NULL; + } + + delete mTruncationUpperBound; + if (rhs.mTruncationUpperBound != NULL) + { + mTruncationUpperBound = rhs.mTruncationUpperBound->clone(); + } + else + { + mTruncationUpperBound = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this DiscreteUnivariateDistribution + * object. + */ +DiscreteUnivariateDistribution* +DiscreteUnivariateDistribution::clone() const +{ + return new DiscreteUnivariateDistribution(*this); +} + + +/* + * Destructor for DiscreteUnivariateDistribution. + */ +DiscreteUnivariateDistribution::~DiscreteUnivariateDistribution() +{ + delete mTruncationLowerBound; + mTruncationLowerBound = NULL; + delete mTruncationUpperBound; + mTruncationUpperBound = NULL; +} + + +/* + * Returns the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + */ +const UncertBound* +DiscreteUnivariateDistribution::getTruncationLowerBound() const +{ + return mTruncationLowerBound; +} + + +/* + * Returns the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + */ +UncertBound* +DiscreteUnivariateDistribution::getTruncationLowerBound() +{ + return mTruncationLowerBound; +} + + +/* + * Returns the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + */ +const UncertBound* +DiscreteUnivariateDistribution::getTruncationUpperBound() const +{ + return mTruncationUpperBound; +} + + +/* + * Returns the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + */ +UncertBound* +DiscreteUnivariateDistribution::getTruncationUpperBound() +{ + return mTruncationUpperBound; +} + + +/* + * Predicate returning @c true if this DiscreteUnivariateDistribution's + * "truncationLowerBound" element is set. + */ +bool +DiscreteUnivariateDistribution::isSetTruncationLowerBound() const +{ + return (mTruncationLowerBound != NULL); +} + + +/* + * Predicate returning @c true if this DiscreteUnivariateDistribution's + * "truncationUpperBound" element is set. + */ +bool +DiscreteUnivariateDistribution::isSetTruncationUpperBound() const +{ + return (mTruncationUpperBound != NULL); +} + + +/* + * Sets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::setTruncationLowerBound(const UncertBound* + truncationLowerBound) +{ + if (mTruncationLowerBound == truncationLowerBound) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (truncationLowerBound == NULL) + { + delete mTruncationLowerBound; + mTruncationLowerBound = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mTruncationLowerBound; + mTruncationLowerBound = (truncationLowerBound != NULL) ? + truncationLowerBound->clone() : NULL; + if (mTruncationLowerBound != NULL) + { + mTruncationLowerBound->setElementName("truncationLowerBound"); + mTruncationLowerBound->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::setTruncationUpperBound(const UncertBound* + truncationUpperBound) +{ + if (mTruncationUpperBound == truncationUpperBound) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (truncationUpperBound == NULL) + { + delete mTruncationUpperBound; + mTruncationUpperBound = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mTruncationUpperBound; + mTruncationUpperBound = (truncationUpperBound != NULL) ? + truncationUpperBound->clone() : NULL; + if (mTruncationUpperBound != NULL) + { + mTruncationUpperBound->setElementName("truncationUpperBound"); + mTruncationUpperBound->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new UncertBound object, adds it to this + * DiscreteUnivariateDistribution object and returns the UncertBound object + * created. + */ +UncertBound* +DiscreteUnivariateDistribution::createTruncationLowerBound() +{ + if (mTruncationLowerBound != NULL) + { + delete mTruncationLowerBound; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mTruncationLowerBound = new UncertBound(distribns); + + mTruncationLowerBound->setElementName("truncationLowerBound"); + + delete distribns; + + connectToChild(); + + return mTruncationLowerBound; +} + + +/* + * Creates a new UncertBound object, adds it to this + * DiscreteUnivariateDistribution object and returns the UncertBound object + * created. + */ +UncertBound* +DiscreteUnivariateDistribution::createTruncationUpperBound() +{ + if (mTruncationUpperBound != NULL) + { + delete mTruncationUpperBound; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mTruncationUpperBound = new UncertBound(distribns); + + mTruncationUpperBound->setElementName("truncationUpperBound"); + + delete distribns; + + connectToChild(); + + return mTruncationUpperBound; +} + + +/* + * Unsets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::unsetTruncationLowerBound() +{ + delete mTruncationLowerBound; + mTruncationLowerBound = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::unsetTruncationUpperBound() +{ + delete mTruncationUpperBound; + mTruncationUpperBound = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Predicate returning @c true if this abstract + * "DiscreteUnivariateDistribution" is of type BinomialDistribution + */ +bool +DiscreteUnivariateDistribution::isBinomialDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract + * "DiscreteUnivariateDistribution" is of type GeometricDistribution + */ +bool +DiscreteUnivariateDistribution::isGeometricDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Returns the XML element name of this DiscreteUnivariateDistribution object. + */ +const std::string& +DiscreteUnivariateDistribution::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this DiscreteUnivariateDistribution object. + */ +void +DiscreteUnivariateDistribution::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this DiscreteUnivariateDistribution + * object. + */ +int +DiscreteUnivariateDistribution::getTypeCode() const +{ + return SBML_DISTRIB_DISCRETEUNIVARIATEDISTRIBUTION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * DiscreteUnivariateDistribution object have been set. + */ +bool +DiscreteUnivariateDistribution::hasRequiredAttributes() const +{ + bool allPresent = UnivariateDistribution::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * DiscreteUnivariateDistribution object have been set. + */ +bool +DiscreteUnivariateDistribution::hasRequiredElements() const +{ + bool allPresent = UnivariateDistribution::hasRequiredElements(); + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +DiscreteUnivariateDistribution::writeElements(XMLOutputStream& stream) const +{ + UnivariateDistribution::writeElements(stream); + + if (isSetTruncationLowerBound() == true) + { + mTruncationLowerBound->write(stream); + } + + if (isSetTruncationUpperBound() == true) + { + mTruncationUpperBound->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +DiscreteUnivariateDistribution::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mTruncationLowerBound != NULL) + { + mTruncationLowerBound->accept(v); + } + + if (mTruncationUpperBound != NULL) + { + mTruncationUpperBound->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +DiscreteUnivariateDistribution::setSBMLDocument(SBMLDocument* d) +{ + UnivariateDistribution::setSBMLDocument(d); + + if (mTruncationLowerBound != NULL) + { + mTruncationLowerBound->setSBMLDocument(d); + } + + if (mTruncationUpperBound != NULL) + { + mTruncationUpperBound->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +DiscreteUnivariateDistribution::connectToChild() +{ + UnivariateDistribution::connectToChild(); + + if (mTruncationLowerBound != NULL) + { + mTruncationLowerBound->connectToParent(this); + } + + if (mTruncationUpperBound != NULL) + { + mTruncationUpperBound->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +DiscreteUnivariateDistribution::enablePackageInternal( + const std::string& + pkgURI, + const std::string& + pkgPrefix, + bool flag) +{ + UnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetTruncationLowerBound()) + { + mTruncationLowerBound->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + if (isSetTruncationUpperBound()) + { + mTruncationUpperBound->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +DiscreteUnivariateDistribution::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + UnivariateDistribution::updateSBMLNamespace(package, level, version); + + if (mTruncationLowerBound != NULL) + { + mTruncationLowerBound->updateSBMLNamespace(package, level, version); + } + + if (mTruncationUpperBound != NULL) + { + mTruncationUpperBound->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = UnivariateDistribution::getAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = UnivariateDistribution::getAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = UnivariateDistribution::getAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = UnivariateDistribution::getAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = UnivariateDistribution::getAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this DiscreteUnivariateDistribution's + * attribute "attributeName" is set. + */ +bool +DiscreteUnivariateDistribution::isSetAttribute(const std::string& + attributeName) const +{ + bool value = UnivariateDistribution::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = UnivariateDistribution::setAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, + int value) +{ + int return_value = UnivariateDistribution::setAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = UnivariateDistribution::setAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = UnivariateDistribution::setAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = UnivariateDistribution::setAttribute(attributeName, + value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::unsetAttribute(const std::string& + attributeName) +{ + int value = UnivariateDistribution::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this + * DiscreteUnivariateDistribution. + */ +SBase* +DiscreteUnivariateDistribution::createChildObject(const std::string& + elementName) +{ + UnivariateDistribution* obj = NULL; + + if (elementName == "truncationLowerBound") + { + return createTruncationLowerBound(); + } + else if (elementName == "truncationUpperBound") + { + return createTruncationUpperBound(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this DiscreteUnivariateDistribution. + */ +int +DiscreteUnivariateDistribution::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "truncationLowerBound" && element->getTypeCode() == + SBML_DISTRIB_UNCERTBOUND) + { + return setTruncationLowerBound((const UncertBound*)(element)); + } + else if (elementName == "truncationUpperBound" && element->getTypeCode() == + SBML_DISTRIB_UNCERTBOUND) + { + return setTruncationUpperBound((const UncertBound*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * DiscreteUnivariateDistribution. + */ +SBase* +DiscreteUnivariateDistribution::removeChildObject( + const std::string& + elementName, + const std::string& id) +{ + if (elementName == "truncationLowerBound") + { + UncertBound * obj = mTruncationLowerBound; + mTruncationLowerBound = NULL; return obj; + } + else if (elementName == "truncationUpperBound") + { + UncertBound * obj = mTruncationUpperBound; + mTruncationUpperBound = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this DiscreteUnivariateDistribution. + */ +unsigned int +DiscreteUnivariateDistribution::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "truncationLowerBound") + { + if (isSetTruncationLowerBound()) + { + return 1; + } + } + else if (elementName == "truncationUpperBound") + { + if (isSetTruncationUpperBound()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this + * DiscreteUnivariateDistribution. + */ +SBase* +DiscreteUnivariateDistribution::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "truncationLowerBound") + { + return getTruncationLowerBound(); + } + else if (elementName == "truncationUpperBound") + { + return getTruncationUpperBound(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +DiscreteUnivariateDistribution::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mTruncationLowerBound != NULL) + { + if (mTruncationLowerBound->getId() == id) + { + return mTruncationLowerBound; + } + + obj = mTruncationLowerBound->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mTruncationUpperBound != NULL) + { + if (mTruncationUpperBound->getId() == id) + { + return mTruncationUpperBound; + } + + obj = mTruncationUpperBound->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +DiscreteUnivariateDistribution::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mTruncationLowerBound != NULL) + { + if (mTruncationLowerBound->getMetaId() == metaid) + { + return mTruncationLowerBound; + } + + obj = mTruncationLowerBound->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mTruncationUpperBound != NULL) + { + if (mTruncationUpperBound->getMetaId() == metaid) + { + return mTruncationUpperBound; + } + + obj = mTruncationUpperBound->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +DiscreteUnivariateDistribution::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mTruncationLowerBound, filter); + ADD_FILTERED_POINTER(ret, sublist, mTruncationUpperBound, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +DiscreteUnivariateDistribution::createObject(XMLInputStream& stream) +{ + SBase* obj = UnivariateDistribution::createObject(stream); + + const std::string& name = stream.peek().getName(); + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + + if (name == "truncationLowerBound") + { + if (getErrorLog() && isSetTruncationLowerBound()) + { + getErrorLog()->logPackageError("distrib", + DistribDiscreteUnivariateDistributionAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mTruncationLowerBound; + mTruncationLowerBound = new UncertBound(distribns); + mTruncationLowerBound->setElementName(name); + obj = mTruncationLowerBound; + } + else if (name == "truncationUpperBound") + { + if (getErrorLog() && isSetTruncationUpperBound()) + { + getErrorLog()->logPackageError("distrib", + DistribDiscreteUnivariateDistributionAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mTruncationUpperBound; + mTruncationUpperBound = new UncertBound(distribns); + mTruncationUpperBound->setElementName(name); + obj = mTruncationUpperBound; + } + + delete distribns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +DiscreteUnivariateDistribution::addExpectedAttributes(ExpectedAttributes& + attributes) +{ + UnivariateDistribution::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +DiscreteUnivariateDistribution::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + UnivariateDistribution::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribDiscreteUnivariateDistributionAllowedAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribDiscreteUnivariateDistributionAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +DiscreteUnivariateDistribution::writeAttributes(XMLOutputStream& stream) const +{ + UnivariateDistribution::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new DiscreteUnivariateDistribution_t using the given SBML Level, + * Version and “distrib” package version. + */ +LIBSBML_EXTERN +DiscreteUnivariateDistribution_t * +DiscreteUnivariateDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new DiscreteUnivariateDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this DiscreteUnivariateDistribution_t + * object. + */ +LIBSBML_EXTERN +DiscreteUnivariateDistribution_t* +DiscreteUnivariateDistribution_clone(const DiscreteUnivariateDistribution_t* + dud) +{ + if (dud != NULL) + { + return static_cast(dud->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this DiscreteUnivariateDistribution_t object. + */ +LIBSBML_EXTERN +void +DiscreteUnivariateDistribution_free(DiscreteUnivariateDistribution_t* dud) +{ + if (dud != NULL) + { + delete dud; + } +} + + +/* + * Returns the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution_t. + */ +LIBSBML_EXTERN +const UncertBound_t* +DiscreteUnivariateDistribution_getTruncationLowerBound(const + DiscreteUnivariateDistribution_t * dud) +{ + if (dud == NULL) + { + return NULL; + } + + return (UncertBound_t*)(dud->getTruncationLowerBound()); +} + + +/* + * Returns the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution_t. + */ +LIBSBML_EXTERN +const UncertBound_t* +DiscreteUnivariateDistribution_getTruncationUpperBound(const + DiscreteUnivariateDistribution_t * dud) +{ + if (dud == NULL) + { + return NULL; + } + + return (UncertBound_t*)(dud->getTruncationUpperBound()); +} + + +/* + * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's + * "truncationLowerBound" element is set. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isSetTruncationLowerBound(const + DiscreteUnivariateDistribution_t * dud) +{ + return (dud != NULL) ? static_cast(dud->isSetTruncationLowerBound()) : + 0; +} + + +/* + * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's + * "truncationUpperBound" element is set. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isSetTruncationUpperBound(const + DiscreteUnivariateDistribution_t * dud) +{ + return (dud != NULL) ? static_cast(dud->isSetTruncationUpperBound()) : + 0; +} + + +/* + * Sets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution_t. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_setTruncationLowerBound( + DiscreteUnivariateDistribution_t + * dud, + const UncertBound_t* truncationLowerBound) +{ + return (dud != NULL) ? dud->setTruncationLowerBound(truncationLowerBound) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution_t. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_setTruncationUpperBound( + DiscreteUnivariateDistribution_t + * dud, + const UncertBound_t* truncationUpperBound) +{ + return (dud != NULL) ? dud->setTruncationUpperBound(truncationUpperBound) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new UncertBound_t object, adds it to this + * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object + * created. + */ +LIBSBML_EXTERN +UncertBound_t* +DiscreteUnivariateDistribution_createTruncationLowerBound(DiscreteUnivariateDistribution_t* + dud) +{ + if (dud == NULL) + { + return NULL; + } + + return (UncertBound_t*)(dud->createTruncationLowerBound()); +} + + +/* + * Creates a new UncertBound_t object, adds it to this + * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object + * created. + */ +LIBSBML_EXTERN +UncertBound_t* +DiscreteUnivariateDistribution_createTruncationUpperBound(DiscreteUnivariateDistribution_t* + dud) +{ + if (dud == NULL) + { + return NULL; + } + + return (UncertBound_t*)(dud->createTruncationUpperBound()); +} + + +/* + * Unsets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution_t. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_unsetTruncationLowerBound(DiscreteUnivariateDistribution_t + * dud) +{ + return (dud != NULL) ? dud->unsetTruncationLowerBound() : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution_t. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_unsetTruncationUpperBound(DiscreteUnivariateDistribution_t + * dud) +{ + return (dud != NULL) ? dud->unsetTruncationUpperBound() : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type + * BinomialDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isBinomialDistribution(const + DiscreteUnivariateDistribution_t * dud) +{ + return (dud != NULL) ? static_cast(dud->isBinomialDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type + * GeometricDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isGeometricDistribution(const + DiscreteUnivariateDistribution_t * dud) +{ + return (dud != NULL) ? static_cast(dud->isGeometricDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * DiscreteUnivariateDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_hasRequiredAttributes(const + DiscreteUnivariateDistribution_t * dud) +{ + return (dud != NULL) ? static_cast(dud->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * DiscreteUnivariateDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_hasRequiredElements(const + DiscreteUnivariateDistribution_t * dud) +{ + return (dud != NULL) ? static_cast(dud->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.h b/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.h index eefa3466..2305658f 100644 --- a/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.h +++ b/generator/tests/test_cpp_code/test-code/DiscreteUnivariateDistribution.h @@ -1,1241 +1,1241 @@ -/** - * @file DiscreteUnivariateDistribution.h - * @brief Definition of the DiscreteUnivariateDistribution class. - * @author SBMLTeam - * - * - * - * @class DiscreteUnivariateDistribution - * @sbmlbrief{distrib} TODO:Definition of the DiscreteUnivariateDistribution - * class. - */ - - -#ifndef DiscreteUnivariateDistribution_H__ -#define DiscreteUnivariateDistribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class BinomialDistribution; -class GeometricDistribution; - -class LIBSBML_EXTERN DiscreteUnivariateDistribution : public - UnivariateDistribution -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - UncertBound* mTruncationLowerBound; - UncertBound* mTruncationUpperBound; - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new DiscreteUnivariateDistribution using the given SBML Level, - * Version and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * DiscreteUnivariateDistribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * DiscreteUnivariateDistribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this DiscreteUnivariateDistribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - DiscreteUnivariateDistribution( - unsigned int level = - DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new DiscreteUnivariateDistribution using the given - * DistribPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - DiscreteUnivariateDistribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for DiscreteUnivariateDistribution. - * - * @param orig the DiscreteUnivariateDistribution instance to copy. - */ - DiscreteUnivariateDistribution(const DiscreteUnivariateDistribution& orig); - - - /** - * Assignment operator for DiscreteUnivariateDistribution. - * - * @param rhs the DiscreteUnivariateDistribution object whose values are to - * be used as the basis of the assignment. - */ - DiscreteUnivariateDistribution& operator=(const - DiscreteUnivariateDistribution& rhs); - - - /** - * Creates and returns a deep copy of this DiscreteUnivariateDistribution - * object. - * - * @return a (deep) copy of this DiscreteUnivariateDistribution object. - */ - virtual DiscreteUnivariateDistribution* clone() const; - - - /** - * Destructor for DiscreteUnivariateDistribution. - */ - virtual ~DiscreteUnivariateDistribution(); - - - /** - * Returns the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - * - * @return the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution as a UncertBound*. - */ - const UncertBound* getTruncationLowerBound() const; - - - /** - * Returns the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - * - * @return the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution as a UncertBound*. - */ - UncertBound* getTruncationLowerBound(); - - - /** - * Returns the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - * - * @return the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution as a UncertBound*. - */ - const UncertBound* getTruncationUpperBound() const; - - - /** - * Returns the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - * - * @return the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution as a UncertBound*. - */ - UncertBound* getTruncationUpperBound(); - - - /** - * Predicate returning @c true if this DiscreteUnivariateDistribution's - * "truncationLowerBound" element is set. - * - * @return @c true if this DiscreteUnivariateDistribution's - * "truncationLowerBound" element has been set, otherwise @c false is - * returned. - */ - bool isSetTruncationLowerBound() const; - - - /** - * Predicate returning @c true if this DiscreteUnivariateDistribution's - * "truncationUpperBound" element is set. - * - * @return @c true if this DiscreteUnivariateDistribution's - * "truncationUpperBound" element has been set, otherwise @c false is - * returned. - */ - bool isSetTruncationUpperBound() const; - - - /** - * Sets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - * - * @param truncationLowerBound UncertBound* value of the - * "truncationLowerBound" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setTruncationLowerBound(const UncertBound* truncationLowerBound); - - - /** - * Sets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - * - * @param truncationUpperBound UncertBound* value of the - * "truncationUpperBound" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setTruncationUpperBound(const UncertBound* truncationUpperBound); - - - /** - * Creates a new UncertBound object, adds it to this - * DiscreteUnivariateDistribution object and returns the UncertBound object - * created. - * - * @return a new UncertBound object instance. - */ - UncertBound* createTruncationLowerBound(); - - - /** - * Creates a new UncertBound object, adds it to this - * DiscreteUnivariateDistribution object and returns the UncertBound object - * created. - * - * @return a new UncertBound object instance. - */ - UncertBound* createTruncationUpperBound(); - - - /** - * Unsets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetTruncationLowerBound(); - - - /** - * Unsets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetTruncationUpperBound(); - - - /** - * Predicate returning @c true if this abstract - * "DiscreteUnivariateDistribution" is of type BinomialDistribution - * - * @return @c true if this abstract "DiscreteUnivariateDistribution" is of - * type BinomialDistribution, @c false otherwise - */ - virtual bool isBinomialDistribution() const; - - - /** - * Predicate returning @c true if this abstract - * "DiscreteUnivariateDistribution" is of type GeometricDistribution - * - * @return @c true if this abstract "DiscreteUnivariateDistribution" is of - * type GeometricDistribution, @c false otherwise - */ - virtual bool isGeometricDistribution() const; - - - /** - * Returns the XML element name of this DiscreteUnivariateDistribution - * object. - * - * For DiscreteUnivariateDistribution, the XML element name is always - * @c "discreteUnivariateDistribution". - * - * @return the name of this element, i.e. - * @c "discreteUnivariateDistribution". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this DiscreteUnivariateDistribution object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this DiscreteUnivariateDistribution - * object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_DISCRETEUNIVARIATEDISTRIBUTION, - * SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * DiscreteUnivariateDistribution object have been set. - * - * @return @c true to indicate that all the required attributes of this - * DiscreteUnivariateDistribution have been set, otherwise @c false is - * returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * DiscreteUnivariateDistribution object have been set. - * - * @return @c true to indicate that all the required elements of this - * DiscreteUnivariateDistribution have been set, otherwise @c false is - * returned. - * - * - * @note The required elements for the DiscreteUnivariateDistribution object - * are: - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this DiscreteUnivariateDistribution's - * attribute "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this DiscreteUnivariateDistribution's attribute - * "attributeName" has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * DiscreteUnivariateDistribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this - * DiscreteUnivariateDistribution. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this DiscreteUnivariateDistribution. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * DiscreteUnivariateDistribution. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this - * DiscreteUnivariateDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this - * DiscreteUnivariateDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new DiscreteUnivariateDistribution_t using the given SBML Level, - * Version and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * DiscreteUnivariateDistribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * DiscreteUnivariateDistribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this DiscreteUnivariateDistribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -DiscreteUnivariateDistribution_t * -DiscreteUnivariateDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this DiscreteUnivariateDistribution_t - * object. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @return a (deep) copy of this DiscreteUnivariateDistribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -DiscreteUnivariateDistribution_t* -DiscreteUnivariateDistribution_clone(const DiscreteUnivariateDistribution_t* - dud); - - -/** - * Frees this DiscreteUnivariateDistribution_t object. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -void -DiscreteUnivariateDistribution_free(DiscreteUnivariateDistribution_t* dud); - - -/** - * Returns the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution_t. - * - * @param dud the DiscreteUnivariateDistribution_t structure whose - * truncationLowerBound is sought. - * - * @return the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution_t as a UncertBound*. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -const UncertBound_t* -DiscreteUnivariateDistribution_getTruncationLowerBound(const - DiscreteUnivariateDistribution_t * dud); - - -/** - * Returns the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution_t. - * - * @param dud the DiscreteUnivariateDistribution_t structure whose - * truncationUpperBound is sought. - * - * @return the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution_t as a UncertBound*. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -const UncertBound_t* -DiscreteUnivariateDistribution_getTruncationUpperBound(const - DiscreteUnivariateDistribution_t * dud); - - -/** - * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's - * "truncationLowerBound" element is set. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @return @c 1 (true) if this DiscreteUnivariateDistribution_t's - * "truncationLowerBound" element has been set, otherwise @c 0 (false) is - * returned. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isSetTruncationLowerBound(const - DiscreteUnivariateDistribution_t * dud); - - -/** - * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's - * "truncationUpperBound" element is set. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @return @c 1 (true) if this DiscreteUnivariateDistribution_t's - * "truncationUpperBound" element has been set, otherwise @c 0 (false) is - * returned. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isSetTruncationUpperBound(const - DiscreteUnivariateDistribution_t * dud); - - -/** - * Sets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution_t. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @param truncationLowerBound UncertBound_t* value of the - * "truncationLowerBound" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_setTruncationLowerBound( - DiscreteUnivariateDistribution_t - * dud, - const UncertBound_t* truncationLowerBound); - - -/** - * Sets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution_t. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @param truncationUpperBound UncertBound_t* value of the - * "truncationUpperBound" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_setTruncationUpperBound( - DiscreteUnivariateDistribution_t - * dud, - const UncertBound_t* truncationUpperBound); - - -/** - * Creates a new UncertBound_t object, adds it to this - * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object - * created. - * - * @param dud the DiscreteUnivariateDistribution_t structure to which the - * UncertBound_t should be added. - * - * @return a new UncertBound_t object instance. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -UncertBound_t* -DiscreteUnivariateDistribution_createTruncationLowerBound(DiscreteUnivariateDistribution_t* - dud); - - -/** - * Creates a new UncertBound_t object, adds it to this - * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object - * created. - * - * @param dud the DiscreteUnivariateDistribution_t structure to which the - * UncertBound_t should be added. - * - * @return a new UncertBound_t object instance. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -UncertBound_t* -DiscreteUnivariateDistribution_createTruncationUpperBound(DiscreteUnivariateDistribution_t* - dud); - - -/** - * Unsets the value of the "truncationLowerBound" element of this - * DiscreteUnivariateDistribution_t. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_unsetTruncationLowerBound(DiscreteUnivariateDistribution_t - * dud); - - -/** - * Unsets the value of the "truncationUpperBound" element of this - * DiscreteUnivariateDistribution_t. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_unsetTruncationUpperBound(DiscreteUnivariateDistribution_t - * dud); - - -/** - * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type - * BinomialDistribution_t - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @return @c 1 if this DiscreteUnivariateDistribution_t is of type - * BinomialDistribution_t, @c 0 otherwise - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isBinomialDistribution(const - DiscreteUnivariateDistribution_t * dud); - - -/** - * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type - * GeometricDistribution_t - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @return @c 1 if this DiscreteUnivariateDistribution_t is of type - * GeometricDistribution_t, @c 0 otherwise - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_isGeometricDistribution(const - DiscreteUnivariateDistribution_t * dud); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * DiscreteUnivariateDistribution_t object have been set. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * DiscreteUnivariateDistribution_t have been set, otherwise @c 0 (false) is - * returned. - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_hasRequiredAttributes(const - DiscreteUnivariateDistribution_t * dud); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * DiscreteUnivariateDistribution_t object have been set. - * - * @param dud the DiscreteUnivariateDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * DiscreteUnivariateDistribution_t have been set, otherwise @c 0 (false) is - * returned. - * - * - * @note The required elements for the DiscreteUnivariateDistribution_t object - * are: - * - * @memberof DiscreteUnivariateDistribution_t - */ -LIBSBML_EXTERN -int -DiscreteUnivariateDistribution_hasRequiredElements(const - DiscreteUnivariateDistribution_t * dud); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !DiscreteUnivariateDistribution_H__ */ - - +/** + * @file DiscreteUnivariateDistribution.h + * @brief Definition of the DiscreteUnivariateDistribution class. + * @author SBMLTeam + * + * + * + * @class DiscreteUnivariateDistribution + * @sbmlbrief{distrib} TODO:Definition of the DiscreteUnivariateDistribution + * class. + */ + + +#ifndef DiscreteUnivariateDistribution_H__ +#define DiscreteUnivariateDistribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class BinomialDistribution; +class GeometricDistribution; + +class LIBSBML_EXTERN DiscreteUnivariateDistribution : public + UnivariateDistribution +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + UncertBound* mTruncationLowerBound; + UncertBound* mTruncationUpperBound; + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new DiscreteUnivariateDistribution using the given SBML Level, + * Version and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * DiscreteUnivariateDistribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * DiscreteUnivariateDistribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this DiscreteUnivariateDistribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + DiscreteUnivariateDistribution( + unsigned int level = + DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new DiscreteUnivariateDistribution using the given + * DistribPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + DiscreteUnivariateDistribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for DiscreteUnivariateDistribution. + * + * @param orig the DiscreteUnivariateDistribution instance to copy. + */ + DiscreteUnivariateDistribution(const DiscreteUnivariateDistribution& orig); + + + /** + * Assignment operator for DiscreteUnivariateDistribution. + * + * @param rhs the DiscreteUnivariateDistribution object whose values are to + * be used as the basis of the assignment. + */ + DiscreteUnivariateDistribution& operator=(const + DiscreteUnivariateDistribution& rhs); + + + /** + * Creates and returns a deep copy of this DiscreteUnivariateDistribution + * object. + * + * @return a (deep) copy of this DiscreteUnivariateDistribution object. + */ + virtual DiscreteUnivariateDistribution* clone() const; + + + /** + * Destructor for DiscreteUnivariateDistribution. + */ + virtual ~DiscreteUnivariateDistribution(); + + + /** + * Returns the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + * + * @return the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution as a UncertBound*. + */ + const UncertBound* getTruncationLowerBound() const; + + + /** + * Returns the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + * + * @return the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution as a UncertBound*. + */ + UncertBound* getTruncationLowerBound(); + + + /** + * Returns the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + * + * @return the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution as a UncertBound*. + */ + const UncertBound* getTruncationUpperBound() const; + + + /** + * Returns the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + * + * @return the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution as a UncertBound*. + */ + UncertBound* getTruncationUpperBound(); + + + /** + * Predicate returning @c true if this DiscreteUnivariateDistribution's + * "truncationLowerBound" element is set. + * + * @return @c true if this DiscreteUnivariateDistribution's + * "truncationLowerBound" element has been set, otherwise @c false is + * returned. + */ + bool isSetTruncationLowerBound() const; + + + /** + * Predicate returning @c true if this DiscreteUnivariateDistribution's + * "truncationUpperBound" element is set. + * + * @return @c true if this DiscreteUnivariateDistribution's + * "truncationUpperBound" element has been set, otherwise @c false is + * returned. + */ + bool isSetTruncationUpperBound() const; + + + /** + * Sets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + * + * @param truncationLowerBound UncertBound* value of the + * "truncationLowerBound" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setTruncationLowerBound(const UncertBound* truncationLowerBound); + + + /** + * Sets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + * + * @param truncationUpperBound UncertBound* value of the + * "truncationUpperBound" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setTruncationUpperBound(const UncertBound* truncationUpperBound); + + + /** + * Creates a new UncertBound object, adds it to this + * DiscreteUnivariateDistribution object and returns the UncertBound object + * created. + * + * @return a new UncertBound object instance. + */ + UncertBound* createTruncationLowerBound(); + + + /** + * Creates a new UncertBound object, adds it to this + * DiscreteUnivariateDistribution object and returns the UncertBound object + * created. + * + * @return a new UncertBound object instance. + */ + UncertBound* createTruncationUpperBound(); + + + /** + * Unsets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetTruncationLowerBound(); + + + /** + * Unsets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetTruncationUpperBound(); + + + /** + * Predicate returning @c true if this abstract + * "DiscreteUnivariateDistribution" is of type BinomialDistribution + * + * @return @c true if this abstract "DiscreteUnivariateDistribution" is of + * type BinomialDistribution, @c false otherwise + */ + virtual bool isBinomialDistribution() const; + + + /** + * Predicate returning @c true if this abstract + * "DiscreteUnivariateDistribution" is of type GeometricDistribution + * + * @return @c true if this abstract "DiscreteUnivariateDistribution" is of + * type GeometricDistribution, @c false otherwise + */ + virtual bool isGeometricDistribution() const; + + + /** + * Returns the XML element name of this DiscreteUnivariateDistribution + * object. + * + * For DiscreteUnivariateDistribution, the XML element name is always + * @c "discreteUnivariateDistribution". + * + * @return the name of this element, i.e. + * @c "discreteUnivariateDistribution". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this DiscreteUnivariateDistribution object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this DiscreteUnivariateDistribution + * object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_DISCRETEUNIVARIATEDISTRIBUTION, + * SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * DiscreteUnivariateDistribution object have been set. + * + * @return @c true to indicate that all the required attributes of this + * DiscreteUnivariateDistribution have been set, otherwise @c false is + * returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * DiscreteUnivariateDistribution object have been set. + * + * @return @c true to indicate that all the required elements of this + * DiscreteUnivariateDistribution have been set, otherwise @c false is + * returned. + * + * + * @note The required elements for the DiscreteUnivariateDistribution object + * are: + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this DiscreteUnivariateDistribution's + * attribute "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this DiscreteUnivariateDistribution's attribute + * "attributeName" has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * DiscreteUnivariateDistribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this + * DiscreteUnivariateDistribution. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this DiscreteUnivariateDistribution. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * DiscreteUnivariateDistribution. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this + * DiscreteUnivariateDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this + * DiscreteUnivariateDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new DiscreteUnivariateDistribution_t using the given SBML Level, + * Version and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * DiscreteUnivariateDistribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * DiscreteUnivariateDistribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this DiscreteUnivariateDistribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +DiscreteUnivariateDistribution_t * +DiscreteUnivariateDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this DiscreteUnivariateDistribution_t + * object. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @return a (deep) copy of this DiscreteUnivariateDistribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +DiscreteUnivariateDistribution_t* +DiscreteUnivariateDistribution_clone(const DiscreteUnivariateDistribution_t* + dud); + + +/** + * Frees this DiscreteUnivariateDistribution_t object. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +void +DiscreteUnivariateDistribution_free(DiscreteUnivariateDistribution_t* dud); + + +/** + * Returns the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution_t. + * + * @param dud the DiscreteUnivariateDistribution_t structure whose + * truncationLowerBound is sought. + * + * @return the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution_t as a UncertBound*. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +const UncertBound_t* +DiscreteUnivariateDistribution_getTruncationLowerBound(const + DiscreteUnivariateDistribution_t * dud); + + +/** + * Returns the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution_t. + * + * @param dud the DiscreteUnivariateDistribution_t structure whose + * truncationUpperBound is sought. + * + * @return the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution_t as a UncertBound*. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +const UncertBound_t* +DiscreteUnivariateDistribution_getTruncationUpperBound(const + DiscreteUnivariateDistribution_t * dud); + + +/** + * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's + * "truncationLowerBound" element is set. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @return @c 1 (true) if this DiscreteUnivariateDistribution_t's + * "truncationLowerBound" element has been set, otherwise @c 0 (false) is + * returned. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isSetTruncationLowerBound(const + DiscreteUnivariateDistribution_t * dud); + + +/** + * Predicate returning @c 1 (true) if this DiscreteUnivariateDistribution_t's + * "truncationUpperBound" element is set. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @return @c 1 (true) if this DiscreteUnivariateDistribution_t's + * "truncationUpperBound" element has been set, otherwise @c 0 (false) is + * returned. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isSetTruncationUpperBound(const + DiscreteUnivariateDistribution_t * dud); + + +/** + * Sets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution_t. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @param truncationLowerBound UncertBound_t* value of the + * "truncationLowerBound" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_setTruncationLowerBound( + DiscreteUnivariateDistribution_t + * dud, + const UncertBound_t* truncationLowerBound); + + +/** + * Sets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution_t. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @param truncationUpperBound UncertBound_t* value of the + * "truncationUpperBound" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_setTruncationUpperBound( + DiscreteUnivariateDistribution_t + * dud, + const UncertBound_t* truncationUpperBound); + + +/** + * Creates a new UncertBound_t object, adds it to this + * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object + * created. + * + * @param dud the DiscreteUnivariateDistribution_t structure to which the + * UncertBound_t should be added. + * + * @return a new UncertBound_t object instance. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +UncertBound_t* +DiscreteUnivariateDistribution_createTruncationLowerBound(DiscreteUnivariateDistribution_t* + dud); + + +/** + * Creates a new UncertBound_t object, adds it to this + * DiscreteUnivariateDistribution_t object and returns the UncertBound_t object + * created. + * + * @param dud the DiscreteUnivariateDistribution_t structure to which the + * UncertBound_t should be added. + * + * @return a new UncertBound_t object instance. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +UncertBound_t* +DiscreteUnivariateDistribution_createTruncationUpperBound(DiscreteUnivariateDistribution_t* + dud); + + +/** + * Unsets the value of the "truncationLowerBound" element of this + * DiscreteUnivariateDistribution_t. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_unsetTruncationLowerBound(DiscreteUnivariateDistribution_t + * dud); + + +/** + * Unsets the value of the "truncationUpperBound" element of this + * DiscreteUnivariateDistribution_t. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_unsetTruncationUpperBound(DiscreteUnivariateDistribution_t + * dud); + + +/** + * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type + * BinomialDistribution_t + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @return @c 1 if this DiscreteUnivariateDistribution_t is of type + * BinomialDistribution_t, @c 0 otherwise + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isBinomialDistribution(const + DiscreteUnivariateDistribution_t * dud); + + +/** + * Predicate returning @c 1 if this DiscreteUnivariateDistribution_t is of type + * GeometricDistribution_t + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @return @c 1 if this DiscreteUnivariateDistribution_t is of type + * GeometricDistribution_t, @c 0 otherwise + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_isGeometricDistribution(const + DiscreteUnivariateDistribution_t * dud); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * DiscreteUnivariateDistribution_t object have been set. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * DiscreteUnivariateDistribution_t have been set, otherwise @c 0 (false) is + * returned. + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_hasRequiredAttributes(const + DiscreteUnivariateDistribution_t * dud); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * DiscreteUnivariateDistribution_t object have been set. + * + * @param dud the DiscreteUnivariateDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * DiscreteUnivariateDistribution_t have been set, otherwise @c 0 (false) is + * returned. + * + * + * @note The required elements for the DiscreteUnivariateDistribution_t object + * are: + * + * @memberof DiscreteUnivariateDistribution_t + */ +LIBSBML_EXTERN +int +DiscreteUnivariateDistribution_hasRequiredElements(const + DiscreteUnivariateDistribution_t * dud); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !DiscreteUnivariateDistribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Distribution.cpp b/generator/tests/test_cpp_code/test-code/Distribution.cpp index 75ab6961..7aff28c8 100644 --- a/generator/tests/test_cpp_code/test-code/Distribution.cpp +++ b/generator/tests/test_cpp_code/test-code/Distribution.cpp @@ -1,894 +1,894 @@ -/** - * @file Distribution.cpp - * @brief Implementation of the Distribution class. - * @author SBMLTeam - * - * - */ -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Distribution using the given SBML Level, Version and - * “distrib” package version. - */ -Distribution::Distribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mElementName("distribution") -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); -} - - -/* - * Creates a new Distribution using the given DistribPkgNamespaces object. - */ -Distribution::Distribution(DistribPkgNamespaces *distribns) - : SBase(distribns) - , mElementName("distribution") -{ - setElementNamespace(distribns->getURI()); - loadPlugins(distribns); -} - - -/* - * Copy constructor for Distribution. - */ -Distribution::Distribution(const Distribution& orig) - : SBase( orig ) - , mElementName ( orig.mElementName ) -{ -} - - -/* - * Assignment operator for Distribution. - */ -Distribution& -Distribution::operator=(const Distribution& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mElementName = rhs.mElementName; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Distribution object. - */ -Distribution* -Distribution::clone() const -{ - return new Distribution(*this); -} - - -/* - * Destructor for Distribution. - */ -Distribution::~Distribution() -{ -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * BetaDistribution - */ -bool -Distribution::isBetaDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * CauchyDistribution - */ -bool -Distribution::isCauchyDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * ExponentialDistribution - */ -bool -Distribution::isExponentialDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * LogisticDistribution - */ -bool -Distribution::isLogisticDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * NormalDistribution - */ -bool -Distribution::isNormalDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * BinomialDistribution - */ -bool -Distribution::isBinomialDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * GeometricDistribution - */ -bool -Distribution::isGeometricDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * BernoulliDistribution - */ -bool -Distribution::isBernoulliDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * CategoricalDistribution - */ -bool -Distribution::isCategoricalDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * MultivariateDistribution - */ -bool -Distribution::isMultivariateDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "Distribution" is of type - * ExternalDistribution - */ -bool -Distribution::isExternalDistribution() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Returns the XML element name of this Distribution object. - */ -const std::string& -Distribution::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this Distribution object. - */ -void -Distribution::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this Distribution object. - */ -int -Distribution::getTypeCode() const -{ - return SBML_DISTRIB_DISTRIBUTION; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Distribution::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Distribution::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Distribution::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Distribution::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Distribution's attribute "attributeName" - * is set. - */ -bool -Distribution::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Distribution. - */ -int -Distribution::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new BetaDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -BetaDistribution_t * -Distribution_createBetaDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new BetaDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new CauchyDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -CauchyDistribution_t * -Distribution_createCauchyDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CauchyDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new ExponentialDistribution using the given SBML Level, Version - * and “distrib” package version. - */ -LIBSBML_EXTERN -ExponentialDistribution_t * -Distribution_createExponentialDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ExponentialDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new LogisticDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -LogisticDistribution_t * -Distribution_createLogisticDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new LogisticDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new NormalDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -NormalDistribution_t * -Distribution_createNormalDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new NormalDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new BinomialDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -BinomialDistribution_t * -Distribution_createBinomialDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new BinomialDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new GeometricDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -GeometricDistribution_t * -Distribution_createGeometricDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new GeometricDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new BernoulliDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -BernoulliDistribution_t * -Distribution_createBernoulliDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new BernoulliDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new CategoricalDistribution using the given SBML Level, Version - * and “distrib” package version. - */ -LIBSBML_EXTERN -CategoricalDistribution_t * -Distribution_createCategoricalDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CategoricalDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new MultivariateDistribution using the given SBML Level, Version - * and “distrib” package version. - */ -LIBSBML_EXTERN -MultivariateDistribution_t * -Distribution_createMultivariateDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new MultivariateDistribution(level, version, pkgVersion); -} - - -/* - * Creates a new ExternalDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -ExternalDistribution_t * -Distribution_createExternalDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ExternalDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Distribution_t object. - */ -LIBSBML_EXTERN -Distribution_t* -Distribution_clone(const Distribution_t* d) -{ - if (d != NULL) - { - return static_cast(d->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Distribution_t object. - */ -LIBSBML_EXTERN -void -Distribution_free(Distribution_t* d) -{ - if (d != NULL) - { - delete d; - } -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * BetaDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isBetaDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isBetaDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * CauchyDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isCauchyDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isCauchyDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * ExponentialDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isExponentialDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isExponentialDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * LogisticDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isLogisticDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isLogisticDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * NormalDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isNormalDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isNormalDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * BinomialDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isBinomialDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isBinomialDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * GeometricDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isGeometricDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isGeometricDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * BernoulliDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isBernoulliDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isBernoulliDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * CategoricalDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isCategoricalDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isCategoricalDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * MultivariateDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isMultivariateDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isMultivariateDistribution()) : 0; -} - - -/* - * Predicate returning @c 1 if this Distribution_t is of type - * ExternalDistribution_t - */ -LIBSBML_EXTERN -int -Distribution_isExternalDistribution(const Distribution_t * d) -{ - return (d != NULL) ? static_cast(d->isExternalDistribution()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Distribution.cpp + * @brief Implementation of the Distribution class. + * @author SBMLTeam + * + * + */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Distribution using the given SBML Level, Version and + * “distrib” package version. + */ +Distribution::Distribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mElementName("distribution") +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); +} + + +/* + * Creates a new Distribution using the given DistribPkgNamespaces object. + */ +Distribution::Distribution(DistribPkgNamespaces *distribns) + : SBase(distribns) + , mElementName("distribution") +{ + setElementNamespace(distribns->getURI()); + loadPlugins(distribns); +} + + +/* + * Copy constructor for Distribution. + */ +Distribution::Distribution(const Distribution& orig) + : SBase( orig ) + , mElementName ( orig.mElementName ) +{ +} + + +/* + * Assignment operator for Distribution. + */ +Distribution& +Distribution::operator=(const Distribution& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mElementName = rhs.mElementName; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Distribution object. + */ +Distribution* +Distribution::clone() const +{ + return new Distribution(*this); +} + + +/* + * Destructor for Distribution. + */ +Distribution::~Distribution() +{ +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * BetaDistribution + */ +bool +Distribution::isBetaDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * CauchyDistribution + */ +bool +Distribution::isCauchyDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * ExponentialDistribution + */ +bool +Distribution::isExponentialDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * LogisticDistribution + */ +bool +Distribution::isLogisticDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * NormalDistribution + */ +bool +Distribution::isNormalDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * BinomialDistribution + */ +bool +Distribution::isBinomialDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * GeometricDistribution + */ +bool +Distribution::isGeometricDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * BernoulliDistribution + */ +bool +Distribution::isBernoulliDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * CategoricalDistribution + */ +bool +Distribution::isCategoricalDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * MultivariateDistribution + */ +bool +Distribution::isMultivariateDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "Distribution" is of type + * ExternalDistribution + */ +bool +Distribution::isExternalDistribution() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Returns the XML element name of this Distribution object. + */ +const std::string& +Distribution::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this Distribution object. + */ +void +Distribution::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this Distribution object. + */ +int +Distribution::getTypeCode() const +{ + return SBML_DISTRIB_DISTRIBUTION; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Distribution::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Distribution::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Distribution::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Distribution::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Distribution's attribute "attributeName" + * is set. + */ +bool +Distribution::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Distribution. + */ +int +Distribution::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new BetaDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +BetaDistribution_t * +Distribution_createBetaDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new BetaDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new CauchyDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +CauchyDistribution_t * +Distribution_createCauchyDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CauchyDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new ExponentialDistribution using the given SBML Level, Version + * and “distrib” package version. + */ +LIBSBML_EXTERN +ExponentialDistribution_t * +Distribution_createExponentialDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ExponentialDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new LogisticDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +LogisticDistribution_t * +Distribution_createLogisticDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new LogisticDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new NormalDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +NormalDistribution_t * +Distribution_createNormalDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new NormalDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new BinomialDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +BinomialDistribution_t * +Distribution_createBinomialDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new BinomialDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new GeometricDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +GeometricDistribution_t * +Distribution_createGeometricDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new GeometricDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new BernoulliDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +BernoulliDistribution_t * +Distribution_createBernoulliDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new BernoulliDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new CategoricalDistribution using the given SBML Level, Version + * and “distrib” package version. + */ +LIBSBML_EXTERN +CategoricalDistribution_t * +Distribution_createCategoricalDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CategoricalDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new MultivariateDistribution using the given SBML Level, Version + * and “distrib” package version. + */ +LIBSBML_EXTERN +MultivariateDistribution_t * +Distribution_createMultivariateDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new MultivariateDistribution(level, version, pkgVersion); +} + + +/* + * Creates a new ExternalDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +ExternalDistribution_t * +Distribution_createExternalDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ExternalDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Distribution_t object. + */ +LIBSBML_EXTERN +Distribution_t* +Distribution_clone(const Distribution_t* d) +{ + if (d != NULL) + { + return static_cast(d->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Distribution_t object. + */ +LIBSBML_EXTERN +void +Distribution_free(Distribution_t* d) +{ + if (d != NULL) + { + delete d; + } +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * BetaDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isBetaDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isBetaDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * CauchyDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isCauchyDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isCauchyDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * ExponentialDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isExponentialDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isExponentialDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * LogisticDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isLogisticDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isLogisticDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * NormalDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isNormalDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isNormalDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * BinomialDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isBinomialDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isBinomialDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * GeometricDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isGeometricDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isGeometricDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * BernoulliDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isBernoulliDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isBernoulliDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * CategoricalDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isCategoricalDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isCategoricalDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * MultivariateDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isMultivariateDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isMultivariateDistribution()) : 0; +} + + +/* + * Predicate returning @c 1 if this Distribution_t is of type + * ExternalDistribution_t + */ +LIBSBML_EXTERN +int +Distribution_isExternalDistribution(const Distribution_t * d) +{ + return (d != NULL) ? static_cast(d->isExternalDistribution()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Distribution.h b/generator/tests/test_cpp_code/test-code/Distribution.h index 5446a61c..f5c5f3ac 100644 --- a/generator/tests/test_cpp_code/test-code/Distribution.h +++ b/generator/tests/test_cpp_code/test-code/Distribution.h @@ -1,1123 +1,1123 @@ -/** - * @file Distribution.h - * @brief Definition of the Distribution class. - * @author SBMLTeam - * - * - * - * @class Distribution - * @sbmlbrief{distrib} TODO:Definition of the Distribution class. - */ - - -#ifndef Distribution_H__ -#define Distribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class BetaDistribution; -class CauchyDistribution; -class ExponentialDistribution; -class LogisticDistribution; -class NormalDistribution; -class BinomialDistribution; -class GeometricDistribution; -class BernoulliDistribution; -class CategoricalDistribution; -class MultivariateDistribution; -class ExternalDistribution; - -class LIBSBML_EXTERN Distribution : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new Distribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - Distribution(unsigned int level = DistribExtension::getDefaultLevel(), - unsigned int version = DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Distribution using the given DistribPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Distribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for Distribution. - * - * @param orig the Distribution instance to copy. - */ - Distribution(const Distribution& orig); - - - /** - * Assignment operator for Distribution. - * - * @param rhs the Distribution object whose values are to be used as the - * basis of the assignment. - */ - Distribution& operator=(const Distribution& rhs); - - - /** - * Creates and returns a deep copy of this Distribution object. - * - * @return a (deep) copy of this Distribution object. - */ - virtual Distribution* clone() const; - - - /** - * Destructor for Distribution. - */ - virtual ~Distribution(); - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * BetaDistribution - * - * @return @c true if this abstract "Distribution" is of type - * BetaDistribution, @c false otherwise - */ - virtual bool isBetaDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * CauchyDistribution - * - * @return @c true if this abstract "Distribution" is of type - * CauchyDistribution, @c false otherwise - */ - virtual bool isCauchyDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * ExponentialDistribution - * - * @return @c true if this abstract "Distribution" is of type - * ExponentialDistribution, @c false otherwise - */ - virtual bool isExponentialDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * LogisticDistribution - * - * @return @c true if this abstract "Distribution" is of type - * LogisticDistribution, @c false otherwise - */ - virtual bool isLogisticDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * NormalDistribution - * - * @return @c true if this abstract "Distribution" is of type - * NormalDistribution, @c false otherwise - */ - virtual bool isNormalDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * BinomialDistribution - * - * @return @c true if this abstract "Distribution" is of type - * BinomialDistribution, @c false otherwise - */ - virtual bool isBinomialDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * GeometricDistribution - * - * @return @c true if this abstract "Distribution" is of type - * GeometricDistribution, @c false otherwise - */ - virtual bool isGeometricDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * BernoulliDistribution - * - * @return @c true if this abstract "Distribution" is of type - * BernoulliDistribution, @c false otherwise - */ - virtual bool isBernoulliDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * CategoricalDistribution - * - * @return @c true if this abstract "Distribution" is of type - * CategoricalDistribution, @c false otherwise - */ - virtual bool isCategoricalDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * MultivariateDistribution - * - * @return @c true if this abstract "Distribution" is of type - * MultivariateDistribution, @c false otherwise - */ - virtual bool isMultivariateDistribution() const; - - - /** - * Predicate returning @c true if this abstract "Distribution" is of type - * ExternalDistribution - * - * @return @c true if this abstract "Distribution" is of type - * ExternalDistribution, @c false otherwise - */ - virtual bool isExternalDistribution() const; - - - /** - * Returns the XML element name of this Distribution object. - * - * For Distribution, the XML element name is always @c "distribution". - * - * @return the name of this element, i.e. @c "distribution". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this Distribution object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this Distribution object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_DISTRIBUTION, SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Distribution's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Distribution's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Distribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new BetaDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -BetaDistribution_t * -Distribution_createBetaDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CauchyDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -CauchyDistribution_t * -Distribution_createCauchyDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new ExponentialDistribution using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -ExponentialDistribution_t * -Distribution_createExponentialDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new LogisticDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -LogisticDistribution_t * -Distribution_createLogisticDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new NormalDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -NormalDistribution_t * -Distribution_createNormalDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new BinomialDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -BinomialDistribution_t * -Distribution_createBinomialDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new GeometricDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -GeometricDistribution_t * -Distribution_createGeometricDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new BernoulliDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -BernoulliDistribution_t * -Distribution_createBernoulliDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CategoricalDistribution using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -CategoricalDistribution_t * -Distribution_createCategoricalDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new MultivariateDistribution using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -MultivariateDistribution_t * -Distribution_createMultivariateDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new ExternalDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * Distribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Distribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this Distribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -ExternalDistribution_t * -Distribution_createExternalDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Distribution_t object. - * - * @param d the Distribution_t structure. - * - * @return a (deep) copy of this Distribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -Distribution_t* -Distribution_clone(const Distribution_t* d); - - -/** - * Frees this Distribution_t object. - * - * @param d the Distribution_t structure. - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -void -Distribution_free(Distribution_t* d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * BetaDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type BetaDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isBetaDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * CauchyDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type CauchyDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isCauchyDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * ExponentialDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type ExponentialDistribution_t, - * @c 0 otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isExponentialDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * LogisticDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type LogisticDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isLogisticDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * NormalDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type NormalDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isNormalDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * BinomialDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type BinomialDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isBinomialDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * GeometricDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type GeometricDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isGeometricDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * BernoulliDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type BernoulliDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isBernoulliDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * CategoricalDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type CategoricalDistribution_t, - * @c 0 otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isCategoricalDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * MultivariateDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type MultivariateDistribution_t, - * @c 0 otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isMultivariateDistribution(const Distribution_t * d); - - -/** - * Predicate returning @c 1 if this Distribution_t is of type - * ExternalDistribution_t - * - * @param d the Distribution_t structure. - * - * @return @c 1 if this Distribution_t is of type ExternalDistribution_t, @c 0 - * otherwise - * - * @memberof Distribution_t - */ -LIBSBML_EXTERN -int -Distribution_isExternalDistribution(const Distribution_t * d); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Distribution_H__ */ - - +/** + * @file Distribution.h + * @brief Definition of the Distribution class. + * @author SBMLTeam + * + * + * + * @class Distribution + * @sbmlbrief{distrib} TODO:Definition of the Distribution class. + */ + + +#ifndef Distribution_H__ +#define Distribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class BetaDistribution; +class CauchyDistribution; +class ExponentialDistribution; +class LogisticDistribution; +class NormalDistribution; +class BinomialDistribution; +class GeometricDistribution; +class BernoulliDistribution; +class CategoricalDistribution; +class MultivariateDistribution; +class ExternalDistribution; + +class LIBSBML_EXTERN Distribution : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new Distribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + Distribution(unsigned int level = DistribExtension::getDefaultLevel(), + unsigned int version = DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Distribution using the given DistribPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Distribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for Distribution. + * + * @param orig the Distribution instance to copy. + */ + Distribution(const Distribution& orig); + + + /** + * Assignment operator for Distribution. + * + * @param rhs the Distribution object whose values are to be used as the + * basis of the assignment. + */ + Distribution& operator=(const Distribution& rhs); + + + /** + * Creates and returns a deep copy of this Distribution object. + * + * @return a (deep) copy of this Distribution object. + */ + virtual Distribution* clone() const; + + + /** + * Destructor for Distribution. + */ + virtual ~Distribution(); + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * BetaDistribution + * + * @return @c true if this abstract "Distribution" is of type + * BetaDistribution, @c false otherwise + */ + virtual bool isBetaDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * CauchyDistribution + * + * @return @c true if this abstract "Distribution" is of type + * CauchyDistribution, @c false otherwise + */ + virtual bool isCauchyDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * ExponentialDistribution + * + * @return @c true if this abstract "Distribution" is of type + * ExponentialDistribution, @c false otherwise + */ + virtual bool isExponentialDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * LogisticDistribution + * + * @return @c true if this abstract "Distribution" is of type + * LogisticDistribution, @c false otherwise + */ + virtual bool isLogisticDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * NormalDistribution + * + * @return @c true if this abstract "Distribution" is of type + * NormalDistribution, @c false otherwise + */ + virtual bool isNormalDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * BinomialDistribution + * + * @return @c true if this abstract "Distribution" is of type + * BinomialDistribution, @c false otherwise + */ + virtual bool isBinomialDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * GeometricDistribution + * + * @return @c true if this abstract "Distribution" is of type + * GeometricDistribution, @c false otherwise + */ + virtual bool isGeometricDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * BernoulliDistribution + * + * @return @c true if this abstract "Distribution" is of type + * BernoulliDistribution, @c false otherwise + */ + virtual bool isBernoulliDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * CategoricalDistribution + * + * @return @c true if this abstract "Distribution" is of type + * CategoricalDistribution, @c false otherwise + */ + virtual bool isCategoricalDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * MultivariateDistribution + * + * @return @c true if this abstract "Distribution" is of type + * MultivariateDistribution, @c false otherwise + */ + virtual bool isMultivariateDistribution() const; + + + /** + * Predicate returning @c true if this abstract "Distribution" is of type + * ExternalDistribution + * + * @return @c true if this abstract "Distribution" is of type + * ExternalDistribution, @c false otherwise + */ + virtual bool isExternalDistribution() const; + + + /** + * Returns the XML element name of this Distribution object. + * + * For Distribution, the XML element name is always @c "distribution". + * + * @return the name of this element, i.e. @c "distribution". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this Distribution object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this Distribution object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_DISTRIBUTION, SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Distribution's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Distribution's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Distribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new BetaDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +BetaDistribution_t * +Distribution_createBetaDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CauchyDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +CauchyDistribution_t * +Distribution_createCauchyDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new ExponentialDistribution using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +ExponentialDistribution_t * +Distribution_createExponentialDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new LogisticDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +LogisticDistribution_t * +Distribution_createLogisticDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new NormalDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +NormalDistribution_t * +Distribution_createNormalDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new BinomialDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +BinomialDistribution_t * +Distribution_createBinomialDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new GeometricDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +GeometricDistribution_t * +Distribution_createGeometricDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new BernoulliDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +BernoulliDistribution_t * +Distribution_createBernoulliDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CategoricalDistribution using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +CategoricalDistribution_t * +Distribution_createCategoricalDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new MultivariateDistribution using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +MultivariateDistribution_t * +Distribution_createMultivariateDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new ExternalDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * Distribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Distribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this Distribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +ExternalDistribution_t * +Distribution_createExternalDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Distribution_t object. + * + * @param d the Distribution_t structure. + * + * @return a (deep) copy of this Distribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +Distribution_t* +Distribution_clone(const Distribution_t* d); + + +/** + * Frees this Distribution_t object. + * + * @param d the Distribution_t structure. + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +void +Distribution_free(Distribution_t* d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * BetaDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type BetaDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isBetaDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * CauchyDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type CauchyDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isCauchyDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * ExponentialDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type ExponentialDistribution_t, + * @c 0 otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isExponentialDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * LogisticDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type LogisticDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isLogisticDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * NormalDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type NormalDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isNormalDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * BinomialDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type BinomialDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isBinomialDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * GeometricDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type GeometricDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isGeometricDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * BernoulliDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type BernoulliDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isBernoulliDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * CategoricalDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type CategoricalDistribution_t, + * @c 0 otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isCategoricalDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * MultivariateDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type MultivariateDistribution_t, + * @c 0 otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isMultivariateDistribution(const Distribution_t * d); + + +/** + * Predicate returning @c 1 if this Distribution_t is of type + * ExternalDistribution_t + * + * @param d the Distribution_t structure. + * + * @return @c 1 if this Distribution_t is of type ExternalDistribution_t, @c 0 + * otherwise + * + * @memberof Distribution_t + */ +LIBSBML_EXTERN +int +Distribution_isExternalDistribution(const Distribution_t * d); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Distribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/DrawFromDistribution.cpp b/generator/tests/test_cpp_code/test-code/DrawFromDistribution.cpp index a82f5627..4564d95c 100644 --- a/generator/tests/test_cpp_code/test-code/DrawFromDistribution.cpp +++ b/generator/tests/test_cpp_code/test-code/DrawFromDistribution.cpp @@ -1,1977 +1,1977 @@ -/** - * @file DrawFromDistribution.cpp - * @brief Implementation of the DrawFromDistribution class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new DrawFromDistribution using the given SBML Level, Version and - * “distrib” package version. - */ -DrawFromDistribution::DrawFromDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mDistribInputs (level, version, pkgVersion) - , mDistribution (NULL) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new DrawFromDistribution using the given DistribPkgNamespaces - * object. - */ -DrawFromDistribution::DrawFromDistribution(DistribPkgNamespaces *distribns) - : SBase(distribns) - , mDistribInputs (distribns) - , mDistribution (NULL) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for DrawFromDistribution. - */ -DrawFromDistribution::DrawFromDistribution(const DrawFromDistribution& orig) - : SBase( orig ) - , mDistribInputs ( orig.mDistribInputs ) - , mDistribution ( NULL ) -{ - if (orig.mDistribution != NULL) - { - mDistribution = orig.mDistribution->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for DrawFromDistribution. - */ -DrawFromDistribution& -DrawFromDistribution::operator=(const DrawFromDistribution& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mDistribInputs = rhs.mDistribInputs; - delete mDistribution; - if (rhs.mDistribution != NULL) - { - mDistribution = rhs.mDistribution->clone(); - } - else - { - mDistribution = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this DrawFromDistribution object. - */ -DrawFromDistribution* -DrawFromDistribution::clone() const -{ - return new DrawFromDistribution(*this); -} - - -/* - * Destructor for DrawFromDistribution. - */ -DrawFromDistribution::~DrawFromDistribution() -{ - delete mDistribution; - mDistribution = NULL; -} - - -/* - * Returns the value of the "distribution" element of this - * DrawFromDistribution. - */ -const Distribution* -DrawFromDistribution::getDistribution() const -{ - return mDistribution; -} - - -/* - * Returns the value of the "distribution" element of this - * DrawFromDistribution. - */ -Distribution* -DrawFromDistribution::getDistribution() -{ - return mDistribution; -} - - -/* - * Predicate returning @c true if this DrawFromDistribution's "distribution" - * element is set. - */ -bool -DrawFromDistribution::isSetDistribution() const -{ - return (mDistribution != NULL); -} - - -/* - * Sets the value of the "distribution" element of this DrawFromDistribution. - */ -int -DrawFromDistribution::setDistribution(const Distribution* distribution) -{ - if (mDistribution == distribution) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (distribution == NULL) - { - delete mDistribution; - mDistribution = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mDistribution; - mDistribution = (distribution != NULL) ? distribution->clone() : NULL; - if (mDistribution != NULL) - { - mDistribution->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new BetaDistribution object, adds it to this DrawFromDistribution - * object and returns the BetaDistribution object created. - */ -BetaDistribution* -DrawFromDistribution::createBetaDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new BetaDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new CauchyDistribution object, adds it to this - * DrawFromDistribution object and returns the CauchyDistribution object - * created. - */ -CauchyDistribution* -DrawFromDistribution::createCauchyDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new CauchyDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new ExponentialDistribution object, adds it to this - * DrawFromDistribution object and returns the ExponentialDistribution object - * created. - */ -ExponentialDistribution* -DrawFromDistribution::createExponentialDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new ExponentialDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new LogisticDistribution object, adds it to this - * DrawFromDistribution object and returns the LogisticDistribution object - * created. - */ -LogisticDistribution* -DrawFromDistribution::createLogisticDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new LogisticDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new NormalDistribution object, adds it to this - * DrawFromDistribution object and returns the NormalDistribution object - * created. - */ -NormalDistribution* -DrawFromDistribution::createNormalDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new NormalDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new BinomialDistribution object, adds it to this - * DrawFromDistribution object and returns the BinomialDistribution object - * created. - */ -BinomialDistribution* -DrawFromDistribution::createBinomialDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new BinomialDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new GeometricDistribution object, adds it to this - * DrawFromDistribution object and returns the GeometricDistribution object - * created. - */ -GeometricDistribution* -DrawFromDistribution::createGeometricDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new GeometricDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new BernoulliDistribution object, adds it to this - * DrawFromDistribution object and returns the BernoulliDistribution object - * created. - */ -BernoulliDistribution* -DrawFromDistribution::createBernoulliDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new BernoulliDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new CategoricalDistribution object, adds it to this - * DrawFromDistribution object and returns the CategoricalDistribution object - * created. - */ -CategoricalDistribution* -DrawFromDistribution::createCategoricalDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new CategoricalDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new MultivariateDistribution object, adds it to this - * DrawFromDistribution object and returns the MultivariateDistribution object - * created. - */ -MultivariateDistribution* -DrawFromDistribution::createMultivariateDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new MultivariateDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Creates a new ExternalDistribution object, adds it to this - * DrawFromDistribution object and returns the ExternalDistribution object - * created. - */ -ExternalDistribution* -DrawFromDistribution::createExternalDistribution() -{ - if (mDistribution != NULL) - { - delete mDistribution; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mDistribution = new ExternalDistribution(distribns); - - delete distribns; - - connectToChild(); - - return static_cast(mDistribution); -} - - -/* - * Unsets the value of the "distribution" element of this DrawFromDistribution. - */ -int -DrawFromDistribution::unsetDistribution() -{ - delete mDistribution; - mDistribution = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the ListOfDistribInputs from this DrawFromDistribution. - */ -const ListOfDistribInputs* -DrawFromDistribution::getListOfDistribInputs() const -{ - return &mDistribInputs; -} - - -/* - * Returns the ListOfDistribInputs from this DrawFromDistribution. - */ -ListOfDistribInputs* -DrawFromDistribution::getListOfDistribInputs() -{ - return &mDistribInputs; -} - - -/* - * Get a DistribInput from the DrawFromDistribution. - */ -DistribInput* -DrawFromDistribution::getDistribInput(unsigned int n) -{ - return mDistribInputs.get(n); -} - - -/* - * Get a DistribInput from the DrawFromDistribution. - */ -const DistribInput* -DrawFromDistribution::getDistribInput(unsigned int n) const -{ - return mDistribInputs.get(n); -} - - -/* - * Get a DistribInput from the DrawFromDistribution based on its identifier. - */ -DistribInput* -DrawFromDistribution::getDistribInput(const std::string& sid) -{ - return mDistribInputs.get(sid); -} - - -/* - * Get a DistribInput from the DrawFromDistribution based on its identifier. - */ -const DistribInput* -DrawFromDistribution::getDistribInput(const std::string& sid) const -{ - return mDistribInputs.get(sid); -} - - -/* - * Adds a copy of the given DistribInput to this DrawFromDistribution. - */ -int -DrawFromDistribution::addDistribInput(const DistribInput* di) -{ - if (di == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (di->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != di->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != di->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(di)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (di->isSetId() && (mDistribInputs.get(di->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mDistribInputs.append(di); - } -} - - -/* - * Get the number of DistribInput objects in this DrawFromDistribution. - */ -unsigned int -DrawFromDistribution::getNumDistribInputs() const -{ - return mDistribInputs.size(); -} - - -/* - * Creates a new DistribInput object, adds it to this DrawFromDistribution - * object and returns the DistribInput object created. - */ -DistribInput* -DrawFromDistribution::createDistribInput() -{ - DistribInput* di = NULL; - - try - { - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - di = new DistribInput(distribns); - delete distribns; - } - catch (...) - { - } - - if (di != NULL) - { - mDistribInputs.appendAndOwn(di); - } - - return di; -} - - -/* - * Removes the nth DistribInput from this DrawFromDistribution and returns a - * pointer to it. - */ -DistribInput* -DrawFromDistribution::removeDistribInput(unsigned int n) -{ - return mDistribInputs.remove(n); -} - - -/* - * Removes the DistribInput from this DrawFromDistribution based on its - * identifier and returns a pointer to it. - */ -DistribInput* -DrawFromDistribution::removeDistribInput(const std::string& sid) -{ - return mDistribInputs.remove(sid); -} - - -/* - * Returns the XML element name of this DrawFromDistribution object. - */ -const std::string& -DrawFromDistribution::getElementName() const -{ - static const string name = "drawFromDistribution"; - return name; -} - - -/* - * Returns the libSBML type code for this DrawFromDistribution object. - */ -int -DrawFromDistribution::getTypeCode() const -{ - return SBML_DISTRIB_DRAWFROMDISTRIBUTION; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -DrawFromDistribution::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetDistribution() == true) - { - mDistribution->write(stream); - } - - if (getNumDistribInputs() > 0) - { - mDistribInputs.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -DrawFromDistribution::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mDistribution != NULL) - { - mDistribution->accept(v); - } - - mDistribInputs.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -DrawFromDistribution::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mDistribution != NULL) - { - mDistribution->setSBMLDocument(d); - } - - mDistribInputs.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -DrawFromDistribution::connectToChild() -{ - SBase::connectToChild(); - - if (mDistribution != NULL) - { - mDistribution->connectToParent(this); - } - - mDistribInputs.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -DrawFromDistribution::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetDistribution()) - { - mDistribution->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - mDistribInputs.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -DrawFromDistribution::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mDistribution != NULL) - { - mDistribution->updateSBMLNamespace(package, level, version); - } - - mDistribInputs.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this DrawFromDistribution's attribute - * "attributeName" is set. - */ -bool -DrawFromDistribution::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::setAttribute(const std::string& attributeName, - int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * DrawFromDistribution. - */ -int -DrawFromDistribution::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this - * DrawFromDistribution. - */ -SBase* -DrawFromDistribution::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "betaDistribution") - { - return createBetaDistribution(); - } - else if (elementName == "cauchyDistribution") - { - return createCauchyDistribution(); - } - else if (elementName == "exponentialDistribution") - { - return createExponentialDistribution(); - } - else if (elementName == "logisticDistribution") - { - return createLogisticDistribution(); - } - else if (elementName == "normalDistribution") - { - return createNormalDistribution(); - } - else if (elementName == "binomialDistribution") - { - return createBinomialDistribution(); - } - else if (elementName == "geometricDistribution") - { - return createGeometricDistribution(); - } - else if (elementName == "bernoulliDistribution") - { - return createBernoulliDistribution(); - } - else if (elementName == "categoricalDistribution") - { - return createCategoricalDistribution(); - } - else if (elementName == "multivariateDistribution") - { - return createMultivariateDistribution(); - } - else if (elementName == "externalDistribution") - { - return createExternalDistribution(); - } - else if (elementName == "distribInput") - { - return createDistribInput(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this DrawFromDistribution. - */ -int -DrawFromDistribution::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "betaDistribution" && element->getTypeCode() == - SBML_DISTRIB_BETADISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "cauchyDistribution" && element->getTypeCode() == - SBML_DISTRIB_CAUCHYDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "exponentialDistribution" && element->getTypeCode() - == SBML_DISTRIB_EXPONENTIALDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "logisticDistribution" && element->getTypeCode() == - SBML_DISTRIB_LOGISTICDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "normalDistribution" && element->getTypeCode() == - SBML_DISTRIB_NORMALDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "binomialDistribution" && element->getTypeCode() == - SBML_DISTRIB_BINOMIALDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "geometricDistribution" && element->getTypeCode() == - SBML_DISTRIB_GEOMETRICLDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "bernoulliDistribution" && element->getTypeCode() == - SBML_DISTRIB_BERNOULLIDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "categoricalDistribution" && element->getTypeCode() - == SBML_DISTRIB_CATEGORICALDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "multivariateDistribution" && element->getTypeCode() - == SBML_DISTRIB_MULTIVARIATEDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "externalDistribution" && element->getTypeCode() == - SBML_DISTRIB_EXTERNALDISTRIBUTION) - { - return setDistribution((const Distribution*)(element)); - } - else if (elementName == "distribInput" && element->getTypeCode() == - SBML_DISTRIB_DISTRIBINPUT) - { - return addDistribInput((const DistribInput*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * DrawFromDistribution. - */ -SBase* -DrawFromDistribution::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "betaDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "cauchyDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "exponentialDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "logisticDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "normalDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "binomialDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "geometricDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "bernoulliDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "categoricalDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "multivariateDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "externalDistribution") - { - Distribution * obj = mDistribution; - mDistribution = NULL; - return obj; - } - else if (elementName == "distribInput") - { - return removeDistribInput(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this DrawFromDistribution. - */ -unsigned int -DrawFromDistribution::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "distribution") - { - if (isSetDistribution()) - { - return 1; - } - } - else if (elementName == "distribInput") - { - return getNumDistribInputs(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this DrawFromDistribution. - */ -SBase* -DrawFromDistribution::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "distribution") - { - return getDistribution(); - } - else if (elementName == "distribInput") - { - return getDistribInput(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -DrawFromDistribution::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mDistribution != NULL) - { - if (mDistribution->getId() == id) - { - return mDistribution; - } - - obj = mDistribution->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mDistribInputs.getId() == id) - { - return &mDistribInputs; - } - - obj = mDistribInputs.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -DrawFromDistribution::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mDistribution != NULL) - { - if (mDistribution->getMetaId() == metaid) - { - return mDistribution; - } - - obj = mDistribution->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mDistribInputs.getMetaId() == metaid) - { - return &mDistribInputs; - } - - obj = mDistribInputs.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -DrawFromDistribution::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mDistribution, filter); - - ADD_FILTERED_LIST(ret, sublist, mDistribInputs, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -DrawFromDistribution::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - - if (name == "betaDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new BetaDistribution(distribns); - obj = mDistribution; - } - else if (name == "cauchyDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new CauchyDistribution(distribns); - obj = mDistribution; - } - else if (name == "exponentialDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new ExponentialDistribution(distribns); - obj = mDistribution; - } - else if (name == "logisticDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new LogisticDistribution(distribns); - obj = mDistribution; - } - else if (name == "normalDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new NormalDistribution(distribns); - obj = mDistribution; - } - else if (name == "binomialDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new BinomialDistribution(distribns); - obj = mDistribution; - } - else if (name == "geometricDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new GeometricDistribution(distribns); - obj = mDistribution; - } - else if (name == "bernoulliDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new BernoulliDistribution(distribns); - obj = mDistribution; - } - else if (name == "categoricalDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new CategoricalDistribution(distribns); - obj = mDistribution; - } - else if (name == "multivariateDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new MultivariateDistribution(distribns); - obj = mDistribution; - } - else if (name == "externalDistribution") - { - if (getErrorLog() && isSetDistribution()) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mDistribution; - mDistribution = new ExternalDistribution(distribns); - obj = mDistribution; - } - - if (name == "listOfDistribInputs") - { - if (getErrorLog() && mDistribInputs.size() != 0) - { - getErrorLog()->logPackageError("distrib", - DistribDrawFromDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - obj = &mDistribInputs; - } - - delete distribns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new DrawFromDistribution_t using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -DrawFromDistribution_t * -DrawFromDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new DrawFromDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this DrawFromDistribution_t object. - */ -LIBSBML_EXTERN -DrawFromDistribution_t* -DrawFromDistribution_clone(const DrawFromDistribution_t* dfd) -{ - if (dfd != NULL) - { - return static_cast(dfd->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this DrawFromDistribution_t object. - */ -LIBSBML_EXTERN -void -DrawFromDistribution_free(DrawFromDistribution_t* dfd) -{ - if (dfd != NULL) - { - delete dfd; - } -} - - -/* - * Returns the value of the "distribution" element of this - * DrawFromDistribution_t. - */ -LIBSBML_EXTERN -const Distribution_t* -DrawFromDistribution_getDistribution(const DrawFromDistribution_t * dfd) -{ - if (dfd == NULL) - { - return NULL; - } - - return (Distribution_t*)(dfd->getDistribution()); -} - - -/* - * Predicate returning @c 1 (true) if this DrawFromDistribution_t's - * "distribution" element is set. - */ -LIBSBML_EXTERN -int -DrawFromDistribution_isSetDistribution(const DrawFromDistribution_t * dfd) -{ - return (dfd != NULL) ? static_cast(dfd->isSetDistribution()) : 0; -} - - -/* - * Sets the value of the "distribution" element of this DrawFromDistribution_t. - */ -LIBSBML_EXTERN -int -DrawFromDistribution_setDistribution(DrawFromDistribution_t * dfd, - const Distribution_t* distribution) -{ - return (dfd != NULL) ? dfd->setDistribution(distribution) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new BetaDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the BetaDistribution_t object - * created. - */ -LIBSBML_EXTERN -BetaDistribution_t* -DrawFromDistribution_createBetaDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createBetaDistribution() : NULL; -} - - -/* - * Creates a new CauchyDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the CauchyDistribution_t object - * created. - */ -LIBSBML_EXTERN -CauchyDistribution_t* -DrawFromDistribution_createCauchyDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createCauchyDistribution() : NULL; -} - - -/* - * Creates a new ExponentialDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the ExponentialDistribution_t - * object created. - */ -LIBSBML_EXTERN -ExponentialDistribution_t* -DrawFromDistribution_createExponentialDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createExponentialDistribution() : NULL; -} - - -/* - * Creates a new LogisticDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the LogisticDistribution_t object - * created. - */ -LIBSBML_EXTERN -LogisticDistribution_t* -DrawFromDistribution_createLogisticDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createLogisticDistribution() : NULL; -} - - -/* - * Creates a new NormalDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the NormalDistribution_t object - * created. - */ -LIBSBML_EXTERN -NormalDistribution_t* -DrawFromDistribution_createNormalDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createNormalDistribution() : NULL; -} - - -/* - * Creates a new BinomialDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the BinomialDistribution_t object - * created. - */ -LIBSBML_EXTERN -BinomialDistribution_t* -DrawFromDistribution_createBinomialDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createBinomialDistribution() : NULL; -} - - -/* - * Creates a new GeometricDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the GeometricDistribution_t object - * created. - */ -LIBSBML_EXTERN -GeometricDistribution_t* -DrawFromDistribution_createGeometricDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createGeometricDistribution() : NULL; -} - - -/* - * Creates a new BernoulliDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the BernoulliDistribution_t object - * created. - */ -LIBSBML_EXTERN -BernoulliDistribution_t* -DrawFromDistribution_createBernoulliDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createBernoulliDistribution() : NULL; -} - - -/* - * Creates a new CategoricalDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the CategoricalDistribution_t - * object created. - */ -LIBSBML_EXTERN -CategoricalDistribution_t* -DrawFromDistribution_createCategoricalDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createCategoricalDistribution() : NULL; -} - - -/* - * Creates a new MultivariateDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the MultivariateDistribution_t - * object created. - */ -LIBSBML_EXTERN -MultivariateDistribution_t* -DrawFromDistribution_createMultivariateDistribution(DrawFromDistribution_t* - dfd) -{ - return (dfd != NULL) ? dfd->createMultivariateDistribution() : NULL; -} - - -/* - * Creates a new ExternalDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the ExternalDistribution_t object - * created. - */ -LIBSBML_EXTERN -ExternalDistribution_t* -DrawFromDistribution_createExternalDistribution(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createExternalDistribution() : NULL; -} - - -/* - * Unsets the value of the "distribution" element of this - * DrawFromDistribution_t. - */ -LIBSBML_EXTERN -int -DrawFromDistribution_unsetDistribution(DrawFromDistribution_t * dfd) -{ - return (dfd != NULL) ? dfd->unsetDistribution() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing DistribInput_t objects from this - * DrawFromDistribution_t. - */ -LIBSBML_EXTERN -ListOf_t* -DrawFromDistribution_getListOfDistribInputs(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->getListOfDistribInputs() : NULL; -} - - -/* - * Get a DistribInput_t from the DrawFromDistribution_t. - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_getDistribInput(DrawFromDistribution_t* dfd, - unsigned int n) -{ - return (dfd != NULL) ? dfd->getDistribInput(n) : NULL; -} - - -/* - * Get a DistribInput_t from the DrawFromDistribution_t based on its - * identifier. - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_getDistribInputById(DrawFromDistribution_t* dfd, - const char *sid) -{ - return (dfd != NULL && sid != NULL) ? dfd->getDistribInput(sid) : NULL; -} - - -/* - * Adds a copy of the given DistribInput_t to this DrawFromDistribution_t. - */ -LIBSBML_EXTERN -int -DrawFromDistribution_addDistribInput(DrawFromDistribution_t* dfd, - const DistribInput_t* di) -{ - return (dfd != NULL) ? dfd->addDistribInput(di) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of DistribInput_t objects in this DrawFromDistribution_t. - */ -LIBSBML_EXTERN -unsigned int -DrawFromDistribution_getNumDistribInputs(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->getNumDistribInputs() : SBML_INT_MAX; -} - - -/* - * Creates a new DistribInput_t object, adds it to this DrawFromDistribution_t - * object and returns the DistribInput_t object created. - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_createDistribInput(DrawFromDistribution_t* dfd) -{ - return (dfd != NULL) ? dfd->createDistribInput() : NULL; -} - - -/* - * Removes the nth DistribInput_t from this DrawFromDistribution_t and returns - * a pointer to it. - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_removeDistribInput(DrawFromDistribution_t* dfd, - unsigned int n) -{ - return (dfd != NULL) ? dfd->removeDistribInput(n) : NULL; -} - - -/* - * Removes the DistribInput_t from this DrawFromDistribution_t based on its - * identifier and returns a pointer to it. - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_removeDistribInputById(DrawFromDistribution_t* dfd, - const char* sid) -{ - return (dfd != NULL && sid != NULL) ? dfd->removeDistribInput(sid) : NULL; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file DrawFromDistribution.cpp + * @brief Implementation of the DrawFromDistribution class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new DrawFromDistribution using the given SBML Level, Version and + * “distrib” package version. + */ +DrawFromDistribution::DrawFromDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mDistribInputs (level, version, pkgVersion) + , mDistribution (NULL) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new DrawFromDistribution using the given DistribPkgNamespaces + * object. + */ +DrawFromDistribution::DrawFromDistribution(DistribPkgNamespaces *distribns) + : SBase(distribns) + , mDistribInputs (distribns) + , mDistribution (NULL) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for DrawFromDistribution. + */ +DrawFromDistribution::DrawFromDistribution(const DrawFromDistribution& orig) + : SBase( orig ) + , mDistribInputs ( orig.mDistribInputs ) + , mDistribution ( NULL ) +{ + if (orig.mDistribution != NULL) + { + mDistribution = orig.mDistribution->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for DrawFromDistribution. + */ +DrawFromDistribution& +DrawFromDistribution::operator=(const DrawFromDistribution& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mDistribInputs = rhs.mDistribInputs; + delete mDistribution; + if (rhs.mDistribution != NULL) + { + mDistribution = rhs.mDistribution->clone(); + } + else + { + mDistribution = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this DrawFromDistribution object. + */ +DrawFromDistribution* +DrawFromDistribution::clone() const +{ + return new DrawFromDistribution(*this); +} + + +/* + * Destructor for DrawFromDistribution. + */ +DrawFromDistribution::~DrawFromDistribution() +{ + delete mDistribution; + mDistribution = NULL; +} + + +/* + * Returns the value of the "distribution" element of this + * DrawFromDistribution. + */ +const Distribution* +DrawFromDistribution::getDistribution() const +{ + return mDistribution; +} + + +/* + * Returns the value of the "distribution" element of this + * DrawFromDistribution. + */ +Distribution* +DrawFromDistribution::getDistribution() +{ + return mDistribution; +} + + +/* + * Predicate returning @c true if this DrawFromDistribution's "distribution" + * element is set. + */ +bool +DrawFromDistribution::isSetDistribution() const +{ + return (mDistribution != NULL); +} + + +/* + * Sets the value of the "distribution" element of this DrawFromDistribution. + */ +int +DrawFromDistribution::setDistribution(const Distribution* distribution) +{ + if (mDistribution == distribution) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (distribution == NULL) + { + delete mDistribution; + mDistribution = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mDistribution; + mDistribution = (distribution != NULL) ? distribution->clone() : NULL; + if (mDistribution != NULL) + { + mDistribution->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new BetaDistribution object, adds it to this DrawFromDistribution + * object and returns the BetaDistribution object created. + */ +BetaDistribution* +DrawFromDistribution::createBetaDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new BetaDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new CauchyDistribution object, adds it to this + * DrawFromDistribution object and returns the CauchyDistribution object + * created. + */ +CauchyDistribution* +DrawFromDistribution::createCauchyDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new CauchyDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new ExponentialDistribution object, adds it to this + * DrawFromDistribution object and returns the ExponentialDistribution object + * created. + */ +ExponentialDistribution* +DrawFromDistribution::createExponentialDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new ExponentialDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new LogisticDistribution object, adds it to this + * DrawFromDistribution object and returns the LogisticDistribution object + * created. + */ +LogisticDistribution* +DrawFromDistribution::createLogisticDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new LogisticDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new NormalDistribution object, adds it to this + * DrawFromDistribution object and returns the NormalDistribution object + * created. + */ +NormalDistribution* +DrawFromDistribution::createNormalDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new NormalDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new BinomialDistribution object, adds it to this + * DrawFromDistribution object and returns the BinomialDistribution object + * created. + */ +BinomialDistribution* +DrawFromDistribution::createBinomialDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new BinomialDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new GeometricDistribution object, adds it to this + * DrawFromDistribution object and returns the GeometricDistribution object + * created. + */ +GeometricDistribution* +DrawFromDistribution::createGeometricDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new GeometricDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new BernoulliDistribution object, adds it to this + * DrawFromDistribution object and returns the BernoulliDistribution object + * created. + */ +BernoulliDistribution* +DrawFromDistribution::createBernoulliDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new BernoulliDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new CategoricalDistribution object, adds it to this + * DrawFromDistribution object and returns the CategoricalDistribution object + * created. + */ +CategoricalDistribution* +DrawFromDistribution::createCategoricalDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new CategoricalDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new MultivariateDistribution object, adds it to this + * DrawFromDistribution object and returns the MultivariateDistribution object + * created. + */ +MultivariateDistribution* +DrawFromDistribution::createMultivariateDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new MultivariateDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Creates a new ExternalDistribution object, adds it to this + * DrawFromDistribution object and returns the ExternalDistribution object + * created. + */ +ExternalDistribution* +DrawFromDistribution::createExternalDistribution() +{ + if (mDistribution != NULL) + { + delete mDistribution; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mDistribution = new ExternalDistribution(distribns); + + delete distribns; + + connectToChild(); + + return static_cast(mDistribution); +} + + +/* + * Unsets the value of the "distribution" element of this DrawFromDistribution. + */ +int +DrawFromDistribution::unsetDistribution() +{ + delete mDistribution; + mDistribution = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the ListOfDistribInputs from this DrawFromDistribution. + */ +const ListOfDistribInputs* +DrawFromDistribution::getListOfDistribInputs() const +{ + return &mDistribInputs; +} + + +/* + * Returns the ListOfDistribInputs from this DrawFromDistribution. + */ +ListOfDistribInputs* +DrawFromDistribution::getListOfDistribInputs() +{ + return &mDistribInputs; +} + + +/* + * Get a DistribInput from the DrawFromDistribution. + */ +DistribInput* +DrawFromDistribution::getDistribInput(unsigned int n) +{ + return mDistribInputs.get(n); +} + + +/* + * Get a DistribInput from the DrawFromDistribution. + */ +const DistribInput* +DrawFromDistribution::getDistribInput(unsigned int n) const +{ + return mDistribInputs.get(n); +} + + +/* + * Get a DistribInput from the DrawFromDistribution based on its identifier. + */ +DistribInput* +DrawFromDistribution::getDistribInput(const std::string& sid) +{ + return mDistribInputs.get(sid); +} + + +/* + * Get a DistribInput from the DrawFromDistribution based on its identifier. + */ +const DistribInput* +DrawFromDistribution::getDistribInput(const std::string& sid) const +{ + return mDistribInputs.get(sid); +} + + +/* + * Adds a copy of the given DistribInput to this DrawFromDistribution. + */ +int +DrawFromDistribution::addDistribInput(const DistribInput* di) +{ + if (di == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (di->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != di->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != di->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(di)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (di->isSetId() && (mDistribInputs.get(di->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mDistribInputs.append(di); + } +} + + +/* + * Get the number of DistribInput objects in this DrawFromDistribution. + */ +unsigned int +DrawFromDistribution::getNumDistribInputs() const +{ + return mDistribInputs.size(); +} + + +/* + * Creates a new DistribInput object, adds it to this DrawFromDistribution + * object and returns the DistribInput object created. + */ +DistribInput* +DrawFromDistribution::createDistribInput() +{ + DistribInput* di = NULL; + + try + { + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + di = new DistribInput(distribns); + delete distribns; + } + catch (...) + { + } + + if (di != NULL) + { + mDistribInputs.appendAndOwn(di); + } + + return di; +} + + +/* + * Removes the nth DistribInput from this DrawFromDistribution and returns a + * pointer to it. + */ +DistribInput* +DrawFromDistribution::removeDistribInput(unsigned int n) +{ + return mDistribInputs.remove(n); +} + + +/* + * Removes the DistribInput from this DrawFromDistribution based on its + * identifier and returns a pointer to it. + */ +DistribInput* +DrawFromDistribution::removeDistribInput(const std::string& sid) +{ + return mDistribInputs.remove(sid); +} + + +/* + * Returns the XML element name of this DrawFromDistribution object. + */ +const std::string& +DrawFromDistribution::getElementName() const +{ + static const string name = "drawFromDistribution"; + return name; +} + + +/* + * Returns the libSBML type code for this DrawFromDistribution object. + */ +int +DrawFromDistribution::getTypeCode() const +{ + return SBML_DISTRIB_DRAWFROMDISTRIBUTION; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +DrawFromDistribution::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetDistribution() == true) + { + mDistribution->write(stream); + } + + if (getNumDistribInputs() > 0) + { + mDistribInputs.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +DrawFromDistribution::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mDistribution != NULL) + { + mDistribution->accept(v); + } + + mDistribInputs.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +DrawFromDistribution::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mDistribution != NULL) + { + mDistribution->setSBMLDocument(d); + } + + mDistribInputs.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +DrawFromDistribution::connectToChild() +{ + SBase::connectToChild(); + + if (mDistribution != NULL) + { + mDistribution->connectToParent(this); + } + + mDistribInputs.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +DrawFromDistribution::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetDistribution()) + { + mDistribution->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + mDistribInputs.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +DrawFromDistribution::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mDistribution != NULL) + { + mDistribution->updateSBMLNamespace(package, level, version); + } + + mDistribInputs.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this DrawFromDistribution's attribute + * "attributeName" is set. + */ +bool +DrawFromDistribution::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::setAttribute(const std::string& attributeName, + int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * DrawFromDistribution. + */ +int +DrawFromDistribution::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this + * DrawFromDistribution. + */ +SBase* +DrawFromDistribution::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "betaDistribution") + { + return createBetaDistribution(); + } + else if (elementName == "cauchyDistribution") + { + return createCauchyDistribution(); + } + else if (elementName == "exponentialDistribution") + { + return createExponentialDistribution(); + } + else if (elementName == "logisticDistribution") + { + return createLogisticDistribution(); + } + else if (elementName == "normalDistribution") + { + return createNormalDistribution(); + } + else if (elementName == "binomialDistribution") + { + return createBinomialDistribution(); + } + else if (elementName == "geometricDistribution") + { + return createGeometricDistribution(); + } + else if (elementName == "bernoulliDistribution") + { + return createBernoulliDistribution(); + } + else if (elementName == "categoricalDistribution") + { + return createCategoricalDistribution(); + } + else if (elementName == "multivariateDistribution") + { + return createMultivariateDistribution(); + } + else if (elementName == "externalDistribution") + { + return createExternalDistribution(); + } + else if (elementName == "distribInput") + { + return createDistribInput(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this DrawFromDistribution. + */ +int +DrawFromDistribution::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "betaDistribution" && element->getTypeCode() == + SBML_DISTRIB_BETADISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "cauchyDistribution" && element->getTypeCode() == + SBML_DISTRIB_CAUCHYDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "exponentialDistribution" && element->getTypeCode() + == SBML_DISTRIB_EXPONENTIALDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "logisticDistribution" && element->getTypeCode() == + SBML_DISTRIB_LOGISTICDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "normalDistribution" && element->getTypeCode() == + SBML_DISTRIB_NORMALDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "binomialDistribution" && element->getTypeCode() == + SBML_DISTRIB_BINOMIALDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "geometricDistribution" && element->getTypeCode() == + SBML_DISTRIB_GEOMETRICLDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "bernoulliDistribution" && element->getTypeCode() == + SBML_DISTRIB_BERNOULLIDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "categoricalDistribution" && element->getTypeCode() + == SBML_DISTRIB_CATEGORICALDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "multivariateDistribution" && element->getTypeCode() + == SBML_DISTRIB_MULTIVARIATEDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "externalDistribution" && element->getTypeCode() == + SBML_DISTRIB_EXTERNALDISTRIBUTION) + { + return setDistribution((const Distribution*)(element)); + } + else if (elementName == "distribInput" && element->getTypeCode() == + SBML_DISTRIB_DISTRIBINPUT) + { + return addDistribInput((const DistribInput*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * DrawFromDistribution. + */ +SBase* +DrawFromDistribution::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "betaDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "cauchyDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "exponentialDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "logisticDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "normalDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "binomialDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "geometricDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "bernoulliDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "categoricalDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "multivariateDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "externalDistribution") + { + Distribution * obj = mDistribution; + mDistribution = NULL; + return obj; + } + else if (elementName == "distribInput") + { + return removeDistribInput(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this DrawFromDistribution. + */ +unsigned int +DrawFromDistribution::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "distribution") + { + if (isSetDistribution()) + { + return 1; + } + } + else if (elementName == "distribInput") + { + return getNumDistribInputs(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this DrawFromDistribution. + */ +SBase* +DrawFromDistribution::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "distribution") + { + return getDistribution(); + } + else if (elementName == "distribInput") + { + return getDistribInput(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +DrawFromDistribution::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mDistribution != NULL) + { + if (mDistribution->getId() == id) + { + return mDistribution; + } + + obj = mDistribution->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mDistribInputs.getId() == id) + { + return &mDistribInputs; + } + + obj = mDistribInputs.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +DrawFromDistribution::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mDistribution != NULL) + { + if (mDistribution->getMetaId() == metaid) + { + return mDistribution; + } + + obj = mDistribution->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mDistribInputs.getMetaId() == metaid) + { + return &mDistribInputs; + } + + obj = mDistribInputs.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +DrawFromDistribution::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mDistribution, filter); + + ADD_FILTERED_LIST(ret, sublist, mDistribInputs, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +DrawFromDistribution::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + + if (name == "betaDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new BetaDistribution(distribns); + obj = mDistribution; + } + else if (name == "cauchyDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new CauchyDistribution(distribns); + obj = mDistribution; + } + else if (name == "exponentialDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new ExponentialDistribution(distribns); + obj = mDistribution; + } + else if (name == "logisticDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new LogisticDistribution(distribns); + obj = mDistribution; + } + else if (name == "normalDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new NormalDistribution(distribns); + obj = mDistribution; + } + else if (name == "binomialDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new BinomialDistribution(distribns); + obj = mDistribution; + } + else if (name == "geometricDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new GeometricDistribution(distribns); + obj = mDistribution; + } + else if (name == "bernoulliDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new BernoulliDistribution(distribns); + obj = mDistribution; + } + else if (name == "categoricalDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new CategoricalDistribution(distribns); + obj = mDistribution; + } + else if (name == "multivariateDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new MultivariateDistribution(distribns); + obj = mDistribution; + } + else if (name == "externalDistribution") + { + if (getErrorLog() && isSetDistribution()) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mDistribution; + mDistribution = new ExternalDistribution(distribns); + obj = mDistribution; + } + + if (name == "listOfDistribInputs") + { + if (getErrorLog() && mDistribInputs.size() != 0) + { + getErrorLog()->logPackageError("distrib", + DistribDrawFromDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + obj = &mDistribInputs; + } + + delete distribns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new DrawFromDistribution_t using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +DrawFromDistribution_t * +DrawFromDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new DrawFromDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this DrawFromDistribution_t object. + */ +LIBSBML_EXTERN +DrawFromDistribution_t* +DrawFromDistribution_clone(const DrawFromDistribution_t* dfd) +{ + if (dfd != NULL) + { + return static_cast(dfd->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this DrawFromDistribution_t object. + */ +LIBSBML_EXTERN +void +DrawFromDistribution_free(DrawFromDistribution_t* dfd) +{ + if (dfd != NULL) + { + delete dfd; + } +} + + +/* + * Returns the value of the "distribution" element of this + * DrawFromDistribution_t. + */ +LIBSBML_EXTERN +const Distribution_t* +DrawFromDistribution_getDistribution(const DrawFromDistribution_t * dfd) +{ + if (dfd == NULL) + { + return NULL; + } + + return (Distribution_t*)(dfd->getDistribution()); +} + + +/* + * Predicate returning @c 1 (true) if this DrawFromDistribution_t's + * "distribution" element is set. + */ +LIBSBML_EXTERN +int +DrawFromDistribution_isSetDistribution(const DrawFromDistribution_t * dfd) +{ + return (dfd != NULL) ? static_cast(dfd->isSetDistribution()) : 0; +} + + +/* + * Sets the value of the "distribution" element of this DrawFromDistribution_t. + */ +LIBSBML_EXTERN +int +DrawFromDistribution_setDistribution(DrawFromDistribution_t * dfd, + const Distribution_t* distribution) +{ + return (dfd != NULL) ? dfd->setDistribution(distribution) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new BetaDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the BetaDistribution_t object + * created. + */ +LIBSBML_EXTERN +BetaDistribution_t* +DrawFromDistribution_createBetaDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createBetaDistribution() : NULL; +} + + +/* + * Creates a new CauchyDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the CauchyDistribution_t object + * created. + */ +LIBSBML_EXTERN +CauchyDistribution_t* +DrawFromDistribution_createCauchyDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createCauchyDistribution() : NULL; +} + + +/* + * Creates a new ExponentialDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the ExponentialDistribution_t + * object created. + */ +LIBSBML_EXTERN +ExponentialDistribution_t* +DrawFromDistribution_createExponentialDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createExponentialDistribution() : NULL; +} + + +/* + * Creates a new LogisticDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the LogisticDistribution_t object + * created. + */ +LIBSBML_EXTERN +LogisticDistribution_t* +DrawFromDistribution_createLogisticDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createLogisticDistribution() : NULL; +} + + +/* + * Creates a new NormalDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the NormalDistribution_t object + * created. + */ +LIBSBML_EXTERN +NormalDistribution_t* +DrawFromDistribution_createNormalDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createNormalDistribution() : NULL; +} + + +/* + * Creates a new BinomialDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the BinomialDistribution_t object + * created. + */ +LIBSBML_EXTERN +BinomialDistribution_t* +DrawFromDistribution_createBinomialDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createBinomialDistribution() : NULL; +} + + +/* + * Creates a new GeometricDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the GeometricDistribution_t object + * created. + */ +LIBSBML_EXTERN +GeometricDistribution_t* +DrawFromDistribution_createGeometricDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createGeometricDistribution() : NULL; +} + + +/* + * Creates a new BernoulliDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the BernoulliDistribution_t object + * created. + */ +LIBSBML_EXTERN +BernoulliDistribution_t* +DrawFromDistribution_createBernoulliDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createBernoulliDistribution() : NULL; +} + + +/* + * Creates a new CategoricalDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the CategoricalDistribution_t + * object created. + */ +LIBSBML_EXTERN +CategoricalDistribution_t* +DrawFromDistribution_createCategoricalDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createCategoricalDistribution() : NULL; +} + + +/* + * Creates a new MultivariateDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the MultivariateDistribution_t + * object created. + */ +LIBSBML_EXTERN +MultivariateDistribution_t* +DrawFromDistribution_createMultivariateDistribution(DrawFromDistribution_t* + dfd) +{ + return (dfd != NULL) ? dfd->createMultivariateDistribution() : NULL; +} + + +/* + * Creates a new ExternalDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the ExternalDistribution_t object + * created. + */ +LIBSBML_EXTERN +ExternalDistribution_t* +DrawFromDistribution_createExternalDistribution(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createExternalDistribution() : NULL; +} + + +/* + * Unsets the value of the "distribution" element of this + * DrawFromDistribution_t. + */ +LIBSBML_EXTERN +int +DrawFromDistribution_unsetDistribution(DrawFromDistribution_t * dfd) +{ + return (dfd != NULL) ? dfd->unsetDistribution() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing DistribInput_t objects from this + * DrawFromDistribution_t. + */ +LIBSBML_EXTERN +ListOf_t* +DrawFromDistribution_getListOfDistribInputs(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->getListOfDistribInputs() : NULL; +} + + +/* + * Get a DistribInput_t from the DrawFromDistribution_t. + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_getDistribInput(DrawFromDistribution_t* dfd, + unsigned int n) +{ + return (dfd != NULL) ? dfd->getDistribInput(n) : NULL; +} + + +/* + * Get a DistribInput_t from the DrawFromDistribution_t based on its + * identifier. + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_getDistribInputById(DrawFromDistribution_t* dfd, + const char *sid) +{ + return (dfd != NULL && sid != NULL) ? dfd->getDistribInput(sid) : NULL; +} + + +/* + * Adds a copy of the given DistribInput_t to this DrawFromDistribution_t. + */ +LIBSBML_EXTERN +int +DrawFromDistribution_addDistribInput(DrawFromDistribution_t* dfd, + const DistribInput_t* di) +{ + return (dfd != NULL) ? dfd->addDistribInput(di) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of DistribInput_t objects in this DrawFromDistribution_t. + */ +LIBSBML_EXTERN +unsigned int +DrawFromDistribution_getNumDistribInputs(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->getNumDistribInputs() : SBML_INT_MAX; +} + + +/* + * Creates a new DistribInput_t object, adds it to this DrawFromDistribution_t + * object and returns the DistribInput_t object created. + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_createDistribInput(DrawFromDistribution_t* dfd) +{ + return (dfd != NULL) ? dfd->createDistribInput() : NULL; +} + + +/* + * Removes the nth DistribInput_t from this DrawFromDistribution_t and returns + * a pointer to it. + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_removeDistribInput(DrawFromDistribution_t* dfd, + unsigned int n) +{ + return (dfd != NULL) ? dfd->removeDistribInput(n) : NULL; +} + + +/* + * Removes the DistribInput_t from this DrawFromDistribution_t based on its + * identifier and returns a pointer to it. + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_removeDistribInputById(DrawFromDistribution_t* dfd, + const char* sid) +{ + return (dfd != NULL && sid != NULL) ? dfd->removeDistribInput(sid) : NULL; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/DrawFromDistribution.h b/generator/tests/test_cpp_code/test-code/DrawFromDistribution.h index 0abe1e7a..1d16c265 100644 --- a/generator/tests/test_cpp_code/test-code/DrawFromDistribution.h +++ b/generator/tests/test_cpp_code/test-code/DrawFromDistribution.h @@ -1,1555 +1,1555 @@ -/** - * @file DrawFromDistribution.h - * @brief Definition of the DrawFromDistribution class. - * @author SBMLTeam - * - * - * - * @class DrawFromDistribution - * @sbmlbrief{distrib} TODO:Definition of the DrawFromDistribution class. - */ - - -#ifndef DrawFromDistribution_H__ -#define DrawFromDistribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN DrawFromDistribution : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - ListOfDistribInputs mDistribInputs; - Distribution* mDistribution; - - /** @endcond */ - -public: - - /** - * Creates a new DrawFromDistribution using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * DrawFromDistribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * DrawFromDistribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this DrawFromDistribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - DrawFromDistribution(unsigned int level = - DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new DrawFromDistribution using the given DistribPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - DrawFromDistribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for DrawFromDistribution. - * - * @param orig the DrawFromDistribution instance to copy. - */ - DrawFromDistribution(const DrawFromDistribution& orig); - - - /** - * Assignment operator for DrawFromDistribution. - * - * @param rhs the DrawFromDistribution object whose values are to be used as - * the basis of the assignment. - */ - DrawFromDistribution& operator=(const DrawFromDistribution& rhs); - - - /** - * Creates and returns a deep copy of this DrawFromDistribution object. - * - * @return a (deep) copy of this DrawFromDistribution object. - */ - virtual DrawFromDistribution* clone() const; - - - /** - * Destructor for DrawFromDistribution. - */ - virtual ~DrawFromDistribution(); - - - /** - * Returns the value of the "distribution" element of this - * DrawFromDistribution. - * - * @return the value of the "distribution" element of this - * DrawFromDistribution as a Distribution*. - */ - const Distribution* getDistribution() const; - - - /** - * Returns the value of the "distribution" element of this - * DrawFromDistribution. - * - * @return the value of the "distribution" element of this - * DrawFromDistribution as a Distribution*. - */ - Distribution* getDistribution(); - - - /** - * Predicate returning @c true if this DrawFromDistribution's "distribution" - * element is set. - * - * @return @c true if this DrawFromDistribution's "distribution" element has - * been set, otherwise @c false is returned. - */ - bool isSetDistribution() const; - - - /** - * Sets the value of the "distribution" element of this DrawFromDistribution. - * - * @param distribution Distribution* value of the "distribution" element to - * be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setDistribution(const Distribution* distribution); - - - /** - * Creates a new BetaDistribution object, adds it to this - * DrawFromDistribution object and returns the BetaDistribution object - * created. - * - * @return a new BetaDistribution object instance. - */ - BetaDistribution* createBetaDistribution(); - - - /** - * Creates a new CauchyDistribution object, adds it to this - * DrawFromDistribution object and returns the CauchyDistribution object - * created. - * - * @return a new CauchyDistribution object instance. - */ - CauchyDistribution* createCauchyDistribution(); - - - /** - * Creates a new ExponentialDistribution object, adds it to this - * DrawFromDistribution object and returns the ExponentialDistribution object - * created. - * - * @return a new ExponentialDistribution object instance. - */ - ExponentialDistribution* createExponentialDistribution(); - - - /** - * Creates a new LogisticDistribution object, adds it to this - * DrawFromDistribution object and returns the LogisticDistribution object - * created. - * - * @return a new LogisticDistribution object instance. - */ - LogisticDistribution* createLogisticDistribution(); - - - /** - * Creates a new NormalDistribution object, adds it to this - * DrawFromDistribution object and returns the NormalDistribution object - * created. - * - * @return a new NormalDistribution object instance. - */ - NormalDistribution* createNormalDistribution(); - - - /** - * Creates a new BinomialDistribution object, adds it to this - * DrawFromDistribution object and returns the BinomialDistribution object - * created. - * - * @return a new BinomialDistribution object instance. - */ - BinomialDistribution* createBinomialDistribution(); - - - /** - * Creates a new GeometricDistribution object, adds it to this - * DrawFromDistribution object and returns the GeometricDistribution object - * created. - * - * @return a new GeometricDistribution object instance. - */ - GeometricDistribution* createGeometricDistribution(); - - - /** - * Creates a new BernoulliDistribution object, adds it to this - * DrawFromDistribution object and returns the BernoulliDistribution object - * created. - * - * @return a new BernoulliDistribution object instance. - */ - BernoulliDistribution* createBernoulliDistribution(); - - - /** - * Creates a new CategoricalDistribution object, adds it to this - * DrawFromDistribution object and returns the CategoricalDistribution object - * created. - * - * @return a new CategoricalDistribution object instance. - */ - CategoricalDistribution* createCategoricalDistribution(); - - - /** - * Creates a new MultivariateDistribution object, adds it to this - * DrawFromDistribution object and returns the MultivariateDistribution - * object created. - * - * @return a new MultivariateDistribution object instance. - */ - MultivariateDistribution* createMultivariateDistribution(); - - - /** - * Creates a new ExternalDistribution object, adds it to this - * DrawFromDistribution object and returns the ExternalDistribution object - * created. - * - * @return a new ExternalDistribution object instance. - */ - ExternalDistribution* createExternalDistribution(); - - - /** - * Unsets the value of the "distribution" element of this - * DrawFromDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetDistribution(); - - - /** - * Returns the ListOfDistribInputs from this DrawFromDistribution. - * - * @return the ListOfDistribInputs from this DrawFromDistribution. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - const ListOfDistribInputs* getListOfDistribInputs() const; - - - /** - * Returns the ListOfDistribInputs from this DrawFromDistribution. - * - * @return the ListOfDistribInputs from this DrawFromDistribution. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - ListOfDistribInputs* getListOfDistribInputs(); - - - /** - * Get a DistribInput from the DrawFromDistribution. - * - * @param n an unsigned int representing the index of the DistribInput to - * retrieve. - * - * @return the nth DistribInput in the ListOfDistribInputs within this - * DrawFromDistribution or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - DistribInput* getDistribInput(unsigned int n); - - - /** - * Get a DistribInput from the DrawFromDistribution. - * - * @param n an unsigned int representing the index of the DistribInput to - * retrieve. - * - * @return the nth DistribInput in the ListOfDistribInputs within this - * DrawFromDistribution or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - const DistribInput* getDistribInput(unsigned int n) const; - - - /** - * Get a DistribInput from the DrawFromDistribution based on its identifier. - * - * @param sid a string representing the identifier of the DistribInput to - * retrieve. - * - * @return the DistribInput in the ListOfDistribInputs within this - * DrawFromDistribution with the given @p sid or @c NULL if no such - * DistribInput exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - DistribInput* getDistribInput(const std::string& sid); - - - /** - * Get a DistribInput from the DrawFromDistribution based on its identifier. - * - * @param sid a string representing the identifier of the DistribInput to - * retrieve. - * - * @return the DistribInput in the ListOfDistribInputs within this - * DrawFromDistribution with the given @p sid or @c NULL if no such - * DistribInput exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - const DistribInput* getDistribInput(const std::string& sid) const; - - - /** - * Adds a copy of the given DistribInput to this DrawFromDistribution. - * - * @param di the DistribInput object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - int addDistribInput(const DistribInput* di); - - - /** - * Get the number of DistribInput objects in this DrawFromDistribution. - * - * @return the number of DistribInput objects in this DrawFromDistribution. - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getDistribInput(unsigned int n) - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - unsigned int getNumDistribInputs() const; - - - /** - * Creates a new DistribInput object, adds it to this DrawFromDistribution - * object and returns the DistribInput object created. - * - * @return a new DistribInput object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see getDistribInput(const std::string& sid) - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - * @see removeDistribInput(unsigned int n) - */ - DistribInput* createDistribInput(); - - - /** - * Removes the nth DistribInput from this DrawFromDistribution and returns a - * pointer to it. - * - * @param n an unsigned int representing the index of the DistribInput to - * remove. - * - * @return a pointer to the nth DistribInput in this DrawFromDistribution. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(const std::string& sid) - */ - DistribInput* removeDistribInput(unsigned int n); - - - /** - * Removes the DistribInput from this DrawFromDistribution based on its - * identifier and returns a pointer to it. - * - * @param sid a string representing the identifier of the DistribInput to - * remove. - * - * @return the DistribInput in this DrawFromDistribution based on the - * identifier or NULL if no such DistribInput exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addDistribInput(const DistribInput* object) - * @see createDistribInput() - * @see getDistribInput(const std::string& sid) - * @see getDistribInput(unsigned int n) - * @see getNumDistribInputs() - * @see removeDistribInput(unsigned int n) - */ - DistribInput* removeDistribInput(const std::string& sid); - - - /** - * Returns the XML element name of this DrawFromDistribution object. - * - * For DrawFromDistribution, the XML element name is always - * @c "drawFromDistribution". - * - * @return the name of this element, i.e. @c "drawFromDistribution". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this DrawFromDistribution object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_DRAWFROMDISTRIBUTION, SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this DrawFromDistribution's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this DrawFromDistribution's attribute "attributeName" - * has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * DrawFromDistribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this - * DrawFromDistribution. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this DrawFromDistribution. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * DrawFromDistribution. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this DrawFromDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this DrawFromDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new DrawFromDistribution_t using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * DrawFromDistribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * DrawFromDistribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this DrawFromDistribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -DrawFromDistribution_t * -DrawFromDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this DrawFromDistribution_t object. - * - * @param dfd the DrawFromDistribution_t structure. - * - * @return a (deep) copy of this DrawFromDistribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -DrawFromDistribution_t* -DrawFromDistribution_clone(const DrawFromDistribution_t* dfd); - - -/** - * Frees this DrawFromDistribution_t object. - * - * @param dfd the DrawFromDistribution_t structure. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -void -DrawFromDistribution_free(DrawFromDistribution_t* dfd); - - -/** - * Returns the value of the "distribution" element of this - * DrawFromDistribution_t. - * - * @param dfd the DrawFromDistribution_t structure whose distribution is - * sought. - * - * @return the value of the "distribution" element of this - * DrawFromDistribution_t as a Distribution*. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -const Distribution_t* -DrawFromDistribution_getDistribution(const DrawFromDistribution_t * dfd); - - -/** - * Predicate returning @c 1 (true) if this DrawFromDistribution_t's - * "distribution" element is set. - * - * @param dfd the DrawFromDistribution_t structure. - * - * @return @c 1 (true) if this DrawFromDistribution_t's "distribution" element - * has been set, otherwise @c 0 (false) is returned. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -int -DrawFromDistribution_isSetDistribution(const DrawFromDistribution_t * dfd); - - -/** - * Sets the value of the "distribution" element of this DrawFromDistribution_t. - * - * @param dfd the DrawFromDistribution_t structure. - * - * @param distribution Distribution_t* value of the "distribution" element to - * be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -int -DrawFromDistribution_setDistribution(DrawFromDistribution_t * dfd, - const Distribution_t* distribution); - - -/** - * Creates a new BetaDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the BetaDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * BetaDistribution_t should be added. - * - * @return a new BetaDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -BetaDistribution_t* -DrawFromDistribution_createBetaDistribution(DrawFromDistribution_t* dfd); - - -/** - * Creates a new CauchyDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the CauchyDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * CauchyDistribution_t should be added. - * - * @return a new CauchyDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -CauchyDistribution_t* -DrawFromDistribution_createCauchyDistribution(DrawFromDistribution_t* dfd); - - -/** - * Creates a new ExponentialDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the ExponentialDistribution_t - * object created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * ExponentialDistribution_t should be added. - * - * @return a new ExponentialDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -ExponentialDistribution_t* -DrawFromDistribution_createExponentialDistribution(DrawFromDistribution_t* - dfd); - - -/** - * Creates a new LogisticDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the LogisticDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * LogisticDistribution_t should be added. - * - * @return a new LogisticDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -LogisticDistribution_t* -DrawFromDistribution_createLogisticDistribution(DrawFromDistribution_t* dfd); - - -/** - * Creates a new NormalDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the NormalDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * NormalDistribution_t should be added. - * - * @return a new NormalDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -NormalDistribution_t* -DrawFromDistribution_createNormalDistribution(DrawFromDistribution_t* dfd); - - -/** - * Creates a new BinomialDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the BinomialDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * BinomialDistribution_t should be added. - * - * @return a new BinomialDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -BinomialDistribution_t* -DrawFromDistribution_createBinomialDistribution(DrawFromDistribution_t* dfd); - - -/** - * Creates a new GeometricDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the GeometricDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * GeometricDistribution_t should be added. - * - * @return a new GeometricDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -GeometricDistribution_t* -DrawFromDistribution_createGeometricDistribution(DrawFromDistribution_t* dfd); - - -/** - * Creates a new BernoulliDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the BernoulliDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * BernoulliDistribution_t should be added. - * - * @return a new BernoulliDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -BernoulliDistribution_t* -DrawFromDistribution_createBernoulliDistribution(DrawFromDistribution_t* dfd); - - -/** - * Creates a new CategoricalDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the CategoricalDistribution_t - * object created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * CategoricalDistribution_t should be added. - * - * @return a new CategoricalDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -CategoricalDistribution_t* -DrawFromDistribution_createCategoricalDistribution(DrawFromDistribution_t* - dfd); - - -/** - * Creates a new MultivariateDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the MultivariateDistribution_t - * object created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * MultivariateDistribution_t should be added. - * - * @return a new MultivariateDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -MultivariateDistribution_t* -DrawFromDistribution_createMultivariateDistribution(DrawFromDistribution_t* - dfd); - - -/** - * Creates a new ExternalDistribution_t object, adds it to this - * DrawFromDistribution_t object and returns the ExternalDistribution_t object - * created. - * - * @param dfd the DrawFromDistribution_t structure to which the - * ExternalDistribution_t should be added. - * - * @return a new ExternalDistribution_t object instance. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -ExternalDistribution_t* -DrawFromDistribution_createExternalDistribution(DrawFromDistribution_t* dfd); - - -/** - * Unsets the value of the "distribution" element of this - * DrawFromDistribution_t. - * - * @param dfd the DrawFromDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -int -DrawFromDistribution_unsetDistribution(DrawFromDistribution_t * dfd); - - -/** - * Returns a ListOf_t * containing DistribInput_t objects from this - * DrawFromDistribution_t. - * - * @param dfd the DrawFromDistribution_t structure whose ListOfDistribInputs is - * sought. - * - * @return the ListOfDistribInputs from this DrawFromDistribution_t as a - * ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see DrawFromDistribution_addDistribInput() - * @see DrawFromDistribution_createDistribInput() - * @see DrawFromDistribution_getDistribInputById() - * @see DrawFromDistribution_getDistribInput() - * @see DrawFromDistribution_getNumDistribInputs() - * @see DrawFromDistribution_removeDistribInputById() - * @see DrawFromDistribution_removeDistribInput() - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -ListOf_t* -DrawFromDistribution_getListOfDistribInputs(DrawFromDistribution_t* dfd); - - -/** - * Get a DistribInput_t from the DrawFromDistribution_t. - * - * @param dfd the DrawFromDistribution_t structure to search. - * - * @param n an unsigned int representing the index of the DistribInput_t to - * retrieve. - * - * @return the nth DistribInput_t in the ListOfDistribInputs within this - * DrawFromDistribution or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_getDistribInput(DrawFromDistribution_t* dfd, - unsigned int n); - - -/** - * Get a DistribInput_t from the DrawFromDistribution_t based on its - * identifier. - * - * @param dfd the DrawFromDistribution_t structure to search. - * - * @param sid a string representing the identifier of the DistribInput_t to - * retrieve. - * - * @return the DistribInput_t in the ListOfDistribInputs within this - * DrawFromDistribution with the given @p sid or @c NULL if no such - * DistribInput_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_getDistribInputById(DrawFromDistribution_t* dfd, - const char *sid); - - -/** - * Adds a copy of the given DistribInput_t to this DrawFromDistribution_t. - * - * @param dfd the DrawFromDistribution_t structure to which the DistribInput_t - * should be added. - * - * @param di the DistribInput_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -int -DrawFromDistribution_addDistribInput(DrawFromDistribution_t* dfd, - const DistribInput_t* di); - - -/** - * Get the number of DistribInput_t objects in this DrawFromDistribution_t. - * - * @param dfd the DrawFromDistribution_t structure to query. - * - * @return the number of DistribInput_t objects in this DrawFromDistribution_t. - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -unsigned int -DrawFromDistribution_getNumDistribInputs(DrawFromDistribution_t* dfd); - - -/** - * Creates a new DistribInput_t object, adds it to this DrawFromDistribution_t - * object and returns the DistribInput_t object created. - * - * @param dfd the DrawFromDistribution_t structure to which the DistribInput_t - * should be added. - * - * @return a new DistribInput_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_createDistribInput(DrawFromDistribution_t* dfd); - - -/** - * Removes the nth DistribInput_t from this DrawFromDistribution_t and returns - * a pointer to it. - * - * @param dfd the DrawFromDistribution_t structure to search. - * - * @param n an unsigned int representing the index of the DistribInput_t to - * remove. - * - * @return a pointer to the nth DistribInput_t in this DrawFromDistribution_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_removeDistribInput(DrawFromDistribution_t* dfd, - unsigned int n); - - -/** - * Removes the DistribInput_t from this DrawFromDistribution_t based on its - * identifier and returns a pointer to it. - * - * @param dfd the DrawFromDistribution_t structure to search. - * - * @param sid a string representing the identifier of the DistribInput_t to - * remove. - * - * @return the DistribInput_t in this DrawFromDistribution_t based on the - * identifier or NULL if no such DistribInput_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof DrawFromDistribution_t - */ -LIBSBML_EXTERN -DistribInput_t* -DrawFromDistribution_removeDistribInputById(DrawFromDistribution_t* dfd, - const char* sid); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !DrawFromDistribution_H__ */ - - +/** + * @file DrawFromDistribution.h + * @brief Definition of the DrawFromDistribution class. + * @author SBMLTeam + * + * + * + * @class DrawFromDistribution + * @sbmlbrief{distrib} TODO:Definition of the DrawFromDistribution class. + */ + + +#ifndef DrawFromDistribution_H__ +#define DrawFromDistribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN DrawFromDistribution : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + ListOfDistribInputs mDistribInputs; + Distribution* mDistribution; + + /** @endcond */ + +public: + + /** + * Creates a new DrawFromDistribution using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * DrawFromDistribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * DrawFromDistribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this DrawFromDistribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + DrawFromDistribution(unsigned int level = + DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new DrawFromDistribution using the given DistribPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + DrawFromDistribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for DrawFromDistribution. + * + * @param orig the DrawFromDistribution instance to copy. + */ + DrawFromDistribution(const DrawFromDistribution& orig); + + + /** + * Assignment operator for DrawFromDistribution. + * + * @param rhs the DrawFromDistribution object whose values are to be used as + * the basis of the assignment. + */ + DrawFromDistribution& operator=(const DrawFromDistribution& rhs); + + + /** + * Creates and returns a deep copy of this DrawFromDistribution object. + * + * @return a (deep) copy of this DrawFromDistribution object. + */ + virtual DrawFromDistribution* clone() const; + + + /** + * Destructor for DrawFromDistribution. + */ + virtual ~DrawFromDistribution(); + + + /** + * Returns the value of the "distribution" element of this + * DrawFromDistribution. + * + * @return the value of the "distribution" element of this + * DrawFromDistribution as a Distribution*. + */ + const Distribution* getDistribution() const; + + + /** + * Returns the value of the "distribution" element of this + * DrawFromDistribution. + * + * @return the value of the "distribution" element of this + * DrawFromDistribution as a Distribution*. + */ + Distribution* getDistribution(); + + + /** + * Predicate returning @c true if this DrawFromDistribution's "distribution" + * element is set. + * + * @return @c true if this DrawFromDistribution's "distribution" element has + * been set, otherwise @c false is returned. + */ + bool isSetDistribution() const; + + + /** + * Sets the value of the "distribution" element of this DrawFromDistribution. + * + * @param distribution Distribution* value of the "distribution" element to + * be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setDistribution(const Distribution* distribution); + + + /** + * Creates a new BetaDistribution object, adds it to this + * DrawFromDistribution object and returns the BetaDistribution object + * created. + * + * @return a new BetaDistribution object instance. + */ + BetaDistribution* createBetaDistribution(); + + + /** + * Creates a new CauchyDistribution object, adds it to this + * DrawFromDistribution object and returns the CauchyDistribution object + * created. + * + * @return a new CauchyDistribution object instance. + */ + CauchyDistribution* createCauchyDistribution(); + + + /** + * Creates a new ExponentialDistribution object, adds it to this + * DrawFromDistribution object and returns the ExponentialDistribution object + * created. + * + * @return a new ExponentialDistribution object instance. + */ + ExponentialDistribution* createExponentialDistribution(); + + + /** + * Creates a new LogisticDistribution object, adds it to this + * DrawFromDistribution object and returns the LogisticDistribution object + * created. + * + * @return a new LogisticDistribution object instance. + */ + LogisticDistribution* createLogisticDistribution(); + + + /** + * Creates a new NormalDistribution object, adds it to this + * DrawFromDistribution object and returns the NormalDistribution object + * created. + * + * @return a new NormalDistribution object instance. + */ + NormalDistribution* createNormalDistribution(); + + + /** + * Creates a new BinomialDistribution object, adds it to this + * DrawFromDistribution object and returns the BinomialDistribution object + * created. + * + * @return a new BinomialDistribution object instance. + */ + BinomialDistribution* createBinomialDistribution(); + + + /** + * Creates a new GeometricDistribution object, adds it to this + * DrawFromDistribution object and returns the GeometricDistribution object + * created. + * + * @return a new GeometricDistribution object instance. + */ + GeometricDistribution* createGeometricDistribution(); + + + /** + * Creates a new BernoulliDistribution object, adds it to this + * DrawFromDistribution object and returns the BernoulliDistribution object + * created. + * + * @return a new BernoulliDistribution object instance. + */ + BernoulliDistribution* createBernoulliDistribution(); + + + /** + * Creates a new CategoricalDistribution object, adds it to this + * DrawFromDistribution object and returns the CategoricalDistribution object + * created. + * + * @return a new CategoricalDistribution object instance. + */ + CategoricalDistribution* createCategoricalDistribution(); + + + /** + * Creates a new MultivariateDistribution object, adds it to this + * DrawFromDistribution object and returns the MultivariateDistribution + * object created. + * + * @return a new MultivariateDistribution object instance. + */ + MultivariateDistribution* createMultivariateDistribution(); + + + /** + * Creates a new ExternalDistribution object, adds it to this + * DrawFromDistribution object and returns the ExternalDistribution object + * created. + * + * @return a new ExternalDistribution object instance. + */ + ExternalDistribution* createExternalDistribution(); + + + /** + * Unsets the value of the "distribution" element of this + * DrawFromDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetDistribution(); + + + /** + * Returns the ListOfDistribInputs from this DrawFromDistribution. + * + * @return the ListOfDistribInputs from this DrawFromDistribution. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + const ListOfDistribInputs* getListOfDistribInputs() const; + + + /** + * Returns the ListOfDistribInputs from this DrawFromDistribution. + * + * @return the ListOfDistribInputs from this DrawFromDistribution. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + ListOfDistribInputs* getListOfDistribInputs(); + + + /** + * Get a DistribInput from the DrawFromDistribution. + * + * @param n an unsigned int representing the index of the DistribInput to + * retrieve. + * + * @return the nth DistribInput in the ListOfDistribInputs within this + * DrawFromDistribution or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + DistribInput* getDistribInput(unsigned int n); + + + /** + * Get a DistribInput from the DrawFromDistribution. + * + * @param n an unsigned int representing the index of the DistribInput to + * retrieve. + * + * @return the nth DistribInput in the ListOfDistribInputs within this + * DrawFromDistribution or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + const DistribInput* getDistribInput(unsigned int n) const; + + + /** + * Get a DistribInput from the DrawFromDistribution based on its identifier. + * + * @param sid a string representing the identifier of the DistribInput to + * retrieve. + * + * @return the DistribInput in the ListOfDistribInputs within this + * DrawFromDistribution with the given @p sid or @c NULL if no such + * DistribInput exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + DistribInput* getDistribInput(const std::string& sid); + + + /** + * Get a DistribInput from the DrawFromDistribution based on its identifier. + * + * @param sid a string representing the identifier of the DistribInput to + * retrieve. + * + * @return the DistribInput in the ListOfDistribInputs within this + * DrawFromDistribution with the given @p sid or @c NULL if no such + * DistribInput exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + const DistribInput* getDistribInput(const std::string& sid) const; + + + /** + * Adds a copy of the given DistribInput to this DrawFromDistribution. + * + * @param di the DistribInput object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + int addDistribInput(const DistribInput* di); + + + /** + * Get the number of DistribInput objects in this DrawFromDistribution. + * + * @return the number of DistribInput objects in this DrawFromDistribution. + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getDistribInput(unsigned int n) + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + unsigned int getNumDistribInputs() const; + + + /** + * Creates a new DistribInput object, adds it to this DrawFromDistribution + * object and returns the DistribInput object created. + * + * @return a new DistribInput object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see getDistribInput(const std::string& sid) + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + * @see removeDistribInput(unsigned int n) + */ + DistribInput* createDistribInput(); + + + /** + * Removes the nth DistribInput from this DrawFromDistribution and returns a + * pointer to it. + * + * @param n an unsigned int representing the index of the DistribInput to + * remove. + * + * @return a pointer to the nth DistribInput in this DrawFromDistribution. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(const std::string& sid) + */ + DistribInput* removeDistribInput(unsigned int n); + + + /** + * Removes the DistribInput from this DrawFromDistribution based on its + * identifier and returns a pointer to it. + * + * @param sid a string representing the identifier of the DistribInput to + * remove. + * + * @return the DistribInput in this DrawFromDistribution based on the + * identifier or NULL if no such DistribInput exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addDistribInput(const DistribInput* object) + * @see createDistribInput() + * @see getDistribInput(const std::string& sid) + * @see getDistribInput(unsigned int n) + * @see getNumDistribInputs() + * @see removeDistribInput(unsigned int n) + */ + DistribInput* removeDistribInput(const std::string& sid); + + + /** + * Returns the XML element name of this DrawFromDistribution object. + * + * For DrawFromDistribution, the XML element name is always + * @c "drawFromDistribution". + * + * @return the name of this element, i.e. @c "drawFromDistribution". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this DrawFromDistribution object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_DRAWFROMDISTRIBUTION, SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this DrawFromDistribution's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this DrawFromDistribution's attribute "attributeName" + * has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * DrawFromDistribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this + * DrawFromDistribution. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this DrawFromDistribution. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * DrawFromDistribution. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this DrawFromDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this DrawFromDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new DrawFromDistribution_t using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * DrawFromDistribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * DrawFromDistribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this DrawFromDistribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +DrawFromDistribution_t * +DrawFromDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this DrawFromDistribution_t object. + * + * @param dfd the DrawFromDistribution_t structure. + * + * @return a (deep) copy of this DrawFromDistribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +DrawFromDistribution_t* +DrawFromDistribution_clone(const DrawFromDistribution_t* dfd); + + +/** + * Frees this DrawFromDistribution_t object. + * + * @param dfd the DrawFromDistribution_t structure. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +void +DrawFromDistribution_free(DrawFromDistribution_t* dfd); + + +/** + * Returns the value of the "distribution" element of this + * DrawFromDistribution_t. + * + * @param dfd the DrawFromDistribution_t structure whose distribution is + * sought. + * + * @return the value of the "distribution" element of this + * DrawFromDistribution_t as a Distribution*. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +const Distribution_t* +DrawFromDistribution_getDistribution(const DrawFromDistribution_t * dfd); + + +/** + * Predicate returning @c 1 (true) if this DrawFromDistribution_t's + * "distribution" element is set. + * + * @param dfd the DrawFromDistribution_t structure. + * + * @return @c 1 (true) if this DrawFromDistribution_t's "distribution" element + * has been set, otherwise @c 0 (false) is returned. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +int +DrawFromDistribution_isSetDistribution(const DrawFromDistribution_t * dfd); + + +/** + * Sets the value of the "distribution" element of this DrawFromDistribution_t. + * + * @param dfd the DrawFromDistribution_t structure. + * + * @param distribution Distribution_t* value of the "distribution" element to + * be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +int +DrawFromDistribution_setDistribution(DrawFromDistribution_t * dfd, + const Distribution_t* distribution); + + +/** + * Creates a new BetaDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the BetaDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * BetaDistribution_t should be added. + * + * @return a new BetaDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +BetaDistribution_t* +DrawFromDistribution_createBetaDistribution(DrawFromDistribution_t* dfd); + + +/** + * Creates a new CauchyDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the CauchyDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * CauchyDistribution_t should be added. + * + * @return a new CauchyDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +CauchyDistribution_t* +DrawFromDistribution_createCauchyDistribution(DrawFromDistribution_t* dfd); + + +/** + * Creates a new ExponentialDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the ExponentialDistribution_t + * object created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * ExponentialDistribution_t should be added. + * + * @return a new ExponentialDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +ExponentialDistribution_t* +DrawFromDistribution_createExponentialDistribution(DrawFromDistribution_t* + dfd); + + +/** + * Creates a new LogisticDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the LogisticDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * LogisticDistribution_t should be added. + * + * @return a new LogisticDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +LogisticDistribution_t* +DrawFromDistribution_createLogisticDistribution(DrawFromDistribution_t* dfd); + + +/** + * Creates a new NormalDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the NormalDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * NormalDistribution_t should be added. + * + * @return a new NormalDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +NormalDistribution_t* +DrawFromDistribution_createNormalDistribution(DrawFromDistribution_t* dfd); + + +/** + * Creates a new BinomialDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the BinomialDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * BinomialDistribution_t should be added. + * + * @return a new BinomialDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +BinomialDistribution_t* +DrawFromDistribution_createBinomialDistribution(DrawFromDistribution_t* dfd); + + +/** + * Creates a new GeometricDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the GeometricDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * GeometricDistribution_t should be added. + * + * @return a new GeometricDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +GeometricDistribution_t* +DrawFromDistribution_createGeometricDistribution(DrawFromDistribution_t* dfd); + + +/** + * Creates a new BernoulliDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the BernoulliDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * BernoulliDistribution_t should be added. + * + * @return a new BernoulliDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +BernoulliDistribution_t* +DrawFromDistribution_createBernoulliDistribution(DrawFromDistribution_t* dfd); + + +/** + * Creates a new CategoricalDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the CategoricalDistribution_t + * object created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * CategoricalDistribution_t should be added. + * + * @return a new CategoricalDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +CategoricalDistribution_t* +DrawFromDistribution_createCategoricalDistribution(DrawFromDistribution_t* + dfd); + + +/** + * Creates a new MultivariateDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the MultivariateDistribution_t + * object created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * MultivariateDistribution_t should be added. + * + * @return a new MultivariateDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +MultivariateDistribution_t* +DrawFromDistribution_createMultivariateDistribution(DrawFromDistribution_t* + dfd); + + +/** + * Creates a new ExternalDistribution_t object, adds it to this + * DrawFromDistribution_t object and returns the ExternalDistribution_t object + * created. + * + * @param dfd the DrawFromDistribution_t structure to which the + * ExternalDistribution_t should be added. + * + * @return a new ExternalDistribution_t object instance. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +ExternalDistribution_t* +DrawFromDistribution_createExternalDistribution(DrawFromDistribution_t* dfd); + + +/** + * Unsets the value of the "distribution" element of this + * DrawFromDistribution_t. + * + * @param dfd the DrawFromDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +int +DrawFromDistribution_unsetDistribution(DrawFromDistribution_t * dfd); + + +/** + * Returns a ListOf_t * containing DistribInput_t objects from this + * DrawFromDistribution_t. + * + * @param dfd the DrawFromDistribution_t structure whose ListOfDistribInputs is + * sought. + * + * @return the ListOfDistribInputs from this DrawFromDistribution_t as a + * ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see DrawFromDistribution_addDistribInput() + * @see DrawFromDistribution_createDistribInput() + * @see DrawFromDistribution_getDistribInputById() + * @see DrawFromDistribution_getDistribInput() + * @see DrawFromDistribution_getNumDistribInputs() + * @see DrawFromDistribution_removeDistribInputById() + * @see DrawFromDistribution_removeDistribInput() + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +ListOf_t* +DrawFromDistribution_getListOfDistribInputs(DrawFromDistribution_t* dfd); + + +/** + * Get a DistribInput_t from the DrawFromDistribution_t. + * + * @param dfd the DrawFromDistribution_t structure to search. + * + * @param n an unsigned int representing the index of the DistribInput_t to + * retrieve. + * + * @return the nth DistribInput_t in the ListOfDistribInputs within this + * DrawFromDistribution or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_getDistribInput(DrawFromDistribution_t* dfd, + unsigned int n); + + +/** + * Get a DistribInput_t from the DrawFromDistribution_t based on its + * identifier. + * + * @param dfd the DrawFromDistribution_t structure to search. + * + * @param sid a string representing the identifier of the DistribInput_t to + * retrieve. + * + * @return the DistribInput_t in the ListOfDistribInputs within this + * DrawFromDistribution with the given @p sid or @c NULL if no such + * DistribInput_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_getDistribInputById(DrawFromDistribution_t* dfd, + const char *sid); + + +/** + * Adds a copy of the given DistribInput_t to this DrawFromDistribution_t. + * + * @param dfd the DrawFromDistribution_t structure to which the DistribInput_t + * should be added. + * + * @param di the DistribInput_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +int +DrawFromDistribution_addDistribInput(DrawFromDistribution_t* dfd, + const DistribInput_t* di); + + +/** + * Get the number of DistribInput_t objects in this DrawFromDistribution_t. + * + * @param dfd the DrawFromDistribution_t structure to query. + * + * @return the number of DistribInput_t objects in this DrawFromDistribution_t. + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +unsigned int +DrawFromDistribution_getNumDistribInputs(DrawFromDistribution_t* dfd); + + +/** + * Creates a new DistribInput_t object, adds it to this DrawFromDistribution_t + * object and returns the DistribInput_t object created. + * + * @param dfd the DrawFromDistribution_t structure to which the DistribInput_t + * should be added. + * + * @return a new DistribInput_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_createDistribInput(DrawFromDistribution_t* dfd); + + +/** + * Removes the nth DistribInput_t from this DrawFromDistribution_t and returns + * a pointer to it. + * + * @param dfd the DrawFromDistribution_t structure to search. + * + * @param n an unsigned int representing the index of the DistribInput_t to + * remove. + * + * @return a pointer to the nth DistribInput_t in this DrawFromDistribution_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_removeDistribInput(DrawFromDistribution_t* dfd, + unsigned int n); + + +/** + * Removes the DistribInput_t from this DrawFromDistribution_t based on its + * identifier and returns a pointer to it. + * + * @param dfd the DrawFromDistribution_t structure to search. + * + * @param sid a string representing the identifier of the DistribInput_t to + * remove. + * + * @return the DistribInput_t in this DrawFromDistribution_t based on the + * identifier or NULL if no such DistribInput_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof DrawFromDistribution_t + */ +LIBSBML_EXTERN +DistribInput_t* +DrawFromDistribution_removeDistribInputById(DrawFromDistribution_t* dfd, + const char* sid); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !DrawFromDistribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Event.cpp b/generator/tests/test_cpp_code/test-code/Event.cpp index 2da3c1ed..92a77b70 100644 --- a/generator/tests/test_cpp_code/test-code/Event.cpp +++ b/generator/tests/test_cpp_code/test-code/Event.cpp @@ -1,2072 +1,2072 @@ -/** - * @file Event.cpp - * @brief Implementation of the Event class. - * @author DEVISER - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Event using the given SBML Level and @ p version values. - */ -Event::Event(unsigned int level, unsigned int version) - : SBase(level, version) - , mUseValuesFromTriggerTime (false) - , mIsSetUseValuesFromTriggerTime (false) - , mTrigger (NULL) - , mPriority (NULL) - , mDelay (NULL) - , mEventAssignments (level, version) - , mTimeUnits ("") -{ - setSBMLNamespacesAndOwn(new SBMLNamespaces(level, version)); - connectToChild(); -} - - -/* - * Creates a new Event using the given SBMLNamespaces object @p sbmlns. - */ -Event::Event(SBMLNamespaces *sbmlns) - : SBase(sbmlns) - , mUseValuesFromTriggerTime (false) - , mIsSetUseValuesFromTriggerTime (false) - , mTrigger (NULL) - , mPriority (NULL) - , mDelay (NULL) - , mEventAssignments (sbmlns) - , mTimeUnits ("") -{ - setElementNamespace(sbmlns->getURI()); - connectToChild(); -} - - -/* - * Copy constructor for Event. - */ -Event::Event(const Event& orig) - : SBase( orig ) - , mUseValuesFromTriggerTime ( orig.mUseValuesFromTriggerTime ) - , mIsSetUseValuesFromTriggerTime ( orig.mIsSetUseValuesFromTriggerTime ) - , mTrigger ( NULL ) - , mPriority ( NULL ) - , mDelay ( NULL ) - , mEventAssignments ( orig.mEventAssignments ) - , mTimeUnits ( orig.mTimeUnits ) -{ - if (orig.mTrigger != NULL) - { - mTrigger = orig.mTrigger->clone(); - } - - if (orig.mPriority != NULL) - { - mPriority = orig.mPriority->clone(); - } - - if (orig.mDelay != NULL) - { - mDelay = orig.mDelay->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for Event. - */ -Event& -Event::operator=(const Event& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mUseValuesFromTriggerTime = rhs.mUseValuesFromTriggerTime; - mIsSetUseValuesFromTriggerTime = rhs.mIsSetUseValuesFromTriggerTime; - mEventAssignments = rhs.mEventAssignments; - mTimeUnits = rhs.mTimeUnits; - delete mTrigger; - if (rhs.mTrigger != NULL) - { - mTrigger = rhs.mTrigger->clone(); - } - else - { - mTrigger = NULL; - } - - delete mPriority; - if (rhs.mPriority != NULL) - { - mPriority = rhs.mPriority->clone(); - } - else - { - mPriority = NULL; - } - - delete mDelay; - if (rhs.mDelay != NULL) - { - mDelay = rhs.mDelay->clone(); - } - else - { - mDelay = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Event object. - */ -Event* -Event::clone() const -{ - return new Event(*this); -} - - -/* - * Destructor for Event. - */ -Event::~Event() -{ - delete mTrigger; - mTrigger = NULL; - delete mPriority; - mPriority = NULL; - delete mDelay; - mDelay = NULL; -} - - -/* - * Returns the value of the "useValuesFromTriggerTime" attribute of this Event. - */ -bool -Event::getUseValuesFromTriggerTime() const -{ - return mUseValuesFromTriggerTime; -} - - -/* - * Returns the value of the "timeUnits" attribute of this Event. - */ -const std::string& -Event::getTimeUnits() const -{ - return mTimeUnits; -} - - -/* - * Predicate returning @c true if this Event's "useValuesFromTriggerTime" - * attribute is set. - */ -bool -Event::isSetUseValuesFromTriggerTime() const -{ - return mIsSetUseValuesFromTriggerTime; -} - - -/* - * Predicate returning @c true if this Event's "timeUnits" attribute is set. - */ -bool -Event::isSetTimeUnits() const -{ - return (mTimeUnits.empty() == false); -} - - -/* - * Sets the value of the "useValuesFromTriggerTime" attribute of this Event. - */ -int -Event::setUseValuesFromTriggerTime(bool useValuesFromTriggerTime) -{ - mUseValuesFromTriggerTime = useValuesFromTriggerTime; - mIsSetUseValuesFromTriggerTime = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "timeUnits" attribute of this Event. - */ -int -Event::setTimeUnits(const std::string& timeUnits) -{ - if (!(SyntaxChecker::isValidInternalUnitSId(timeUnits))) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mTimeUnits = timeUnits; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "useValuesFromTriggerTime" attribute of this Event. - */ -int -Event::unsetUseValuesFromTriggerTime() -{ - mUseValuesFromTriggerTime = false; - mIsSetUseValuesFromTriggerTime = false; - - if (isSetUseValuesFromTriggerTime() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "timeUnits" attribute of this Event. - */ -int -Event::unsetTimeUnits() -{ - mTimeUnits.erase(); - - if (mTimeUnits.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "trigger" element of this Event. - */ -const Trigger* -Event::getTrigger() const -{ - return mTrigger; -} - - -/* - * Returns the value of the "trigger" element of this Event. - */ -Trigger* -Event::getTrigger() -{ - return mTrigger; -} - - -/* - * Returns the value of the "priority" element of this Event. - */ -const Priority* -Event::getPriority() const -{ - return mPriority; -} - - -/* - * Returns the value of the "priority" element of this Event. - */ -Priority* -Event::getPriority() -{ - return mPriority; -} - - -/* - * Returns the value of the "delay" element of this Event. - */ -const Delay* -Event::getDelay() const -{ - return mDelay; -} - - -/* - * Returns the value of the "delay" element of this Event. - */ -Delay* -Event::getDelay() -{ - return mDelay; -} - - -/* - * Predicate returning @c true if this Event's "trigger" element is set. - */ -bool -Event::isSetTrigger() const -{ - return (mTrigger != NULL); -} - - -/* - * Predicate returning @c true if this Event's "priority" element is set. - */ -bool -Event::isSetPriority() const -{ - return (mPriority != NULL); -} - - -/* - * Predicate returning @c true if this Event's "delay" element is set. - */ -bool -Event::isSetDelay() const -{ - return (mDelay != NULL); -} - - -/* - * Sets the value of the "trigger" element of this Event. - */ -int -Event::setTrigger(const Trigger* trigger) -{ - if (mTrigger == trigger) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (trigger == NULL) - { - delete mTrigger; - mTrigger = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mTrigger; - mTrigger = (trigger != NULL) ? trigger->clone() : NULL; - if (mTrigger != NULL) - { - mTrigger->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "priority" element of this Event. - */ -int -Event::setPriority(const Priority* priority) -{ - if (mPriority == priority) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (priority == NULL) - { - delete mPriority; - mPriority = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mPriority; - mPriority = (priority != NULL) ? priority->clone() : NULL; - if (mPriority != NULL) - { - mPriority->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "delay" element of this Event. - */ -int -Event::setDelay(const Delay* delay) -{ - if (mDelay == delay) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (delay == NULL) - { - delete mDelay; - mDelay = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mDelay; - mDelay = (delay != NULL) ? delay->clone() : NULL; - if (mDelay != NULL) - { - mDelay->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new Trigger object, adds it to this Event object and returns the - * Trigger object created. - */ -Trigger* -Event::createTrigger() -{ - if (mTrigger != NULL) - { - delete mTrigger; - } - - mTrigger = new Trigger(getSBMLNamespaces()); - - connectToChild(); - - return mTrigger; -} - - -/* - * Creates a new Priority object, adds it to this Event object and returns the - * Priority object created. - */ -Priority* -Event::createPriority() -{ - if (mPriority != NULL) - { - delete mPriority; - } - - mPriority = new Priority(getSBMLNamespaces()); - - connectToChild(); - - return mPriority; -} - - -/* - * Creates a new Delay object, adds it to this Event object and returns the - * Delay object created. - */ -Delay* -Event::createDelay() -{ - if (mDelay != NULL) - { - delete mDelay; - } - - mDelay = new Delay(getSBMLNamespaces()); - - connectToChild(); - - return mDelay; -} - - -/* - * Unsets the value of the "trigger" element of this Event. - */ -int -Event::unsetTrigger() -{ - delete mTrigger; - mTrigger = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "priority" element of this Event. - */ -int -Event::unsetPriority() -{ - delete mPriority; - mPriority = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "delay" element of this Event. - */ -int -Event::unsetDelay() -{ - delete mDelay; - mDelay = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the SBMLListOfEventAssignments from this Event. - */ -const SBMLListOfEventAssignments* -Event::getListOfEventAssignments() const -{ - return &mEventAssignments; -} - - -/* - * Returns the SBMLListOfEventAssignments from this Event. - */ -SBMLListOfEventAssignments* -Event::getListOfEventAssignments() -{ - return &mEventAssignments; -} - - -/* - * Get an EventAssignment from the Event. - */ -EventAssignment* -Event::getEventAssignment(unsigned int n) -{ - return mEventAssignments.get(n); -} - - -/* - * Get an EventAssignment from the Event. - */ -const EventAssignment* -Event::getEventAssignment(unsigned int n) const -{ - return mEventAssignments.get(n); -} - - -/* - * Get an EventAssignment from the Event based on the element to which it - * refers. - */ -const EventAssignment* -Event::getEventAssignmentByVariable(const std::string& sid) const -{ - return mEventAssignments.getByVariable(sid); -} - - -/* - * Get an EventAssignment from the Event based on the element to which it - * refers. - */ -EventAssignment* -Event::getEventAssignmentByVariable(const std::string& sid) -{ - return mEventAssignments.getByVariable(sid); -} - - -/* - * Adds a copy of the given EventAssignment to this Event. - */ -int -Event::addEventAssignment(const EventAssignment* ea) -{ - if (ea == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (ea->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != ea->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != ea->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(ea)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else - { - return mEventAssignments.append(ea); - } -} - - -/* - * Get the number of EventAssignment objects in this Event. - */ -unsigned int -Event::getNumEventAssignments() const -{ - return mEventAssignments.size(); -} - - -/* - * Creates a new EventAssignment object, adds it to this Event object and - * returns the EventAssignment object created. - */ -EventAssignment* -Event::createEventAssignment() -{ - EventAssignment* ea = NULL; - - try - { - ea = new EventAssignment(getSBMLNamespaces()); - } - catch (...) - { - } - - if (ea != NULL) - { - mEventAssignments.appendAndOwn(ea); - } - - return ea; -} - - -/* - * Removes the nth EventAssignment from this Event and returns a pointer to it. - */ -EventAssignment* -Event::removeEventAssignment(unsigned int n) -{ - return mEventAssignments.remove(n); -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -Event::renameSIdRefs(const std::string& oldid, const std::string& newid) -{ - if (isSetTimeUnits() && mTimeUnits == oldid) - { - setTimeUnits(newid); - } -} - - -/* - * Returns the XML element name of this Event object. - */ -const std::string& -Event::getElementName() const -{ - static const string name = ""; - return name; -} - - -/* - * Returns the libSBML type code for this Event object. - */ -int -Event::getTypeCode() const -{ - return CORE_EVENT; -} - - -/* - * Predicate returning @c true if all the required attributes for this Event - * object have been set. - */ -bool -Event::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetUseValuesFromTriggerTime() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Event::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) - const -{ - SBase::writeElements(stream); - - if (isSetTrigger() == true) - { - mTrigger->write(stream); - } - - if (isSetPriority() == true) - { - mPriority->write(stream); - } - - if (isSetDelay() == true) - { - mDelay->write(stream); - } - - if (getNumEventAssignments() > 0) - { - mEventAssignments.write(stream); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Event::accept(SBMLVisitor& v) const -{ - return false; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Event::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mTrigger != NULL) - { - mTrigger->setSBMLDocument(d); - } - - if (mPriority != NULL) - { - mPriority->setSBMLDocument(d); - } - - if (mDelay != NULL) - { - mDelay->setSBMLDocument(d); - } - - mEventAssignments.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Event::connectToChild() -{ - SBase::connectToChild(); - - if (mTrigger != NULL) - { - mTrigger->connectToParent(this); - } - - if (mPriority != NULL) - { - mPriority->connectToParent(this); - } - - if (mDelay != NULL) - { - mDelay->connectToParent(this); - } - - mEventAssignments.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Event. - */ -int -Event::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "useValuesFromTriggerTime") - { - value = getUseValuesFromTriggerTime(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Event. - */ -int -Event::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Event. - */ -int -Event::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Event. - */ -int -Event::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Event. - */ -int -Event::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "timeUnits") - { - value = getTimeUnits(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Event's attribute "attributeName" is - * set. - */ -bool -Event::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "useValuesFromTriggerTime") - { - value = isSetUseValuesFromTriggerTime(); - } - else if (attributeName == "timeUnits") - { - value = isSetTimeUnits(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Event. - */ -int -Event::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "useValuesFromTriggerTime") - { - return_value = setUseValuesFromTriggerTime(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Event. - */ -int -Event::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Event. - */ -int -Event::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Event. - */ -int -Event::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Event. - */ -int -Event::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "timeUnits") - { - return_value = setTimeUnits(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Event. - */ -int -Event::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "useValuesFromTriggerTime") - { - value = unsetUseValuesFromTriggerTime(); - } - else if (attributeName == "timeUnits") - { - value = unsetTimeUnits(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this Event. - */ -SBase* -Event::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "trigger") - { - return createTrigger(); - } - else if (elementName == "priority") - { - return createPriority(); - } - else if (elementName == "delay") - { - return createDelay(); - } - else if (elementName == "eventAssignment") - { - return createEventAssignment(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this Event. - */ -int -Event::addChildObject(const std::string& elementName, const SBase* element) -{ - if (elementName == "trigger" && element->getTypeCode() == CORE_TRIGGER) - { - return setTrigger((const Trigger*)(element)); - } - else if (elementName == "priority" && element->getTypeCode() == - CORE_PRIORITY) - { - return setPriority((const Priority*)(element)); - } - else if (elementName == "delay" && element->getTypeCode() == CORE_DELAY) - { - return setDelay((const Delay*)(element)); - } - else if (elementName == "eventAssignment" && element->getTypeCode() == - CORE_EVENTASSIGNMENT) - { - return addEventAssignment((const EventAssignment*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Event. - */ -SBase* -Event::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "trigger") - { - Trigger * obj = mTrigger; - mTrigger = NULL; return obj; - } - else if (elementName == "priority") - { - Priority * obj = mPriority; - mPriority = NULL; return obj; - } - else if (elementName == "delay") - { - Delay * obj = mDelay; - mDelay = NULL; return obj; - } - else if (elementName == "eventAssignment") - { - for (unsigned int i = 0; i < getNumEventAssignments(); i++) - { - if (getEventAssignment(i)->getId() == id) - { - return removeEventAssignment(i); - } - } - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this Event. - */ -unsigned int -Event::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "trigger") - { - if (isSetTrigger()) - { - return 1; - } - } - else if (elementName == "priority") - { - if (isSetPriority()) - { - return 1; - } - } - else if (elementName == "delay") - { - if (isSetDelay()) - { - return 1; - } - } - else if (elementName == "eventAssignment") - { - return getNumEventAssignments(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this Event. - */ -SBase* -Event::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "trigger") - { - return getTrigger(); - } - else if (elementName == "priority") - { - return getPriority(); - } - else if (elementName == "delay") - { - return getDelay(); - } - else if (elementName == "eventAssignment") - { - return getEventAssignment(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -Event::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mTrigger != NULL) - { - if (mTrigger->getId() == id) - { - return mTrigger; - } - - obj = mTrigger->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mPriority != NULL) - { - if (mPriority->getId() == id) - { - return mPriority; - } - - obj = mPriority->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mDelay != NULL) - { - if (mDelay->getId() == id) - { - return mDelay; - } - - obj = mDelay->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - obj = mEventAssignments.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -Event::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - if (name == "trigger") - { - if (getErrorLog() && isSetTrigger()) - { - getErrorLog()->logError(CoreEventAllowedElements, getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mTrigger; - mTrigger = new Trigger(getSBMLNamespaces()); - obj = mTrigger; - } - else if (name == "priority") - { - if (getErrorLog() && isSetPriority()) - { - getErrorLog()->logError(CoreEventAllowedElements, getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mPriority; - mPriority = new Priority(getSBMLNamespaces()); - obj = mPriority; - } - else if (name == "delay") - { - if (getErrorLog() && isSetDelay()) - { - getErrorLog()->logError(CoreEventAllowedElements, getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mDelay; - mDelay = new Delay(getSBMLNamespaces()); - obj = mDelay; - } - else if (name == "sBMLListOfEventAssignments") - { - if (getErrorLog() && mEventAssignments.size() != 0) - { - getErrorLog()->logError(CoreEventAllowedElements, getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - obj = &mEventAssignments; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Event::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("useValuesFromTriggerTime"); - - attributes.add("timeUnits"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Event::readAttributes( - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& - attributes, - const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(SBMLUnknownCoreAttribute); - log->logError(CoreModelLOEventsAllowedCoreAttributes, level, version, - details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(SBMLUnknownCoreAttribute); - log->logError(CoreEventAllowedAttributes, level, version, details, - getLine(), getColumn()); - } - } - } - - // - // useValuesFromTriggerTime bool (use = "required" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetUseValuesFromTriggerTime = - attributes.readInto("useValuesFromTriggerTime", mUseValuesFromTriggerTime); - - if (mIsSetUseValuesFromTriggerTime == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logError(CoreEventUseValuesFromTriggerTimeMustBeBoolean, level, - version); - } - else - { - std::string message = "Core attribute 'useValuesFromTriggerTime' is " - "missing from the element."; - log->logError(CoreEventAllowedAttributes, level, version, message); - } - } - - // - // timeUnits UnitSIdRef (use = "optional" ) - // - - assigned = attributes.readInto("timeUnits", mTimeUnits); - - if (assigned == true) - { - if (mTimeUnits.empty() == true) - { - logEmptyString(mTimeUnits, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mTimeUnits) == false) - { - std::string msg = "The timeUnits attribute on the <" + getElementName() + - ">"; - if (isSetId()) - { - msg += " with id '" + getId() + "'"; - } - - msg += " is '" + mTimeUnits + "', which does not conform to the syntax."; - logError(CoreEventTimeUnitsMustBeUnitSId, level, version, msg, getLine(), - getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Event::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) - const -{ - SBase::writeAttributes(stream); - - if (isSetUseValuesFromTriggerTime() == true) - { - stream.writeAttribute("useValuesFromTriggerTime", getPrefix(), - mUseValuesFromTriggerTime); - } - - if (isSetTimeUnits() == true) - { - stream.writeAttribute("timeUnits", getPrefix(), mTimeUnits); - } -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Event_t using the given SBML Level and @ p version values. - */ -LIBSBML_EXTERN -Event_t * -Event_create(unsigned int level, unsigned int version) -{ - return new Event(level, version); -} - - -/* - * Creates and returns a deep copy of this Event_t object. - */ -LIBSBML_EXTERN -Event_t* -Event_clone(const Event_t* e) -{ - if (e != NULL) - { - return static_cast(e->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Event_t object. - */ -LIBSBML_EXTERN -void -Event_free(Event_t* e) -{ - if (e != NULL) - { - delete e; - } -} - - -/* - * Returns the value of the "useValuesFromTriggerTime" attribute of this - * Event_t. - */ -LIBSBML_EXTERN -int -Event_getUseValuesFromTriggerTime(const Event_t * e) -{ - return (e != NULL) ? static_cast(e->getUseValuesFromTriggerTime()) : 0; -} - - -/* - * Returns the value of the "timeUnits" attribute of this Event_t. - */ -LIBSBML_EXTERN -char * -Event_getTimeUnits(const Event_t * e) -{ - if (e == NULL) - { - return NULL; - } - - return e->getTimeUnits().empty() ? NULL : - safe_strdup(e->getTimeUnits().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this Event_t's "useValuesFromTriggerTime" - * attribute is set. - */ -LIBSBML_EXTERN -int -Event_isSetUseValuesFromTriggerTime(const Event_t * e) -{ - return (e != NULL) ? static_cast(e->isSetUseValuesFromTriggerTime()) : - 0; -} - - -/* - * Predicate returning @c 1 (true) if this Event_t's "timeUnits" attribute is - * set. - */ -LIBSBML_EXTERN -int -Event_isSetTimeUnits(const Event_t * e) -{ - return (e != NULL) ? static_cast(e->isSetTimeUnits()) : 0; -} - - -/* - * Sets the value of the "useValuesFromTriggerTime" attribute of this Event_t. - */ -LIBSBML_EXTERN -int -Event_setUseValuesFromTriggerTime(Event_t * e, int useValuesFromTriggerTime) -{ - return (e != NULL) ? e->setUseValuesFromTriggerTime(useValuesFromTriggerTime) - : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "timeUnits" attribute of this Event_t. - */ -LIBSBML_EXTERN -int -Event_setTimeUnits(Event_t * e, const char * timeUnits) -{ - return (e != NULL) ? e->setTimeUnits(timeUnits) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "useValuesFromTriggerTime" attribute of this - * Event_t. - */ -LIBSBML_EXTERN -int -Event_unsetUseValuesFromTriggerTime(Event_t * e) -{ - return (e != NULL) ? e->unsetUseValuesFromTriggerTime() : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "timeUnits" attribute of this Event_t. - */ -LIBSBML_EXTERN -int -Event_unsetTimeUnits(Event_t * e) -{ - return (e != NULL) ? e->unsetTimeUnits() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "trigger" element of this Event_t. - */ -LIBSBML_EXTERN -const Trigger_t* -Event_getTrigger(const Event_t * e) -{ - if (e == NULL) - { - return NULL; - } - - return (Trigger_t*)(e->getTrigger()); -} - - -/* - * Returns the value of the "priority" element of this Event_t. - */ -LIBSBML_EXTERN -const Priority_t* -Event_getPriority(const Event_t * e) -{ - if (e == NULL) - { - return NULL; - } - - return (Priority_t*)(e->getPriority()); -} - - -/* - * Returns the value of the "delay" element of this Event_t. - */ -LIBSBML_EXTERN -const Delay_t* -Event_getDelay(const Event_t * e) -{ - if (e == NULL) - { - return NULL; - } - - return (Delay_t*)(e->getDelay()); -} - - -/* - * Predicate returning @c 1 (true) if this Event_t's "trigger" element is set. - */ -LIBSBML_EXTERN -int -Event_isSetTrigger(const Event_t * e) -{ - return (e != NULL) ? static_cast(e->isSetTrigger()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Event_t's "priority" element is set. - */ -LIBSBML_EXTERN -int -Event_isSetPriority(const Event_t * e) -{ - return (e != NULL) ? static_cast(e->isSetPriority()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Event_t's "delay" element is set. - */ -LIBSBML_EXTERN -int -Event_isSetDelay(const Event_t * e) -{ - return (e != NULL) ? static_cast(e->isSetDelay()) : 0; -} - - -/* - * Sets the value of the "trigger" element of this Event_t. - */ -LIBSBML_EXTERN -int -Event_setTrigger(Event_t * e, const Trigger_t* trigger) -{ - return (e != NULL) ? e->setTrigger(trigger) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "priority" element of this Event_t. - */ -LIBSBML_EXTERN -int -Event_setPriority(Event_t * e, const Priority_t* priority) -{ - return (e != NULL) ? e->setPriority(priority) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "delay" element of this Event_t. - */ -LIBSBML_EXTERN -int -Event_setDelay(Event_t * e, const Delay_t* delay) -{ - return (e != NULL) ? e->setDelay(delay) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new Trigger_t object, adds it to this Event_t object and returns - * the Trigger_t object created. - */ -LIBSBML_EXTERN -Trigger_t* -Event_createTrigger(Event_t* e) -{ - if (e == NULL) - { - return NULL; - } - - return (Trigger_t*)(e->createTrigger()); -} - - -/* - * Creates a new Priority_t object, adds it to this Event_t object and returns - * the Priority_t object created. - */ -LIBSBML_EXTERN -Priority_t* -Event_createPriority(Event_t* e) -{ - if (e == NULL) - { - return NULL; - } - - return (Priority_t*)(e->createPriority()); -} - - -/* - * Creates a new Delay_t object, adds it to this Event_t object and returns the - * Delay_t object created. - */ -LIBSBML_EXTERN -Delay_t* -Event_createDelay(Event_t* e) -{ - if (e == NULL) - { - return NULL; - } - - return (Delay_t*)(e->createDelay()); -} - - -/* - * Unsets the value of the "trigger" element of this Event_t. - */ -LIBSBML_EXTERN -int -Event_unsetTrigger(Event_t * e) -{ - return (e != NULL) ? e->unsetTrigger() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "priority" element of this Event_t. - */ -LIBSBML_EXTERN -int -Event_unsetPriority(Event_t * e) -{ - return (e != NULL) ? e->unsetPriority() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "delay" element of this Event_t. - */ -LIBSBML_EXTERN -int -Event_unsetDelay(Event_t * e) -{ - return (e != NULL) ? e->unsetDelay() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing EventAssignment_t objects from this Event_t. - */ -LIBSBML_EXTERN -SBMLListOf_t* -Event_getListOfEventAssignments(Event_t* e) -{ - return (e != NULL) ? e->getListOfEventAssignments() : NULL; -} - - -/* - * Get an EventAssignment_t from the Event_t. - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_getEventAssignment(Event_t* e, unsigned int n) -{ - return (e != NULL) ? e->getEventAssignment(n) : NULL; -} - - -/* - * Get an EventAssignment_t from the Event_t based on the element to which it - * refers. - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_getEventAssignmentByVariable(Event_t* e, const char *sid) -{ - return (e != NULL && sid != NULL) ? e->getEventAssignmentByVariable(sid) : - NULL; -} - - -/* - * Adds a copy of the given EventAssignment_t to this Event_t. - */ -LIBSBML_EXTERN -int -Event_addEventAssignment(Event_t* e, const EventAssignment_t* ea) -{ - return (e != NULL) ? e->addEventAssignment(ea) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of EventAssignment_t objects in this Event_t. - */ -LIBSBML_EXTERN -unsigned int -Event_getNumEventAssignments(Event_t* e) -{ - return (e != NULL) ? e->getNumEventAssignments() : SBML_INT_MAX; -} - - -/* - * Creates a new EventAssignment_t object, adds it to this Event_t object and - * returns the EventAssignment_t object created. - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_createEventAssignment(Event_t* e) -{ - return (e != NULL) ? e->createEventAssignment() : NULL; -} - - -/* - * Removes the nth EventAssignment_t from this Event_t and returns a pointer to - * it. - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_removeEventAssignment(Event_t* e, unsigned int n) -{ - return (e != NULL) ? e->removeEventAssignment(n) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Event_t object have been set. - */ -LIBSBML_EXTERN -int -Event_hasRequiredAttributes(const Event_t * e) -{ - return (e != NULL) ? static_cast(e->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Event.cpp + * @brief Implementation of the Event class. + * @author DEVISER + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Event using the given SBML Level and @ p version values. + */ +Event::Event(unsigned int level, unsigned int version) + : SBase(level, version) + , mUseValuesFromTriggerTime (false) + , mIsSetUseValuesFromTriggerTime (false) + , mTrigger (NULL) + , mPriority (NULL) + , mDelay (NULL) + , mEventAssignments (level, version) + , mTimeUnits ("") +{ + setSBMLNamespacesAndOwn(new SBMLNamespaces(level, version)); + connectToChild(); +} + + +/* + * Creates a new Event using the given SBMLNamespaces object @p sbmlns. + */ +Event::Event(SBMLNamespaces *sbmlns) + : SBase(sbmlns) + , mUseValuesFromTriggerTime (false) + , mIsSetUseValuesFromTriggerTime (false) + , mTrigger (NULL) + , mPriority (NULL) + , mDelay (NULL) + , mEventAssignments (sbmlns) + , mTimeUnits ("") +{ + setElementNamespace(sbmlns->getURI()); + connectToChild(); +} + + +/* + * Copy constructor for Event. + */ +Event::Event(const Event& orig) + : SBase( orig ) + , mUseValuesFromTriggerTime ( orig.mUseValuesFromTriggerTime ) + , mIsSetUseValuesFromTriggerTime ( orig.mIsSetUseValuesFromTriggerTime ) + , mTrigger ( NULL ) + , mPriority ( NULL ) + , mDelay ( NULL ) + , mEventAssignments ( orig.mEventAssignments ) + , mTimeUnits ( orig.mTimeUnits ) +{ + if (orig.mTrigger != NULL) + { + mTrigger = orig.mTrigger->clone(); + } + + if (orig.mPriority != NULL) + { + mPriority = orig.mPriority->clone(); + } + + if (orig.mDelay != NULL) + { + mDelay = orig.mDelay->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for Event. + */ +Event& +Event::operator=(const Event& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mUseValuesFromTriggerTime = rhs.mUseValuesFromTriggerTime; + mIsSetUseValuesFromTriggerTime = rhs.mIsSetUseValuesFromTriggerTime; + mEventAssignments = rhs.mEventAssignments; + mTimeUnits = rhs.mTimeUnits; + delete mTrigger; + if (rhs.mTrigger != NULL) + { + mTrigger = rhs.mTrigger->clone(); + } + else + { + mTrigger = NULL; + } + + delete mPriority; + if (rhs.mPriority != NULL) + { + mPriority = rhs.mPriority->clone(); + } + else + { + mPriority = NULL; + } + + delete mDelay; + if (rhs.mDelay != NULL) + { + mDelay = rhs.mDelay->clone(); + } + else + { + mDelay = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Event object. + */ +Event* +Event::clone() const +{ + return new Event(*this); +} + + +/* + * Destructor for Event. + */ +Event::~Event() +{ + delete mTrigger; + mTrigger = NULL; + delete mPriority; + mPriority = NULL; + delete mDelay; + mDelay = NULL; +} + + +/* + * Returns the value of the "useValuesFromTriggerTime" attribute of this Event. + */ +bool +Event::getUseValuesFromTriggerTime() const +{ + return mUseValuesFromTriggerTime; +} + + +/* + * Returns the value of the "timeUnits" attribute of this Event. + */ +const std::string& +Event::getTimeUnits() const +{ + return mTimeUnits; +} + + +/* + * Predicate returning @c true if this Event's "useValuesFromTriggerTime" + * attribute is set. + */ +bool +Event::isSetUseValuesFromTriggerTime() const +{ + return mIsSetUseValuesFromTriggerTime; +} + + +/* + * Predicate returning @c true if this Event's "timeUnits" attribute is set. + */ +bool +Event::isSetTimeUnits() const +{ + return (mTimeUnits.empty() == false); +} + + +/* + * Sets the value of the "useValuesFromTriggerTime" attribute of this Event. + */ +int +Event::setUseValuesFromTriggerTime(bool useValuesFromTriggerTime) +{ + mUseValuesFromTriggerTime = useValuesFromTriggerTime; + mIsSetUseValuesFromTriggerTime = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "timeUnits" attribute of this Event. + */ +int +Event::setTimeUnits(const std::string& timeUnits) +{ + if (!(SyntaxChecker::isValidInternalUnitSId(timeUnits))) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mTimeUnits = timeUnits; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "useValuesFromTriggerTime" attribute of this Event. + */ +int +Event::unsetUseValuesFromTriggerTime() +{ + mUseValuesFromTriggerTime = false; + mIsSetUseValuesFromTriggerTime = false; + + if (isSetUseValuesFromTriggerTime() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "timeUnits" attribute of this Event. + */ +int +Event::unsetTimeUnits() +{ + mTimeUnits.erase(); + + if (mTimeUnits.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "trigger" element of this Event. + */ +const Trigger* +Event::getTrigger() const +{ + return mTrigger; +} + + +/* + * Returns the value of the "trigger" element of this Event. + */ +Trigger* +Event::getTrigger() +{ + return mTrigger; +} + + +/* + * Returns the value of the "priority" element of this Event. + */ +const Priority* +Event::getPriority() const +{ + return mPriority; +} + + +/* + * Returns the value of the "priority" element of this Event. + */ +Priority* +Event::getPriority() +{ + return mPriority; +} + + +/* + * Returns the value of the "delay" element of this Event. + */ +const Delay* +Event::getDelay() const +{ + return mDelay; +} + + +/* + * Returns the value of the "delay" element of this Event. + */ +Delay* +Event::getDelay() +{ + return mDelay; +} + + +/* + * Predicate returning @c true if this Event's "trigger" element is set. + */ +bool +Event::isSetTrigger() const +{ + return (mTrigger != NULL); +} + + +/* + * Predicate returning @c true if this Event's "priority" element is set. + */ +bool +Event::isSetPriority() const +{ + return (mPriority != NULL); +} + + +/* + * Predicate returning @c true if this Event's "delay" element is set. + */ +bool +Event::isSetDelay() const +{ + return (mDelay != NULL); +} + + +/* + * Sets the value of the "trigger" element of this Event. + */ +int +Event::setTrigger(const Trigger* trigger) +{ + if (mTrigger == trigger) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (trigger == NULL) + { + delete mTrigger; + mTrigger = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mTrigger; + mTrigger = (trigger != NULL) ? trigger->clone() : NULL; + if (mTrigger != NULL) + { + mTrigger->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "priority" element of this Event. + */ +int +Event::setPriority(const Priority* priority) +{ + if (mPriority == priority) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (priority == NULL) + { + delete mPriority; + mPriority = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mPriority; + mPriority = (priority != NULL) ? priority->clone() : NULL; + if (mPriority != NULL) + { + mPriority->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "delay" element of this Event. + */ +int +Event::setDelay(const Delay* delay) +{ + if (mDelay == delay) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (delay == NULL) + { + delete mDelay; + mDelay = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mDelay; + mDelay = (delay != NULL) ? delay->clone() : NULL; + if (mDelay != NULL) + { + mDelay->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new Trigger object, adds it to this Event object and returns the + * Trigger object created. + */ +Trigger* +Event::createTrigger() +{ + if (mTrigger != NULL) + { + delete mTrigger; + } + + mTrigger = new Trigger(getSBMLNamespaces()); + + connectToChild(); + + return mTrigger; +} + + +/* + * Creates a new Priority object, adds it to this Event object and returns the + * Priority object created. + */ +Priority* +Event::createPriority() +{ + if (mPriority != NULL) + { + delete mPriority; + } + + mPriority = new Priority(getSBMLNamespaces()); + + connectToChild(); + + return mPriority; +} + + +/* + * Creates a new Delay object, adds it to this Event object and returns the + * Delay object created. + */ +Delay* +Event::createDelay() +{ + if (mDelay != NULL) + { + delete mDelay; + } + + mDelay = new Delay(getSBMLNamespaces()); + + connectToChild(); + + return mDelay; +} + + +/* + * Unsets the value of the "trigger" element of this Event. + */ +int +Event::unsetTrigger() +{ + delete mTrigger; + mTrigger = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "priority" element of this Event. + */ +int +Event::unsetPriority() +{ + delete mPriority; + mPriority = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "delay" element of this Event. + */ +int +Event::unsetDelay() +{ + delete mDelay; + mDelay = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the SBMLListOfEventAssignments from this Event. + */ +const SBMLListOfEventAssignments* +Event::getListOfEventAssignments() const +{ + return &mEventAssignments; +} + + +/* + * Returns the SBMLListOfEventAssignments from this Event. + */ +SBMLListOfEventAssignments* +Event::getListOfEventAssignments() +{ + return &mEventAssignments; +} + + +/* + * Get an EventAssignment from the Event. + */ +EventAssignment* +Event::getEventAssignment(unsigned int n) +{ + return mEventAssignments.get(n); +} + + +/* + * Get an EventAssignment from the Event. + */ +const EventAssignment* +Event::getEventAssignment(unsigned int n) const +{ + return mEventAssignments.get(n); +} + + +/* + * Get an EventAssignment from the Event based on the element to which it + * refers. + */ +const EventAssignment* +Event::getEventAssignmentByVariable(const std::string& sid) const +{ + return mEventAssignments.getByVariable(sid); +} + + +/* + * Get an EventAssignment from the Event based on the element to which it + * refers. + */ +EventAssignment* +Event::getEventAssignmentByVariable(const std::string& sid) +{ + return mEventAssignments.getByVariable(sid); +} + + +/* + * Adds a copy of the given EventAssignment to this Event. + */ +int +Event::addEventAssignment(const EventAssignment* ea) +{ + if (ea == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (ea->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != ea->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != ea->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(ea)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else + { + return mEventAssignments.append(ea); + } +} + + +/* + * Get the number of EventAssignment objects in this Event. + */ +unsigned int +Event::getNumEventAssignments() const +{ + return mEventAssignments.size(); +} + + +/* + * Creates a new EventAssignment object, adds it to this Event object and + * returns the EventAssignment object created. + */ +EventAssignment* +Event::createEventAssignment() +{ + EventAssignment* ea = NULL; + + try + { + ea = new EventAssignment(getSBMLNamespaces()); + } + catch (...) + { + } + + if (ea != NULL) + { + mEventAssignments.appendAndOwn(ea); + } + + return ea; +} + + +/* + * Removes the nth EventAssignment from this Event and returns a pointer to it. + */ +EventAssignment* +Event::removeEventAssignment(unsigned int n) +{ + return mEventAssignments.remove(n); +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +Event::renameSIdRefs(const std::string& oldid, const std::string& newid) +{ + if (isSetTimeUnits() && mTimeUnits == oldid) + { + setTimeUnits(newid); + } +} + + +/* + * Returns the XML element name of this Event object. + */ +const std::string& +Event::getElementName() const +{ + static const string name = ""; + return name; +} + + +/* + * Returns the libSBML type code for this Event object. + */ +int +Event::getTypeCode() const +{ + return CORE_EVENT; +} + + +/* + * Predicate returning @c true if all the required attributes for this Event + * object have been set. + */ +bool +Event::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetUseValuesFromTriggerTime() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Event::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) + const +{ + SBase::writeElements(stream); + + if (isSetTrigger() == true) + { + mTrigger->write(stream); + } + + if (isSetPriority() == true) + { + mPriority->write(stream); + } + + if (isSetDelay() == true) + { + mDelay->write(stream); + } + + if (getNumEventAssignments() > 0) + { + mEventAssignments.write(stream); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Event::accept(SBMLVisitor& v) const +{ + return false; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Event::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mTrigger != NULL) + { + mTrigger->setSBMLDocument(d); + } + + if (mPriority != NULL) + { + mPriority->setSBMLDocument(d); + } + + if (mDelay != NULL) + { + mDelay->setSBMLDocument(d); + } + + mEventAssignments.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Event::connectToChild() +{ + SBase::connectToChild(); + + if (mTrigger != NULL) + { + mTrigger->connectToParent(this); + } + + if (mPriority != NULL) + { + mPriority->connectToParent(this); + } + + if (mDelay != NULL) + { + mDelay->connectToParent(this); + } + + mEventAssignments.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Event. + */ +int +Event::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "useValuesFromTriggerTime") + { + value = getUseValuesFromTriggerTime(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Event. + */ +int +Event::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Event. + */ +int +Event::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Event. + */ +int +Event::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Event. + */ +int +Event::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "timeUnits") + { + value = getTimeUnits(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Event's attribute "attributeName" is + * set. + */ +bool +Event::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "useValuesFromTriggerTime") + { + value = isSetUseValuesFromTriggerTime(); + } + else if (attributeName == "timeUnits") + { + value = isSetTimeUnits(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Event. + */ +int +Event::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "useValuesFromTriggerTime") + { + return_value = setUseValuesFromTriggerTime(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Event. + */ +int +Event::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Event. + */ +int +Event::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Event. + */ +int +Event::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Event. + */ +int +Event::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "timeUnits") + { + return_value = setTimeUnits(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Event. + */ +int +Event::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "useValuesFromTriggerTime") + { + value = unsetUseValuesFromTriggerTime(); + } + else if (attributeName == "timeUnits") + { + value = unsetTimeUnits(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this Event. + */ +SBase* +Event::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "trigger") + { + return createTrigger(); + } + else if (elementName == "priority") + { + return createPriority(); + } + else if (elementName == "delay") + { + return createDelay(); + } + else if (elementName == "eventAssignment") + { + return createEventAssignment(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this Event. + */ +int +Event::addChildObject(const std::string& elementName, const SBase* element) +{ + if (elementName == "trigger" && element->getTypeCode() == CORE_TRIGGER) + { + return setTrigger((const Trigger*)(element)); + } + else if (elementName == "priority" && element->getTypeCode() == + CORE_PRIORITY) + { + return setPriority((const Priority*)(element)); + } + else if (elementName == "delay" && element->getTypeCode() == CORE_DELAY) + { + return setDelay((const Delay*)(element)); + } + else if (elementName == "eventAssignment" && element->getTypeCode() == + CORE_EVENTASSIGNMENT) + { + return addEventAssignment((const EventAssignment*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * Event. + */ +SBase* +Event::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "trigger") + { + Trigger * obj = mTrigger; + mTrigger = NULL; return obj; + } + else if (elementName == "priority") + { + Priority * obj = mPriority; + mPriority = NULL; return obj; + } + else if (elementName == "delay") + { + Delay * obj = mDelay; + mDelay = NULL; return obj; + } + else if (elementName == "eventAssignment") + { + for (unsigned int i = 0; i < getNumEventAssignments(); i++) + { + if (getEventAssignment(i)->getId() == id) + { + return removeEventAssignment(i); + } + } + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this Event. + */ +unsigned int +Event::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "trigger") + { + if (isSetTrigger()) + { + return 1; + } + } + else if (elementName == "priority") + { + if (isSetPriority()) + { + return 1; + } + } + else if (elementName == "delay") + { + if (isSetDelay()) + { + return 1; + } + } + else if (elementName == "eventAssignment") + { + return getNumEventAssignments(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this Event. + */ +SBase* +Event::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "trigger") + { + return getTrigger(); + } + else if (elementName == "priority") + { + return getPriority(); + } + else if (elementName == "delay") + { + return getDelay(); + } + else if (elementName == "eventAssignment") + { + return getEventAssignment(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +Event::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mTrigger != NULL) + { + if (mTrigger->getId() == id) + { + return mTrigger; + } + + obj = mTrigger->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mPriority != NULL) + { + if (mPriority->getId() == id) + { + return mPriority; + } + + obj = mPriority->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mDelay != NULL) + { + if (mDelay->getId() == id) + { + return mDelay; + } + + obj = mDelay->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + obj = mEventAssignments.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +Event::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "trigger") + { + if (getErrorLog() && isSetTrigger()) + { + getErrorLog()->logError(CoreEventAllowedElements, getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mTrigger; + mTrigger = new Trigger(getSBMLNamespaces()); + obj = mTrigger; + } + else if (name == "priority") + { + if (getErrorLog() && isSetPriority()) + { + getErrorLog()->logError(CoreEventAllowedElements, getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mPriority; + mPriority = new Priority(getSBMLNamespaces()); + obj = mPriority; + } + else if (name == "delay") + { + if (getErrorLog() && isSetDelay()) + { + getErrorLog()->logError(CoreEventAllowedElements, getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mDelay; + mDelay = new Delay(getSBMLNamespaces()); + obj = mDelay; + } + else if (name == "sBMLListOfEventAssignments") + { + if (getErrorLog() && mEventAssignments.size() != 0) + { + getErrorLog()->logError(CoreEventAllowedElements, getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + obj = &mEventAssignments; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Event::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("useValuesFromTriggerTime"); + + attributes.add("timeUnits"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Event::readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& + attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(SBMLUnknownCoreAttribute); + log->logError(CoreModelLOEventsAllowedCoreAttributes, level, version, + details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == SBMLUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(SBMLUnknownCoreAttribute); + log->logError(CoreEventAllowedAttributes, level, version, details, + getLine(), getColumn()); + } + } + } + + // + // useValuesFromTriggerTime bool (use = "required" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetUseValuesFromTriggerTime = + attributes.readInto("useValuesFromTriggerTime", mUseValuesFromTriggerTime); + + if (mIsSetUseValuesFromTriggerTime == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logError(CoreEventUseValuesFromTriggerTimeMustBeBoolean, level, + version); + } + else + { + std::string message = "Core attribute 'useValuesFromTriggerTime' is " + "missing from the element."; + log->logError(CoreEventAllowedAttributes, level, version, message); + } + } + + // + // timeUnits UnitSIdRef (use = "optional" ) + // + + assigned = attributes.readInto("timeUnits", mTimeUnits); + + if (assigned == true) + { + if (mTimeUnits.empty() == true) + { + logEmptyString(mTimeUnits, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mTimeUnits) == false) + { + std::string msg = "The timeUnits attribute on the <" + getElementName() + + ">"; + if (isSetId()) + { + msg += " with id '" + getId() + "'"; + } + + msg += " is '" + mTimeUnits + "', which does not conform to the syntax."; + logError(CoreEventTimeUnitsMustBeUnitSId, level, version, msg, getLine(), + getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Event::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) + const +{ + SBase::writeAttributes(stream); + + if (isSetUseValuesFromTriggerTime() == true) + { + stream.writeAttribute("useValuesFromTriggerTime", getPrefix(), + mUseValuesFromTriggerTime); + } + + if (isSetTimeUnits() == true) + { + stream.writeAttribute("timeUnits", getPrefix(), mTimeUnits); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Event_t using the given SBML Level and @ p version values. + */ +LIBSBML_EXTERN +Event_t * +Event_create(unsigned int level, unsigned int version) +{ + return new Event(level, version); +} + + +/* + * Creates and returns a deep copy of this Event_t object. + */ +LIBSBML_EXTERN +Event_t* +Event_clone(const Event_t* e) +{ + if (e != NULL) + { + return static_cast(e->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Event_t object. + */ +LIBSBML_EXTERN +void +Event_free(Event_t* e) +{ + if (e != NULL) + { + delete e; + } +} + + +/* + * Returns the value of the "useValuesFromTriggerTime" attribute of this + * Event_t. + */ +LIBSBML_EXTERN +int +Event_getUseValuesFromTriggerTime(const Event_t * e) +{ + return (e != NULL) ? static_cast(e->getUseValuesFromTriggerTime()) : 0; +} + + +/* + * Returns the value of the "timeUnits" attribute of this Event_t. + */ +LIBSBML_EXTERN +char * +Event_getTimeUnits(const Event_t * e) +{ + if (e == NULL) + { + return NULL; + } + + return e->getTimeUnits().empty() ? NULL : + safe_strdup(e->getTimeUnits().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this Event_t's "useValuesFromTriggerTime" + * attribute is set. + */ +LIBSBML_EXTERN +int +Event_isSetUseValuesFromTriggerTime(const Event_t * e) +{ + return (e != NULL) ? static_cast(e->isSetUseValuesFromTriggerTime()) : + 0; +} + + +/* + * Predicate returning @c 1 (true) if this Event_t's "timeUnits" attribute is + * set. + */ +LIBSBML_EXTERN +int +Event_isSetTimeUnits(const Event_t * e) +{ + return (e != NULL) ? static_cast(e->isSetTimeUnits()) : 0; +} + + +/* + * Sets the value of the "useValuesFromTriggerTime" attribute of this Event_t. + */ +LIBSBML_EXTERN +int +Event_setUseValuesFromTriggerTime(Event_t * e, int useValuesFromTriggerTime) +{ + return (e != NULL) ? e->setUseValuesFromTriggerTime(useValuesFromTriggerTime) + : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "timeUnits" attribute of this Event_t. + */ +LIBSBML_EXTERN +int +Event_setTimeUnits(Event_t * e, const char * timeUnits) +{ + return (e != NULL) ? e->setTimeUnits(timeUnits) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "useValuesFromTriggerTime" attribute of this + * Event_t. + */ +LIBSBML_EXTERN +int +Event_unsetUseValuesFromTriggerTime(Event_t * e) +{ + return (e != NULL) ? e->unsetUseValuesFromTriggerTime() : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "timeUnits" attribute of this Event_t. + */ +LIBSBML_EXTERN +int +Event_unsetTimeUnits(Event_t * e) +{ + return (e != NULL) ? e->unsetTimeUnits() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "trigger" element of this Event_t. + */ +LIBSBML_EXTERN +const Trigger_t* +Event_getTrigger(const Event_t * e) +{ + if (e == NULL) + { + return NULL; + } + + return (Trigger_t*)(e->getTrigger()); +} + + +/* + * Returns the value of the "priority" element of this Event_t. + */ +LIBSBML_EXTERN +const Priority_t* +Event_getPriority(const Event_t * e) +{ + if (e == NULL) + { + return NULL; + } + + return (Priority_t*)(e->getPriority()); +} + + +/* + * Returns the value of the "delay" element of this Event_t. + */ +LIBSBML_EXTERN +const Delay_t* +Event_getDelay(const Event_t * e) +{ + if (e == NULL) + { + return NULL; + } + + return (Delay_t*)(e->getDelay()); +} + + +/* + * Predicate returning @c 1 (true) if this Event_t's "trigger" element is set. + */ +LIBSBML_EXTERN +int +Event_isSetTrigger(const Event_t * e) +{ + return (e != NULL) ? static_cast(e->isSetTrigger()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Event_t's "priority" element is set. + */ +LIBSBML_EXTERN +int +Event_isSetPriority(const Event_t * e) +{ + return (e != NULL) ? static_cast(e->isSetPriority()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Event_t's "delay" element is set. + */ +LIBSBML_EXTERN +int +Event_isSetDelay(const Event_t * e) +{ + return (e != NULL) ? static_cast(e->isSetDelay()) : 0; +} + + +/* + * Sets the value of the "trigger" element of this Event_t. + */ +LIBSBML_EXTERN +int +Event_setTrigger(Event_t * e, const Trigger_t* trigger) +{ + return (e != NULL) ? e->setTrigger(trigger) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "priority" element of this Event_t. + */ +LIBSBML_EXTERN +int +Event_setPriority(Event_t * e, const Priority_t* priority) +{ + return (e != NULL) ? e->setPriority(priority) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "delay" element of this Event_t. + */ +LIBSBML_EXTERN +int +Event_setDelay(Event_t * e, const Delay_t* delay) +{ + return (e != NULL) ? e->setDelay(delay) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new Trigger_t object, adds it to this Event_t object and returns + * the Trigger_t object created. + */ +LIBSBML_EXTERN +Trigger_t* +Event_createTrigger(Event_t* e) +{ + if (e == NULL) + { + return NULL; + } + + return (Trigger_t*)(e->createTrigger()); +} + + +/* + * Creates a new Priority_t object, adds it to this Event_t object and returns + * the Priority_t object created. + */ +LIBSBML_EXTERN +Priority_t* +Event_createPriority(Event_t* e) +{ + if (e == NULL) + { + return NULL; + } + + return (Priority_t*)(e->createPriority()); +} + + +/* + * Creates a new Delay_t object, adds it to this Event_t object and returns the + * Delay_t object created. + */ +LIBSBML_EXTERN +Delay_t* +Event_createDelay(Event_t* e) +{ + if (e == NULL) + { + return NULL; + } + + return (Delay_t*)(e->createDelay()); +} + + +/* + * Unsets the value of the "trigger" element of this Event_t. + */ +LIBSBML_EXTERN +int +Event_unsetTrigger(Event_t * e) +{ + return (e != NULL) ? e->unsetTrigger() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "priority" element of this Event_t. + */ +LIBSBML_EXTERN +int +Event_unsetPriority(Event_t * e) +{ + return (e != NULL) ? e->unsetPriority() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "delay" element of this Event_t. + */ +LIBSBML_EXTERN +int +Event_unsetDelay(Event_t * e) +{ + return (e != NULL) ? e->unsetDelay() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing EventAssignment_t objects from this Event_t. + */ +LIBSBML_EXTERN +SBMLListOf_t* +Event_getListOfEventAssignments(Event_t* e) +{ + return (e != NULL) ? e->getListOfEventAssignments() : NULL; +} + + +/* + * Get an EventAssignment_t from the Event_t. + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_getEventAssignment(Event_t* e, unsigned int n) +{ + return (e != NULL) ? e->getEventAssignment(n) : NULL; +} + + +/* + * Get an EventAssignment_t from the Event_t based on the element to which it + * refers. + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_getEventAssignmentByVariable(Event_t* e, const char *sid) +{ + return (e != NULL && sid != NULL) ? e->getEventAssignmentByVariable(sid) : + NULL; +} + + +/* + * Adds a copy of the given EventAssignment_t to this Event_t. + */ +LIBSBML_EXTERN +int +Event_addEventAssignment(Event_t* e, const EventAssignment_t* ea) +{ + return (e != NULL) ? e->addEventAssignment(ea) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of EventAssignment_t objects in this Event_t. + */ +LIBSBML_EXTERN +unsigned int +Event_getNumEventAssignments(Event_t* e) +{ + return (e != NULL) ? e->getNumEventAssignments() : SBML_INT_MAX; +} + + +/* + * Creates a new EventAssignment_t object, adds it to this Event_t object and + * returns the EventAssignment_t object created. + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_createEventAssignment(Event_t* e) +{ + return (e != NULL) ? e->createEventAssignment() : NULL; +} + + +/* + * Removes the nth EventAssignment_t from this Event_t and returns a pointer to + * it. + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_removeEventAssignment(Event_t* e, unsigned int n) +{ + return (e != NULL) ? e->removeEventAssignment(n) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Event_t object have been set. + */ +LIBSBML_EXTERN +int +Event_hasRequiredAttributes(const Event_t * e) +{ + return (e != NULL) ? static_cast(e->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Event.h b/generator/tests/test_cpp_code/test-code/Event.h index f8715b9f..cff6ef28 100644 --- a/generator/tests/test_cpp_code/test-code/Event.h +++ b/generator/tests/test_cpp_code/test-code/Event.h @@ -1,1700 +1,1700 @@ -/** - * @file Event.h - * @brief Definition of the Event class. - * @author DEVISER - * - * - * - * @class Event - * @sbmlbrief{core} TODO:Definition of the Event class. - */ - - -#ifndef Event_H__ -#define Event_H__ - - -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Event : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - bool mUseValuesFromTriggerTime; - bool mIsSetUseValuesFromTriggerTime; - Trigger* mTrigger; - Priority* mPriority; - Delay* mDelay; - SBMLListOfEventAssignments mEventAssignments; - std::string mTimeUnits; - - /** @endcond */ - -public: - - /** - * Creates a new Event using the given SBML Level and @ p version values. - * - * @param level an unsigned int, the SBML Level to assign to this Event. - * - * @param version an unsigned int, the SBML Version to assign to this Event. - * - * @copydetails doc_note_setting_lv_pkg - */ - Event(unsigned int level = SBML_DEFAULT_LEVEL, - unsigned int version = SBML_DEFAULT_VERSION); - - - /** - * Creates a new Event using the given SBMLNamespaces object @p sbmlns. - * - * @param sbmlns the SBMLNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Event(SBMLNamespaces *sbmlns); - - - /** - * Copy constructor for Event. - * - * @param orig the Event instance to copy. - */ - Event(const Event& orig); - - - /** - * Assignment operator for Event. - * - * @param rhs the Event object whose values are to be used as the basis of - * the assignment. - */ - Event& operator=(const Event& rhs); - - - /** - * Creates and returns a deep copy of this Event object. - * - * @return a (deep) copy of this Event object. - */ - virtual Event* clone() const; - - - /** - * Destructor for Event. - */ - virtual ~Event(); - - - /** - * Returns the value of the "useValuesFromTriggerTime" attribute of this - * Event. - * - * @return the value of the "useValuesFromTriggerTime" attribute of this - * Event as a boolean. - */ - bool getUseValuesFromTriggerTime() const; - - - /** - * Returns the value of the "timeUnits" attribute of this Event. - * - * @return the value of the "timeUnits" attribute of this Event as a string. - */ - const std::string& getTimeUnits() const; - - - /** - * Predicate returning @c true if this Event's "useValuesFromTriggerTime" - * attribute is set. - * - * @return @c true if this Event's "useValuesFromTriggerTime" attribute has - * been set, otherwise @c false is returned. - */ - bool isSetUseValuesFromTriggerTime() const; - - - /** - * Predicate returning @c true if this Event's "timeUnits" attribute is set. - * - * @return @c true if this Event's "timeUnits" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetTimeUnits() const; - - - /** - * Sets the value of the "useValuesFromTriggerTime" attribute of this Event. - * - * @param useValuesFromTriggerTime bool value of the - * "useValuesFromTriggerTime" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setUseValuesFromTriggerTime(bool useValuesFromTriggerTime); - - - /** - * Sets the value of the "timeUnits" attribute of this Event. - * - * @param timeUnits std::string& value of the "timeUnits" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setTimeUnits(const std::string& timeUnits); - - - /** - * Unsets the value of the "useValuesFromTriggerTime" attribute of this - * Event. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetUseValuesFromTriggerTime(); - - - /** - * Unsets the value of the "timeUnits" attribute of this Event. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetTimeUnits(); - - - /** - * Returns the value of the "trigger" element of this Event. - * - * @return the value of the "trigger" element of this Event as a Trigger*. - */ - const Trigger* getTrigger() const; - - - /** - * Returns the value of the "trigger" element of this Event. - * - * @return the value of the "trigger" element of this Event as a Trigger*. - */ - Trigger* getTrigger(); - - - /** - * Returns the value of the "priority" element of this Event. - * - * @return the value of the "priority" element of this Event as a Priority*. - */ - const Priority* getPriority() const; - - - /** - * Returns the value of the "priority" element of this Event. - * - * @return the value of the "priority" element of this Event as a Priority*. - */ - Priority* getPriority(); - - - /** - * Returns the value of the "delay" element of this Event. - * - * @return the value of the "delay" element of this Event as a Delay*. - */ - const Delay* getDelay() const; - - - /** - * Returns the value of the "delay" element of this Event. - * - * @return the value of the "delay" element of this Event as a Delay*. - */ - Delay* getDelay(); - - - /** - * Predicate returning @c true if this Event's "trigger" element is set. - * - * @return @c true if this Event's "trigger" element has been set, otherwise - * @c false is returned. - */ - bool isSetTrigger() const; - - - /** - * Predicate returning @c true if this Event's "priority" element is set. - * - * @return @c true if this Event's "priority" element has been set, otherwise - * @c false is returned. - */ - bool isSetPriority() const; - - - /** - * Predicate returning @c true if this Event's "delay" element is set. - * - * @return @c true if this Event's "delay" element has been set, otherwise - * @c false is returned. - */ - bool isSetDelay() const; - - - /** - * Sets the value of the "trigger" element of this Event. - * - * @param trigger Trigger* value of the "trigger" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setTrigger(const Trigger* trigger); - - - /** - * Sets the value of the "priority" element of this Event. - * - * @param priority Priority* value of the "priority" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setPriority(const Priority* priority); - - - /** - * Sets the value of the "delay" element of this Event. - * - * @param delay Delay* value of the "delay" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setDelay(const Delay* delay); - - - /** - * Creates a new Trigger object, adds it to this Event object and returns the - * Trigger object created. - * - * @return a new Trigger object instance. - */ - Trigger* createTrigger(); - - - /** - * Creates a new Priority object, adds it to this Event object and returns - * the Priority object created. - * - * @return a new Priority object instance. - */ - Priority* createPriority(); - - - /** - * Creates a new Delay object, adds it to this Event object and returns the - * Delay object created. - * - * @return a new Delay object instance. - */ - Delay* createDelay(); - - - /** - * Unsets the value of the "trigger" element of this Event. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetTrigger(); - - - /** - * Unsets the value of the "priority" element of this Event. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetPriority(); - - - /** - * Unsets the value of the "delay" element of this Event. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetDelay(); - - - /** - * Returns the SBMLListOfEventAssignments from this Event. - * - * @return the SBMLListOfEventAssignments from this Event. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addEventAssignment(const EventAssignment* object) - * @see createEventAssignment() - * @see getEventAssignment(const std::string& sid) - * @see getEventAssignment(unsigned int n) - * @see getNumEventAssignments() - * @see removeEventAssignment(const std::string& sid) - * @see removeEventAssignment(unsigned int n) - */ - const SBMLListOfEventAssignments* getListOfEventAssignments() const; - - - /** - * Returns the SBMLListOfEventAssignments from this Event. - * - * @return the SBMLListOfEventAssignments from this Event. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addEventAssignment(const EventAssignment* object) - * @see createEventAssignment() - * @see getEventAssignment(const std::string& sid) - * @see getEventAssignment(unsigned int n) - * @see getNumEventAssignments() - * @see removeEventAssignment(const std::string& sid) - * @see removeEventAssignment(unsigned int n) - */ - SBMLListOfEventAssignments* getListOfEventAssignments(); - - - /** - * Get an EventAssignment from the Event. - * - * @param n an unsigned int representing the index of the EventAssignment to - * retrieve. - * - * @return the nth EventAssignment in the SBMLListOfEventAssignments within - * this Event or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addEventAssignment(const EventAssignment* object) - * @see createEventAssignment() - * @see getEventAssignment(const std::string& sid) - * @see getNumEventAssignments() - * @see removeEventAssignment(const std::string& sid) - * @see removeEventAssignment(unsigned int n) - */ - EventAssignment* getEventAssignment(unsigned int n); - - - /** - * Get an EventAssignment from the Event. - * - * @param n an unsigned int representing the index of the EventAssignment to - * retrieve. - * - * @return the nth EventAssignment in the SBMLListOfEventAssignments within - * this Event or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addEventAssignment(const EventAssignment* object) - * @see createEventAssignment() - * @see getEventAssignment(const std::string& sid) - * @see getNumEventAssignments() - * @see removeEventAssignment(const std::string& sid) - * @see removeEventAssignment(unsigned int n) - */ - const EventAssignment* getEventAssignment(unsigned int n) const; - - - /** - * Get an EventAssignment from the Event based on the element to which it - * refers. - * - * @param sid a string representing the "variable" attribute of the - * EventAssignment object to retrieve. - * - * @return the first EventAssignment in this Event based on the given - * variable attribute or NULL if no such EventAssignment exists. - * - * @copydetails doc_returned_unowned_pointer - */ - const EventAssignment* getEventAssignmentByVariable(const std::string& sid) - const; - - - /** - * Get an EventAssignment from the Event based on the element to which it - * refers. - * - * @param sid a string representing the "variable" attribute of the - * EventAssignment object to retrieve. - * - * @return the first EventAssignment in this Event based on the given - * variable attribute or NULL if no such EventAssignment exists. - * - * @copydetails doc_returned_unowned_pointer - */ - EventAssignment* getEventAssignmentByVariable(const std::string& sid); - - - /** - * Adds a copy of the given EventAssignment to this Event. - * - * @param ea the EventAssignment object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createEventAssignment() - * @see getEventAssignment(const std::string& sid) - * @see getEventAssignment(unsigned int n) - * @see getNumEventAssignments() - * @see removeEventAssignment(const std::string& sid) - * @see removeEventAssignment(unsigned int n) - */ - int addEventAssignment(const EventAssignment* ea); - - - /** - * Get the number of EventAssignment objects in this Event. - * - * @return the number of EventAssignment objects in this Event. - * - * @see addEventAssignment(const EventAssignment* object) - * @see createEventAssignment() - * @see getEventAssignment(const std::string& sid) - * @see getEventAssignment(unsigned int n) - * @see removeEventAssignment(const std::string& sid) - * @see removeEventAssignment(unsigned int n) - */ - unsigned int getNumEventAssignments() const; - - - /** - * Creates a new EventAssignment object, adds it to this Event object and - * returns the EventAssignment object created. - * - * @return a new EventAssignment object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addEventAssignment(const EventAssignment* object) - * @see getEventAssignment(const std::string& sid) - * @see getEventAssignment(unsigned int n) - * @see getNumEventAssignments() - * @see removeEventAssignment(const std::string& sid) - * @see removeEventAssignment(unsigned int n) - */ - EventAssignment* createEventAssignment(); - - - /** - * Removes the nth EventAssignment from this Event and returns a pointer to - * it. - * - * @param n an unsigned int representing the index of the EventAssignment to - * remove. - * - * @return a pointer to the nth EventAssignment in this Event. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addEventAssignment(const EventAssignment* object) - * @see createEventAssignment() - * @see getEventAssignment(const std::string& sid) - * @see getEventAssignment(unsigned int n) - * @see getNumEventAssignments() - * @see removeEventAssignment(const std::string& sid) - */ - EventAssignment* removeEventAssignment(unsigned int n); - - - /** - * @copydoc doc_renamesidref_common - */ - virtual void renameSIdRefs(const std::string& oldid, - const std::string& newid); - - - /** - * Returns the XML element name of this Event object. - * - * For Event, the XML element name is always @c "". - * - * @return the name of this element, i.e. @c "". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Event object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{CORE_EVENT, SBMLTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this Event - * object have been set. - * - * @return @c true to indicate that all the required attributes of this Event - * have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the Event object are: - * @li "useValuesFromTriggerTime" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Event's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Event's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Event. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this Event. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this Event. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * Event. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this Event. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this Event. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& - stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes( - const LIBSBML_CPP_NAMESPACE_QUALIFIER - XMLAttributes& attributes, - const LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& - stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Event_t using the given SBML Level and @ p version values. - * - * @param level an unsigned int, the SBML Level to assign to this Event_t. - * - * @param version an unsigned int, the SBML Version to assign to this Event_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Event_t - */ -LIBSBML_EXTERN -Event_t * -Event_create(unsigned int level, unsigned int version); - - -/** - * Creates and returns a deep copy of this Event_t object. - * - * @param e the Event_t structure. - * - * @return a (deep) copy of this Event_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Event_t - */ -LIBSBML_EXTERN -Event_t* -Event_clone(const Event_t* e); - - -/** - * Frees this Event_t object. - * - * @param e the Event_t structure. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -void -Event_free(Event_t* e); - - -/** - * Returns the value of the "useValuesFromTriggerTime" attribute of this - * Event_t. - * - * @param e the Event_t structure whose useValuesFromTriggerTime is sought. - * - * @return the value of the "useValuesFromTriggerTime" attribute of this - * Event_t as a boolean. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_getUseValuesFromTriggerTime(const Event_t * e); - - -/** - * Returns the value of the "timeUnits" attribute of this Event_t. - * - * @param e the Event_t structure whose timeUnits is sought. - * - * @return the value of the "timeUnits" attribute of this Event_t as a pointer - * to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Event_t - */ -LIBSBML_EXTERN -char * -Event_getTimeUnits(const Event_t * e); - - -/** - * Predicate returning @c 1 (true) if this Event_t's "useValuesFromTriggerTime" - * attribute is set. - * - * @param e the Event_t structure. - * - * @return @c 1 (true) if this Event_t's "useValuesFromTriggerTime" attribute - * has been set, otherwise @c 0 (false) is returned. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_isSetUseValuesFromTriggerTime(const Event_t * e); - - -/** - * Predicate returning @c 1 (true) if this Event_t's "timeUnits" attribute is - * set. - * - * @param e the Event_t structure. - * - * @return @c 1 (true) if this Event_t's "timeUnits" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_isSetTimeUnits(const Event_t * e); - - -/** - * Sets the value of the "useValuesFromTriggerTime" attribute of this Event_t. - * - * @param e the Event_t structure. - * - * @param useValuesFromTriggerTime int value of the "useValuesFromTriggerTime" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_setUseValuesFromTriggerTime(Event_t * e, int useValuesFromTriggerTime); - - -/** - * Sets the value of the "timeUnits" attribute of this Event_t. - * - * @param e the Event_t structure. - * - * @param timeUnits const char * value of the "timeUnits" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_setTimeUnits(Event_t * e, const char * timeUnits); - - -/** - * Unsets the value of the "useValuesFromTriggerTime" attribute of this - * Event_t. - * - * @param e the Event_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_unsetUseValuesFromTriggerTime(Event_t * e); - - -/** - * Unsets the value of the "timeUnits" attribute of this Event_t. - * - * @param e the Event_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_unsetTimeUnits(Event_t * e); - - -/** - * Returns the value of the "trigger" element of this Event_t. - * - * @param e the Event_t structure whose trigger is sought. - * - * @return the value of the "trigger" element of this Event_t as a Trigger*. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -const Trigger_t* -Event_getTrigger(const Event_t * e); - - -/** - * Returns the value of the "priority" element of this Event_t. - * - * @param e the Event_t structure whose priority is sought. - * - * @return the value of the "priority" element of this Event_t as a Priority*. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -const Priority_t* -Event_getPriority(const Event_t * e); - - -/** - * Returns the value of the "delay" element of this Event_t. - * - * @param e the Event_t structure whose delay is sought. - * - * @return the value of the "delay" element of this Event_t as a Delay*. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -const Delay_t* -Event_getDelay(const Event_t * e); - - -/** - * Predicate returning @c 1 (true) if this Event_t's "trigger" element is set. - * - * @param e the Event_t structure. - * - * @return @c 1 (true) if this Event_t's "trigger" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_isSetTrigger(const Event_t * e); - - -/** - * Predicate returning @c 1 (true) if this Event_t's "priority" element is set. - * - * @param e the Event_t structure. - * - * @return @c 1 (true) if this Event_t's "priority" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_isSetPriority(const Event_t * e); - - -/** - * Predicate returning @c 1 (true) if this Event_t's "delay" element is set. - * - * @param e the Event_t structure. - * - * @return @c 1 (true) if this Event_t's "delay" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_isSetDelay(const Event_t * e); - - -/** - * Sets the value of the "trigger" element of this Event_t. - * - * @param e the Event_t structure. - * - * @param trigger Trigger_t* value of the "trigger" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_setTrigger(Event_t * e, const Trigger_t* trigger); - - -/** - * Sets the value of the "priority" element of this Event_t. - * - * @param e the Event_t structure. - * - * @param priority Priority_t* value of the "priority" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_setPriority(Event_t * e, const Priority_t* priority); - - -/** - * Sets the value of the "delay" element of this Event_t. - * - * @param e the Event_t structure. - * - * @param delay Delay_t* value of the "delay" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_setDelay(Event_t * e, const Delay_t* delay); - - -/** - * Creates a new Trigger_t object, adds it to this Event_t object and returns - * the Trigger_t object created. - * - * @param e the Event_t structure to which the Trigger_t should be added. - * - * @return a new Trigger_t object instance. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -Trigger_t* -Event_createTrigger(Event_t* e); - - -/** - * Creates a new Priority_t object, adds it to this Event_t object and returns - * the Priority_t object created. - * - * @param e the Event_t structure to which the Priority_t should be added. - * - * @return a new Priority_t object instance. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -Priority_t* -Event_createPriority(Event_t* e); - - -/** - * Creates a new Delay_t object, adds it to this Event_t object and returns the - * Delay_t object created. - * - * @param e the Event_t structure to which the Delay_t should be added. - * - * @return a new Delay_t object instance. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -Delay_t* -Event_createDelay(Event_t* e); - - -/** - * Unsets the value of the "trigger" element of this Event_t. - * - * @param e the Event_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_unsetTrigger(Event_t * e); - - -/** - * Unsets the value of the "priority" element of this Event_t. - * - * @param e the Event_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_unsetPriority(Event_t * e); - - -/** - * Unsets the value of the "delay" element of this Event_t. - * - * @param e the Event_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_unsetDelay(Event_t * e); - - -/** - * Returns a ListOf_t * containing EventAssignment_t objects from this Event_t. - * - * @param e the Event_t structure whose SBMLListOfEventAssignments is sought. - * - * @return the SBMLListOfEventAssignments from this Event_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Event_addEventAssignment() - * @see Event_createEventAssignment() - * @see Event_getEventAssignmentById() - * @see Event_getEventAssignment() - * @see Event_getNumEventAssignments() - * @see Event_removeEventAssignmentById() - * @see Event_removeEventAssignment() - * - * @memberof Event_t - */ -LIBSBML_EXTERN -SBMLListOf_t* -Event_getListOfEventAssignments(Event_t* e); - - -/** - * Get an EventAssignment_t from the Event_t. - * - * @param e the Event_t structure to search. - * - * @param n an unsigned int representing the index of the EventAssignment_t to - * retrieve. - * - * @return the nth EventAssignment_t in the SBMLListOfEventAssignments within - * this Event or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Event_t - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_getEventAssignment(Event_t* e, unsigned int n); - - -/** - * Get an EventAssignment_t from the Event_t based on the element to which it - * refers. - * - * @param e the Event_t structure to search. - * - * @param sid a string representing the "variable" attribute of the - * EventAssignment_t object to retrieve. - * - * @return the first EventAssignment_t in this Event_t based on the given - * variable attribute or NULL if no such EventAssignment_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Event_t - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_getEventAssignmentByVariable(Event_t* e, const char *sid); - - -/** - * Adds a copy of the given EventAssignment_t to this Event_t. - * - * @param e the Event_t structure to which the EventAssignment_t should be - * added. - * - * @param ea the EventAssignment_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_addEventAssignment(Event_t* e, const EventAssignment_t* ea); - - -/** - * Get the number of EventAssignment_t objects in this Event_t. - * - * @param e the Event_t structure to query. - * - * @return the number of EventAssignment_t objects in this Event_t. - * - * @memberof Event_t - */ -LIBSBML_EXTERN -unsigned int -Event_getNumEventAssignments(Event_t* e); - - -/** - * Creates a new EventAssignment_t object, adds it to this Event_t object and - * returns the EventAssignment_t object created. - * - * @param e the Event_t structure to which the EventAssignment_t should be - * added. - * - * @return a new EventAssignment_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Event_t - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_createEventAssignment(Event_t* e); - - -/** - * Removes the nth EventAssignment_t from this Event_t and returns a pointer to - * it. - * - * @param e the Event_t structure to search. - * - * @param n an unsigned int representing the index of the EventAssignment_t to - * remove. - * - * @return a pointer to the nth EventAssignment_t in this Event_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Event_t - */ -LIBSBML_EXTERN -EventAssignment_t* -Event_removeEventAssignment(Event_t* e, unsigned int n); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Event_t object have been set. - * - * @param e the Event_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Event_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the Event_t object are: - * @li "useValuesFromTriggerTime" - * - * @memberof Event_t - */ -LIBSBML_EXTERN -int -Event_hasRequiredAttributes(const Event_t * e); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Event_H__ */ - - +/** + * @file Event.h + * @brief Definition of the Event class. + * @author DEVISER + * + * + * + * @class Event + * @sbmlbrief{core} TODO:Definition of the Event class. + */ + + +#ifndef Event_H__ +#define Event_H__ + + +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Event : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + bool mUseValuesFromTriggerTime; + bool mIsSetUseValuesFromTriggerTime; + Trigger* mTrigger; + Priority* mPriority; + Delay* mDelay; + SBMLListOfEventAssignments mEventAssignments; + std::string mTimeUnits; + + /** @endcond */ + +public: + + /** + * Creates a new Event using the given SBML Level and @ p version values. + * + * @param level an unsigned int, the SBML Level to assign to this Event. + * + * @param version an unsigned int, the SBML Version to assign to this Event. + * + * @copydetails doc_note_setting_lv_pkg + */ + Event(unsigned int level = SBML_DEFAULT_LEVEL, + unsigned int version = SBML_DEFAULT_VERSION); + + + /** + * Creates a new Event using the given SBMLNamespaces object @p sbmlns. + * + * @param sbmlns the SBMLNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Event(SBMLNamespaces *sbmlns); + + + /** + * Copy constructor for Event. + * + * @param orig the Event instance to copy. + */ + Event(const Event& orig); + + + /** + * Assignment operator for Event. + * + * @param rhs the Event object whose values are to be used as the basis of + * the assignment. + */ + Event& operator=(const Event& rhs); + + + /** + * Creates and returns a deep copy of this Event object. + * + * @return a (deep) copy of this Event object. + */ + virtual Event* clone() const; + + + /** + * Destructor for Event. + */ + virtual ~Event(); + + + /** + * Returns the value of the "useValuesFromTriggerTime" attribute of this + * Event. + * + * @return the value of the "useValuesFromTriggerTime" attribute of this + * Event as a boolean. + */ + bool getUseValuesFromTriggerTime() const; + + + /** + * Returns the value of the "timeUnits" attribute of this Event. + * + * @return the value of the "timeUnits" attribute of this Event as a string. + */ + const std::string& getTimeUnits() const; + + + /** + * Predicate returning @c true if this Event's "useValuesFromTriggerTime" + * attribute is set. + * + * @return @c true if this Event's "useValuesFromTriggerTime" attribute has + * been set, otherwise @c false is returned. + */ + bool isSetUseValuesFromTriggerTime() const; + + + /** + * Predicate returning @c true if this Event's "timeUnits" attribute is set. + * + * @return @c true if this Event's "timeUnits" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetTimeUnits() const; + + + /** + * Sets the value of the "useValuesFromTriggerTime" attribute of this Event. + * + * @param useValuesFromTriggerTime bool value of the + * "useValuesFromTriggerTime" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setUseValuesFromTriggerTime(bool useValuesFromTriggerTime); + + + /** + * Sets the value of the "timeUnits" attribute of this Event. + * + * @param timeUnits std::string& value of the "timeUnits" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setTimeUnits(const std::string& timeUnits); + + + /** + * Unsets the value of the "useValuesFromTriggerTime" attribute of this + * Event. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetUseValuesFromTriggerTime(); + + + /** + * Unsets the value of the "timeUnits" attribute of this Event. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetTimeUnits(); + + + /** + * Returns the value of the "trigger" element of this Event. + * + * @return the value of the "trigger" element of this Event as a Trigger*. + */ + const Trigger* getTrigger() const; + + + /** + * Returns the value of the "trigger" element of this Event. + * + * @return the value of the "trigger" element of this Event as a Trigger*. + */ + Trigger* getTrigger(); + + + /** + * Returns the value of the "priority" element of this Event. + * + * @return the value of the "priority" element of this Event as a Priority*. + */ + const Priority* getPriority() const; + + + /** + * Returns the value of the "priority" element of this Event. + * + * @return the value of the "priority" element of this Event as a Priority*. + */ + Priority* getPriority(); + + + /** + * Returns the value of the "delay" element of this Event. + * + * @return the value of the "delay" element of this Event as a Delay*. + */ + const Delay* getDelay() const; + + + /** + * Returns the value of the "delay" element of this Event. + * + * @return the value of the "delay" element of this Event as a Delay*. + */ + Delay* getDelay(); + + + /** + * Predicate returning @c true if this Event's "trigger" element is set. + * + * @return @c true if this Event's "trigger" element has been set, otherwise + * @c false is returned. + */ + bool isSetTrigger() const; + + + /** + * Predicate returning @c true if this Event's "priority" element is set. + * + * @return @c true if this Event's "priority" element has been set, otherwise + * @c false is returned. + */ + bool isSetPriority() const; + + + /** + * Predicate returning @c true if this Event's "delay" element is set. + * + * @return @c true if this Event's "delay" element has been set, otherwise + * @c false is returned. + */ + bool isSetDelay() const; + + + /** + * Sets the value of the "trigger" element of this Event. + * + * @param trigger Trigger* value of the "trigger" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setTrigger(const Trigger* trigger); + + + /** + * Sets the value of the "priority" element of this Event. + * + * @param priority Priority* value of the "priority" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setPriority(const Priority* priority); + + + /** + * Sets the value of the "delay" element of this Event. + * + * @param delay Delay* value of the "delay" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setDelay(const Delay* delay); + + + /** + * Creates a new Trigger object, adds it to this Event object and returns the + * Trigger object created. + * + * @return a new Trigger object instance. + */ + Trigger* createTrigger(); + + + /** + * Creates a new Priority object, adds it to this Event object and returns + * the Priority object created. + * + * @return a new Priority object instance. + */ + Priority* createPriority(); + + + /** + * Creates a new Delay object, adds it to this Event object and returns the + * Delay object created. + * + * @return a new Delay object instance. + */ + Delay* createDelay(); + + + /** + * Unsets the value of the "trigger" element of this Event. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetTrigger(); + + + /** + * Unsets the value of the "priority" element of this Event. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetPriority(); + + + /** + * Unsets the value of the "delay" element of this Event. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetDelay(); + + + /** + * Returns the SBMLListOfEventAssignments from this Event. + * + * @return the SBMLListOfEventAssignments from this Event. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addEventAssignment(const EventAssignment* object) + * @see createEventAssignment() + * @see getEventAssignment(const std::string& sid) + * @see getEventAssignment(unsigned int n) + * @see getNumEventAssignments() + * @see removeEventAssignment(const std::string& sid) + * @see removeEventAssignment(unsigned int n) + */ + const SBMLListOfEventAssignments* getListOfEventAssignments() const; + + + /** + * Returns the SBMLListOfEventAssignments from this Event. + * + * @return the SBMLListOfEventAssignments from this Event. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addEventAssignment(const EventAssignment* object) + * @see createEventAssignment() + * @see getEventAssignment(const std::string& sid) + * @see getEventAssignment(unsigned int n) + * @see getNumEventAssignments() + * @see removeEventAssignment(const std::string& sid) + * @see removeEventAssignment(unsigned int n) + */ + SBMLListOfEventAssignments* getListOfEventAssignments(); + + + /** + * Get an EventAssignment from the Event. + * + * @param n an unsigned int representing the index of the EventAssignment to + * retrieve. + * + * @return the nth EventAssignment in the SBMLListOfEventAssignments within + * this Event or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addEventAssignment(const EventAssignment* object) + * @see createEventAssignment() + * @see getEventAssignment(const std::string& sid) + * @see getNumEventAssignments() + * @see removeEventAssignment(const std::string& sid) + * @see removeEventAssignment(unsigned int n) + */ + EventAssignment* getEventAssignment(unsigned int n); + + + /** + * Get an EventAssignment from the Event. + * + * @param n an unsigned int representing the index of the EventAssignment to + * retrieve. + * + * @return the nth EventAssignment in the SBMLListOfEventAssignments within + * this Event or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addEventAssignment(const EventAssignment* object) + * @see createEventAssignment() + * @see getEventAssignment(const std::string& sid) + * @see getNumEventAssignments() + * @see removeEventAssignment(const std::string& sid) + * @see removeEventAssignment(unsigned int n) + */ + const EventAssignment* getEventAssignment(unsigned int n) const; + + + /** + * Get an EventAssignment from the Event based on the element to which it + * refers. + * + * @param sid a string representing the "variable" attribute of the + * EventAssignment object to retrieve. + * + * @return the first EventAssignment in this Event based on the given + * variable attribute or NULL if no such EventAssignment exists. + * + * @copydetails doc_returned_unowned_pointer + */ + const EventAssignment* getEventAssignmentByVariable(const std::string& sid) + const; + + + /** + * Get an EventAssignment from the Event based on the element to which it + * refers. + * + * @param sid a string representing the "variable" attribute of the + * EventAssignment object to retrieve. + * + * @return the first EventAssignment in this Event based on the given + * variable attribute or NULL if no such EventAssignment exists. + * + * @copydetails doc_returned_unowned_pointer + */ + EventAssignment* getEventAssignmentByVariable(const std::string& sid); + + + /** + * Adds a copy of the given EventAssignment to this Event. + * + * @param ea the EventAssignment object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createEventAssignment() + * @see getEventAssignment(const std::string& sid) + * @see getEventAssignment(unsigned int n) + * @see getNumEventAssignments() + * @see removeEventAssignment(const std::string& sid) + * @see removeEventAssignment(unsigned int n) + */ + int addEventAssignment(const EventAssignment* ea); + + + /** + * Get the number of EventAssignment objects in this Event. + * + * @return the number of EventAssignment objects in this Event. + * + * @see addEventAssignment(const EventAssignment* object) + * @see createEventAssignment() + * @see getEventAssignment(const std::string& sid) + * @see getEventAssignment(unsigned int n) + * @see removeEventAssignment(const std::string& sid) + * @see removeEventAssignment(unsigned int n) + */ + unsigned int getNumEventAssignments() const; + + + /** + * Creates a new EventAssignment object, adds it to this Event object and + * returns the EventAssignment object created. + * + * @return a new EventAssignment object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addEventAssignment(const EventAssignment* object) + * @see getEventAssignment(const std::string& sid) + * @see getEventAssignment(unsigned int n) + * @see getNumEventAssignments() + * @see removeEventAssignment(const std::string& sid) + * @see removeEventAssignment(unsigned int n) + */ + EventAssignment* createEventAssignment(); + + + /** + * Removes the nth EventAssignment from this Event and returns a pointer to + * it. + * + * @param n an unsigned int representing the index of the EventAssignment to + * remove. + * + * @return a pointer to the nth EventAssignment in this Event. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addEventAssignment(const EventAssignment* object) + * @see createEventAssignment() + * @see getEventAssignment(const std::string& sid) + * @see getEventAssignment(unsigned int n) + * @see getNumEventAssignments() + * @see removeEventAssignment(const std::string& sid) + */ + EventAssignment* removeEventAssignment(unsigned int n); + + + /** + * @copydoc doc_renamesidref_common + */ + virtual void renameSIdRefs(const std::string& oldid, + const std::string& newid); + + + /** + * Returns the XML element name of this Event object. + * + * For Event, the XML element name is always @c "". + * + * @return the name of this element, i.e. @c "". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Event object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{CORE_EVENT, SBMLTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this Event + * object have been set. + * + * @return @c true to indicate that all the required attributes of this Event + * have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the Event object are: + * @li "useValuesFromTriggerTime" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Event's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Event's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Event. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this Event. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this Event. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * Event. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this Event. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this Event. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER + XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Event_t using the given SBML Level and @ p version values. + * + * @param level an unsigned int, the SBML Level to assign to this Event_t. + * + * @param version an unsigned int, the SBML Version to assign to this Event_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Event_t + */ +LIBSBML_EXTERN +Event_t * +Event_create(unsigned int level, unsigned int version); + + +/** + * Creates and returns a deep copy of this Event_t object. + * + * @param e the Event_t structure. + * + * @return a (deep) copy of this Event_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Event_t + */ +LIBSBML_EXTERN +Event_t* +Event_clone(const Event_t* e); + + +/** + * Frees this Event_t object. + * + * @param e the Event_t structure. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +void +Event_free(Event_t* e); + + +/** + * Returns the value of the "useValuesFromTriggerTime" attribute of this + * Event_t. + * + * @param e the Event_t structure whose useValuesFromTriggerTime is sought. + * + * @return the value of the "useValuesFromTriggerTime" attribute of this + * Event_t as a boolean. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_getUseValuesFromTriggerTime(const Event_t * e); + + +/** + * Returns the value of the "timeUnits" attribute of this Event_t. + * + * @param e the Event_t structure whose timeUnits is sought. + * + * @return the value of the "timeUnits" attribute of this Event_t as a pointer + * to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Event_t + */ +LIBSBML_EXTERN +char * +Event_getTimeUnits(const Event_t * e); + + +/** + * Predicate returning @c 1 (true) if this Event_t's "useValuesFromTriggerTime" + * attribute is set. + * + * @param e the Event_t structure. + * + * @return @c 1 (true) if this Event_t's "useValuesFromTriggerTime" attribute + * has been set, otherwise @c 0 (false) is returned. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_isSetUseValuesFromTriggerTime(const Event_t * e); + + +/** + * Predicate returning @c 1 (true) if this Event_t's "timeUnits" attribute is + * set. + * + * @param e the Event_t structure. + * + * @return @c 1 (true) if this Event_t's "timeUnits" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_isSetTimeUnits(const Event_t * e); + + +/** + * Sets the value of the "useValuesFromTriggerTime" attribute of this Event_t. + * + * @param e the Event_t structure. + * + * @param useValuesFromTriggerTime int value of the "useValuesFromTriggerTime" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_setUseValuesFromTriggerTime(Event_t * e, int useValuesFromTriggerTime); + + +/** + * Sets the value of the "timeUnits" attribute of this Event_t. + * + * @param e the Event_t structure. + * + * @param timeUnits const char * value of the "timeUnits" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_setTimeUnits(Event_t * e, const char * timeUnits); + + +/** + * Unsets the value of the "useValuesFromTriggerTime" attribute of this + * Event_t. + * + * @param e the Event_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_unsetUseValuesFromTriggerTime(Event_t * e); + + +/** + * Unsets the value of the "timeUnits" attribute of this Event_t. + * + * @param e the Event_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_unsetTimeUnits(Event_t * e); + + +/** + * Returns the value of the "trigger" element of this Event_t. + * + * @param e the Event_t structure whose trigger is sought. + * + * @return the value of the "trigger" element of this Event_t as a Trigger*. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +const Trigger_t* +Event_getTrigger(const Event_t * e); + + +/** + * Returns the value of the "priority" element of this Event_t. + * + * @param e the Event_t structure whose priority is sought. + * + * @return the value of the "priority" element of this Event_t as a Priority*. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +const Priority_t* +Event_getPriority(const Event_t * e); + + +/** + * Returns the value of the "delay" element of this Event_t. + * + * @param e the Event_t structure whose delay is sought. + * + * @return the value of the "delay" element of this Event_t as a Delay*. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +const Delay_t* +Event_getDelay(const Event_t * e); + + +/** + * Predicate returning @c 1 (true) if this Event_t's "trigger" element is set. + * + * @param e the Event_t structure. + * + * @return @c 1 (true) if this Event_t's "trigger" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_isSetTrigger(const Event_t * e); + + +/** + * Predicate returning @c 1 (true) if this Event_t's "priority" element is set. + * + * @param e the Event_t structure. + * + * @return @c 1 (true) if this Event_t's "priority" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_isSetPriority(const Event_t * e); + + +/** + * Predicate returning @c 1 (true) if this Event_t's "delay" element is set. + * + * @param e the Event_t structure. + * + * @return @c 1 (true) if this Event_t's "delay" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_isSetDelay(const Event_t * e); + + +/** + * Sets the value of the "trigger" element of this Event_t. + * + * @param e the Event_t structure. + * + * @param trigger Trigger_t* value of the "trigger" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_setTrigger(Event_t * e, const Trigger_t* trigger); + + +/** + * Sets the value of the "priority" element of this Event_t. + * + * @param e the Event_t structure. + * + * @param priority Priority_t* value of the "priority" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_setPriority(Event_t * e, const Priority_t* priority); + + +/** + * Sets the value of the "delay" element of this Event_t. + * + * @param e the Event_t structure. + * + * @param delay Delay_t* value of the "delay" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_setDelay(Event_t * e, const Delay_t* delay); + + +/** + * Creates a new Trigger_t object, adds it to this Event_t object and returns + * the Trigger_t object created. + * + * @param e the Event_t structure to which the Trigger_t should be added. + * + * @return a new Trigger_t object instance. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +Trigger_t* +Event_createTrigger(Event_t* e); + + +/** + * Creates a new Priority_t object, adds it to this Event_t object and returns + * the Priority_t object created. + * + * @param e the Event_t structure to which the Priority_t should be added. + * + * @return a new Priority_t object instance. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +Priority_t* +Event_createPriority(Event_t* e); + + +/** + * Creates a new Delay_t object, adds it to this Event_t object and returns the + * Delay_t object created. + * + * @param e the Event_t structure to which the Delay_t should be added. + * + * @return a new Delay_t object instance. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +Delay_t* +Event_createDelay(Event_t* e); + + +/** + * Unsets the value of the "trigger" element of this Event_t. + * + * @param e the Event_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_unsetTrigger(Event_t * e); + + +/** + * Unsets the value of the "priority" element of this Event_t. + * + * @param e the Event_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_unsetPriority(Event_t * e); + + +/** + * Unsets the value of the "delay" element of this Event_t. + * + * @param e the Event_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_unsetDelay(Event_t * e); + + +/** + * Returns a ListOf_t * containing EventAssignment_t objects from this Event_t. + * + * @param e the Event_t structure whose SBMLListOfEventAssignments is sought. + * + * @return the SBMLListOfEventAssignments from this Event_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Event_addEventAssignment() + * @see Event_createEventAssignment() + * @see Event_getEventAssignmentById() + * @see Event_getEventAssignment() + * @see Event_getNumEventAssignments() + * @see Event_removeEventAssignmentById() + * @see Event_removeEventAssignment() + * + * @memberof Event_t + */ +LIBSBML_EXTERN +SBMLListOf_t* +Event_getListOfEventAssignments(Event_t* e); + + +/** + * Get an EventAssignment_t from the Event_t. + * + * @param e the Event_t structure to search. + * + * @param n an unsigned int representing the index of the EventAssignment_t to + * retrieve. + * + * @return the nth EventAssignment_t in the SBMLListOfEventAssignments within + * this Event or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Event_t + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_getEventAssignment(Event_t* e, unsigned int n); + + +/** + * Get an EventAssignment_t from the Event_t based on the element to which it + * refers. + * + * @param e the Event_t structure to search. + * + * @param sid a string representing the "variable" attribute of the + * EventAssignment_t object to retrieve. + * + * @return the first EventAssignment_t in this Event_t based on the given + * variable attribute or NULL if no such EventAssignment_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Event_t + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_getEventAssignmentByVariable(Event_t* e, const char *sid); + + +/** + * Adds a copy of the given EventAssignment_t to this Event_t. + * + * @param e the Event_t structure to which the EventAssignment_t should be + * added. + * + * @param ea the EventAssignment_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_addEventAssignment(Event_t* e, const EventAssignment_t* ea); + + +/** + * Get the number of EventAssignment_t objects in this Event_t. + * + * @param e the Event_t structure to query. + * + * @return the number of EventAssignment_t objects in this Event_t. + * + * @memberof Event_t + */ +LIBSBML_EXTERN +unsigned int +Event_getNumEventAssignments(Event_t* e); + + +/** + * Creates a new EventAssignment_t object, adds it to this Event_t object and + * returns the EventAssignment_t object created. + * + * @param e the Event_t structure to which the EventAssignment_t should be + * added. + * + * @return a new EventAssignment_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Event_t + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_createEventAssignment(Event_t* e); + + +/** + * Removes the nth EventAssignment_t from this Event_t and returns a pointer to + * it. + * + * @param e the Event_t structure to search. + * + * @param n an unsigned int representing the index of the EventAssignment_t to + * remove. + * + * @return a pointer to the nth EventAssignment_t in this Event_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Event_t + */ +LIBSBML_EXTERN +EventAssignment_t* +Event_removeEventAssignment(Event_t* e, unsigned int n); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Event_t object have been set. + * + * @param e the Event_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Event_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the Event_t object are: + * @li "useValuesFromTriggerTime" + * + * @memberof Event_t + */ +LIBSBML_EXTERN +int +Event_hasRequiredAttributes(const Event_t * e); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Event_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ExponentialDistribution.cpp b/generator/tests/test_cpp_code/test-code/ExponentialDistribution.cpp index 3d1f5127..3d411570 100644 --- a/generator/tests/test_cpp_code/test-code/ExponentialDistribution.cpp +++ b/generator/tests/test_cpp_code/test-code/ExponentialDistribution.cpp @@ -1,1137 +1,1137 @@ -/** - * @file ExponentialDistribution.cpp - * @brief Implementation of the ExponentialDistribution class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ExponentialDistribution using the given SBML Level, Version - * and “distrib” package version. - */ -ExponentialDistribution::ExponentialDistribution(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : ContinuousUnivariateDistribution(level, version, pkgVersion) - , mRate (NULL) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new ExponentialDistribution using the given DistribPkgNamespaces - * object. - */ -ExponentialDistribution::ExponentialDistribution(DistribPkgNamespaces - *distribns) - : ContinuousUnivariateDistribution(distribns) - , mRate (NULL) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for ExponentialDistribution. - */ -ExponentialDistribution::ExponentialDistribution(const ExponentialDistribution& - orig) - : ContinuousUnivariateDistribution( orig ) - , mRate ( NULL ) -{ - if (orig.mRate != NULL) - { - mRate = orig.mRate->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for ExponentialDistribution. - */ -ExponentialDistribution& -ExponentialDistribution::operator=(const ExponentialDistribution& rhs) -{ - if (&rhs != this) - { - ContinuousUnivariateDistribution::operator=(rhs); - delete mRate; - if (rhs.mRate != NULL) - { - mRate = rhs.mRate->clone(); - } - else - { - mRate = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ExponentialDistribution object. - */ -ExponentialDistribution* -ExponentialDistribution::clone() const -{ - return new ExponentialDistribution(*this); -} - - -/* - * Destructor for ExponentialDistribution. - */ -ExponentialDistribution::~ExponentialDistribution() -{ - delete mRate; - mRate = NULL; -} - - -/* - * Returns the value of the "rate" element of this ExponentialDistribution. - */ -const UncertValue* -ExponentialDistribution::getRate() const -{ - return mRate; -} - - -/* - * Returns the value of the "rate" element of this ExponentialDistribution. - */ -UncertValue* -ExponentialDistribution::getRate() -{ - return mRate; -} - - -/* - * Predicate returning @c true if this ExponentialDistribution's "rate" element - * is set. - */ -bool -ExponentialDistribution::isSetRate() const -{ - return (mRate != NULL); -} - - -/* - * Sets the value of the "rate" element of this ExponentialDistribution. - */ -int -ExponentialDistribution::setRate(const UncertValue* rate) -{ - if (mRate == rate) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (rate == NULL) - { - delete mRate; - mRate = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mRate; - mRate = (rate != NULL) ? rate->clone() : NULL; - if (mRate != NULL) - { - mRate->setElementName("rate"); - mRate->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new UncertValue object, adds it to this ExponentialDistribution - * object and returns the UncertValue object created. - */ -UncertValue* -ExponentialDistribution::createRate() -{ - if (mRate != NULL) - { - delete mRate; - } - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - mRate = new UncertValue(distribns); - - mRate->setElementName("rate"); - - delete distribns; - - connectToChild(); - - return mRate; -} - - -/* - * Unsets the value of the "rate" element of this ExponentialDistribution. - */ -int -ExponentialDistribution::unsetRate() -{ - delete mRate; - mRate = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this ExponentialDistribution object. - */ -const std::string& -ExponentialDistribution::getElementName() const -{ - static const string name = "exponentialDistribution"; - return name; -} - - -/* - * Returns the libSBML type code for this ExponentialDistribution object. - */ -int -ExponentialDistribution::getTypeCode() const -{ - return SBML_DISTRIB_EXPONENTIALDISTRIBUTION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * ExponentialDistribution object have been set. - */ -bool -ExponentialDistribution::hasRequiredAttributes() const -{ - bool allPresent = ContinuousUnivariateDistribution::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * ExponentialDistribution object have been set. - */ -bool -ExponentialDistribution::hasRequiredElements() const -{ - bool allPresent = ContinuousUnivariateDistribution::hasRequiredElements(); - - if (isSetRate() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ExponentialDistribution::writeElements(XMLOutputStream& stream) const -{ - ContinuousUnivariateDistribution::writeElements(stream); - - if (isSetRate() == true) - { - mRate->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ExponentialDistribution::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mRate != NULL) - { - mRate->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ExponentialDistribution::setSBMLDocument(SBMLDocument* d) -{ - ContinuousUnivariateDistribution::setSBMLDocument(d); - - if (mRate != NULL) - { - mRate->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -ExponentialDistribution::connectToChild() -{ - ContinuousUnivariateDistribution::connectToChild(); - - if (mRate != NULL) - { - mRate->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ExponentialDistribution::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - ContinuousUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, - flag); - - if (isSetRate()) - { - mRate->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -ExponentialDistribution::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - ContinuousUnivariateDistribution::updateSBMLNamespace(package, level, - version); - - if (mRate != NULL) - { - mRate->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = - ContinuousUnivariateDistribution::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ExponentialDistribution's attribute - * "attributeName" is set. - */ -bool -ExponentialDistribution::isSetAttribute(const std::string& attributeName) const -{ - bool value = ContinuousUnivariateDistribution::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::setAttribute(const std::string& attributeName, - int value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = - ContinuousUnivariateDistribution::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * ExponentialDistribution. - */ -int -ExponentialDistribution::unsetAttribute(const std::string& attributeName) -{ - int value = ContinuousUnivariateDistribution::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this - * ExponentialDistribution. - */ -SBase* -ExponentialDistribution::createChildObject(const std::string& elementName) -{ - ContinuousUnivariateDistribution* obj = NULL; - - if (elementName == "rate") - { - return createRate(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this ExponentialDistribution. - */ -int -ExponentialDistribution::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "rate" && element->getTypeCode() == - SBML_DISTRIB_UNCERTVALUE) - { - return setRate((const UncertValue*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * ExponentialDistribution. - */ -SBase* -ExponentialDistribution::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "rate") - { - UncertValue * obj = mRate; - mRate = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this ExponentialDistribution. - */ -unsigned int -ExponentialDistribution::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "rate") - { - if (isSetRate()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this ExponentialDistribution. - */ -SBase* -ExponentialDistribution::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "rate") - { - return getRate(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -ExponentialDistribution::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mRate != NULL) - { - if (mRate->getId() == id) - { - return mRate; - } - - obj = mRate->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -ExponentialDistribution::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mRate != NULL) - { - if (mRate->getMetaId() == metaid) - { - return mRate; - } - - obj = mRate->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -ExponentialDistribution::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mRate, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -ExponentialDistribution::createObject(XMLInputStream& stream) -{ - SBase* obj = ContinuousUnivariateDistribution::createObject(stream); - - const std::string& name = stream.peek().getName(); - - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - - if (name == "rate") - { - if (getErrorLog() && isSetRate()) - { - getErrorLog()->logPackageError("distrib", - DistribExponentialDistributionAllowedElements, getPackageVersion(), - getLevel(), getVersion(), "", getLine(), getColumn()); - } - - delete mRate; - mRate = new UncertValue(distribns); - mRate->setElementName(name); - obj = mRate; - } - - delete distribns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -ExponentialDistribution::addExpectedAttributes(ExpectedAttributes& attributes) -{ - ContinuousUnivariateDistribution::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ExponentialDistribution::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - ContinuousUnivariateDistribution::readAttributes(attributes, - expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribExponentialDistributionAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribExponentialDistributionAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ExponentialDistribution::writeAttributes(XMLOutputStream& stream) const -{ - ContinuousUnivariateDistribution::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ExponentialDistribution_t using the given SBML Level, Version - * and “distrib” package version. - */ -LIBSBML_EXTERN -ExponentialDistribution_t * -ExponentialDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ExponentialDistribution(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ExponentialDistribution_t object. - */ -LIBSBML_EXTERN -ExponentialDistribution_t* -ExponentialDistribution_clone(const ExponentialDistribution_t* ed) -{ - if (ed != NULL) - { - return static_cast(ed->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ExponentialDistribution_t object. - */ -LIBSBML_EXTERN -void -ExponentialDistribution_free(ExponentialDistribution_t* ed) -{ - if (ed != NULL) - { - delete ed; - } -} - - -/* - * Returns the value of the "rate" element of this ExponentialDistribution_t. - */ -LIBSBML_EXTERN -const UncertValue_t* -ExponentialDistribution_getRate(const ExponentialDistribution_t * ed) -{ - if (ed == NULL) - { - return NULL; - } - - return (UncertValue_t*)(ed->getRate()); -} - - -/* - * Predicate returning @c 1 (true) if this ExponentialDistribution_t's "rate" - * element is set. - */ -LIBSBML_EXTERN -int -ExponentialDistribution_isSetRate(const ExponentialDistribution_t * ed) -{ - return (ed != NULL) ? static_cast(ed->isSetRate()) : 0; -} - - -/* - * Sets the value of the "rate" element of this ExponentialDistribution_t. - */ -LIBSBML_EXTERN -int -ExponentialDistribution_setRate(ExponentialDistribution_t * ed, - const UncertValue_t* rate) -{ - return (ed != NULL) ? ed->setRate(rate) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new UncertValue_t object, adds it to this - * ExponentialDistribution_t object and returns the UncertValue_t object - * created. - */ -LIBSBML_EXTERN -UncertValue_t* -ExponentialDistribution_createRate(ExponentialDistribution_t* ed) -{ - if (ed == NULL) - { - return NULL; - } - - return (UncertValue_t*)(ed->createRate()); -} - - -/* - * Unsets the value of the "rate" element of this ExponentialDistribution_t. - */ -LIBSBML_EXTERN -int -ExponentialDistribution_unsetRate(ExponentialDistribution_t * ed) -{ - return (ed != NULL) ? ed->unsetRate() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * ExponentialDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -ExponentialDistribution_hasRequiredAttributes(const ExponentialDistribution_t * - ed) -{ - return (ed != NULL) ? static_cast(ed->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * ExponentialDistribution_t object have been set. - */ -LIBSBML_EXTERN -int -ExponentialDistribution_hasRequiredElements(const ExponentialDistribution_t * - ed) -{ - return (ed != NULL) ? static_cast(ed->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ExponentialDistribution.cpp + * @brief Implementation of the ExponentialDistribution class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ExponentialDistribution using the given SBML Level, Version + * and “distrib” package version. + */ +ExponentialDistribution::ExponentialDistribution(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : ContinuousUnivariateDistribution(level, version, pkgVersion) + , mRate (NULL) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new ExponentialDistribution using the given DistribPkgNamespaces + * object. + */ +ExponentialDistribution::ExponentialDistribution(DistribPkgNamespaces + *distribns) + : ContinuousUnivariateDistribution(distribns) + , mRate (NULL) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for ExponentialDistribution. + */ +ExponentialDistribution::ExponentialDistribution(const ExponentialDistribution& + orig) + : ContinuousUnivariateDistribution( orig ) + , mRate ( NULL ) +{ + if (orig.mRate != NULL) + { + mRate = orig.mRate->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for ExponentialDistribution. + */ +ExponentialDistribution& +ExponentialDistribution::operator=(const ExponentialDistribution& rhs) +{ + if (&rhs != this) + { + ContinuousUnivariateDistribution::operator=(rhs); + delete mRate; + if (rhs.mRate != NULL) + { + mRate = rhs.mRate->clone(); + } + else + { + mRate = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ExponentialDistribution object. + */ +ExponentialDistribution* +ExponentialDistribution::clone() const +{ + return new ExponentialDistribution(*this); +} + + +/* + * Destructor for ExponentialDistribution. + */ +ExponentialDistribution::~ExponentialDistribution() +{ + delete mRate; + mRate = NULL; +} + + +/* + * Returns the value of the "rate" element of this ExponentialDistribution. + */ +const UncertValue* +ExponentialDistribution::getRate() const +{ + return mRate; +} + + +/* + * Returns the value of the "rate" element of this ExponentialDistribution. + */ +UncertValue* +ExponentialDistribution::getRate() +{ + return mRate; +} + + +/* + * Predicate returning @c true if this ExponentialDistribution's "rate" element + * is set. + */ +bool +ExponentialDistribution::isSetRate() const +{ + return (mRate != NULL); +} + + +/* + * Sets the value of the "rate" element of this ExponentialDistribution. + */ +int +ExponentialDistribution::setRate(const UncertValue* rate) +{ + if (mRate == rate) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (rate == NULL) + { + delete mRate; + mRate = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mRate; + mRate = (rate != NULL) ? rate->clone() : NULL; + if (mRate != NULL) + { + mRate->setElementName("rate"); + mRate->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new UncertValue object, adds it to this ExponentialDistribution + * object and returns the UncertValue object created. + */ +UncertValue* +ExponentialDistribution::createRate() +{ + if (mRate != NULL) + { + delete mRate; + } + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + mRate = new UncertValue(distribns); + + mRate->setElementName("rate"); + + delete distribns; + + connectToChild(); + + return mRate; +} + + +/* + * Unsets the value of the "rate" element of this ExponentialDistribution. + */ +int +ExponentialDistribution::unsetRate() +{ + delete mRate; + mRate = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this ExponentialDistribution object. + */ +const std::string& +ExponentialDistribution::getElementName() const +{ + static const string name = "exponentialDistribution"; + return name; +} + + +/* + * Returns the libSBML type code for this ExponentialDistribution object. + */ +int +ExponentialDistribution::getTypeCode() const +{ + return SBML_DISTRIB_EXPONENTIALDISTRIBUTION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * ExponentialDistribution object have been set. + */ +bool +ExponentialDistribution::hasRequiredAttributes() const +{ + bool allPresent = ContinuousUnivariateDistribution::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * ExponentialDistribution object have been set. + */ +bool +ExponentialDistribution::hasRequiredElements() const +{ + bool allPresent = ContinuousUnivariateDistribution::hasRequiredElements(); + + if (isSetRate() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ExponentialDistribution::writeElements(XMLOutputStream& stream) const +{ + ContinuousUnivariateDistribution::writeElements(stream); + + if (isSetRate() == true) + { + mRate->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ExponentialDistribution::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mRate != NULL) + { + mRate->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ExponentialDistribution::setSBMLDocument(SBMLDocument* d) +{ + ContinuousUnivariateDistribution::setSBMLDocument(d); + + if (mRate != NULL) + { + mRate->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +ExponentialDistribution::connectToChild() +{ + ContinuousUnivariateDistribution::connectToChild(); + + if (mRate != NULL) + { + mRate->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ExponentialDistribution::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + ContinuousUnivariateDistribution::enablePackageInternal(pkgURI, pkgPrefix, + flag); + + if (isSetRate()) + { + mRate->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +ExponentialDistribution::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + ContinuousUnivariateDistribution::updateSBMLNamespace(package, level, + version); + + if (mRate != NULL) + { + mRate->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = + ContinuousUnivariateDistribution::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ExponentialDistribution's attribute + * "attributeName" is set. + */ +bool +ExponentialDistribution::isSetAttribute(const std::string& attributeName) const +{ + bool value = ContinuousUnivariateDistribution::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::setAttribute(const std::string& attributeName, + int value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = + ContinuousUnivariateDistribution::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * ExponentialDistribution. + */ +int +ExponentialDistribution::unsetAttribute(const std::string& attributeName) +{ + int value = ContinuousUnivariateDistribution::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this + * ExponentialDistribution. + */ +SBase* +ExponentialDistribution::createChildObject(const std::string& elementName) +{ + ContinuousUnivariateDistribution* obj = NULL; + + if (elementName == "rate") + { + return createRate(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this ExponentialDistribution. + */ +int +ExponentialDistribution::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "rate" && element->getTypeCode() == + SBML_DISTRIB_UNCERTVALUE) + { + return setRate((const UncertValue*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * ExponentialDistribution. + */ +SBase* +ExponentialDistribution::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "rate") + { + UncertValue * obj = mRate; + mRate = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this ExponentialDistribution. + */ +unsigned int +ExponentialDistribution::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "rate") + { + if (isSetRate()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this ExponentialDistribution. + */ +SBase* +ExponentialDistribution::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "rate") + { + return getRate(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +ExponentialDistribution::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mRate != NULL) + { + if (mRate->getId() == id) + { + return mRate; + } + + obj = mRate->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +ExponentialDistribution::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mRate != NULL) + { + if (mRate->getMetaId() == metaid) + { + return mRate; + } + + obj = mRate->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +ExponentialDistribution::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mRate, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +ExponentialDistribution::createObject(XMLInputStream& stream) +{ + SBase* obj = ContinuousUnivariateDistribution::createObject(stream); + + const std::string& name = stream.peek().getName(); + + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + + if (name == "rate") + { + if (getErrorLog() && isSetRate()) + { + getErrorLog()->logPackageError("distrib", + DistribExponentialDistributionAllowedElements, getPackageVersion(), + getLevel(), getVersion(), "", getLine(), getColumn()); + } + + delete mRate; + mRate = new UncertValue(distribns); + mRate->setElementName(name); + obj = mRate; + } + + delete distribns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +ExponentialDistribution::addExpectedAttributes(ExpectedAttributes& attributes) +{ + ContinuousUnivariateDistribution::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ExponentialDistribution::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + ContinuousUnivariateDistribution::readAttributes(attributes, + expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribExponentialDistributionAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribExponentialDistributionAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ExponentialDistribution::writeAttributes(XMLOutputStream& stream) const +{ + ContinuousUnivariateDistribution::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ExponentialDistribution_t using the given SBML Level, Version + * and “distrib” package version. + */ +LIBSBML_EXTERN +ExponentialDistribution_t * +ExponentialDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ExponentialDistribution(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ExponentialDistribution_t object. + */ +LIBSBML_EXTERN +ExponentialDistribution_t* +ExponentialDistribution_clone(const ExponentialDistribution_t* ed) +{ + if (ed != NULL) + { + return static_cast(ed->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ExponentialDistribution_t object. + */ +LIBSBML_EXTERN +void +ExponentialDistribution_free(ExponentialDistribution_t* ed) +{ + if (ed != NULL) + { + delete ed; + } +} + + +/* + * Returns the value of the "rate" element of this ExponentialDistribution_t. + */ +LIBSBML_EXTERN +const UncertValue_t* +ExponentialDistribution_getRate(const ExponentialDistribution_t * ed) +{ + if (ed == NULL) + { + return NULL; + } + + return (UncertValue_t*)(ed->getRate()); +} + + +/* + * Predicate returning @c 1 (true) if this ExponentialDistribution_t's "rate" + * element is set. + */ +LIBSBML_EXTERN +int +ExponentialDistribution_isSetRate(const ExponentialDistribution_t * ed) +{ + return (ed != NULL) ? static_cast(ed->isSetRate()) : 0; +} + + +/* + * Sets the value of the "rate" element of this ExponentialDistribution_t. + */ +LIBSBML_EXTERN +int +ExponentialDistribution_setRate(ExponentialDistribution_t * ed, + const UncertValue_t* rate) +{ + return (ed != NULL) ? ed->setRate(rate) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new UncertValue_t object, adds it to this + * ExponentialDistribution_t object and returns the UncertValue_t object + * created. + */ +LIBSBML_EXTERN +UncertValue_t* +ExponentialDistribution_createRate(ExponentialDistribution_t* ed) +{ + if (ed == NULL) + { + return NULL; + } + + return (UncertValue_t*)(ed->createRate()); +} + + +/* + * Unsets the value of the "rate" element of this ExponentialDistribution_t. + */ +LIBSBML_EXTERN +int +ExponentialDistribution_unsetRate(ExponentialDistribution_t * ed) +{ + return (ed != NULL) ? ed->unsetRate() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * ExponentialDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +ExponentialDistribution_hasRequiredAttributes(const ExponentialDistribution_t * + ed) +{ + return (ed != NULL) ? static_cast(ed->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * ExponentialDistribution_t object have been set. + */ +LIBSBML_EXTERN +int +ExponentialDistribution_hasRequiredElements(const ExponentialDistribution_t * + ed) +{ + return (ed != NULL) ? static_cast(ed->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ExponentialDistribution.h b/generator/tests/test_cpp_code/test-code/ExponentialDistribution.h index 1b05a6e2..8b3b420b 100644 --- a/generator/tests/test_cpp_code/test-code/ExponentialDistribution.h +++ b/generator/tests/test_cpp_code/test-code/ExponentialDistribution.h @@ -1,975 +1,975 @@ -/** - * @file ExponentialDistribution.h - * @brief Definition of the ExponentialDistribution class. - * @author SBMLTeam - * - * - * - * @class ExponentialDistribution - * @sbmlbrief{distrib} TODO:Definition of the ExponentialDistribution class. - */ - - -#ifndef ExponentialDistribution_H__ -#define ExponentialDistribution_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN ExponentialDistribution : public - ContinuousUnivariateDistribution -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - UncertValue* mRate; - - /** @endcond */ - -public: - - /** - * Creates a new ExponentialDistribution using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ExponentialDistribution. - * - * @param version an unsigned int, the SBML Version to assign to this - * ExponentialDistribution. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this ExponentialDistribution. - * - * @copydetails doc_note_setting_lv_pkg - */ - ExponentialDistribution( - unsigned int level = - DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ExponentialDistribution using the given DistribPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ExponentialDistribution(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for ExponentialDistribution. - * - * @param orig the ExponentialDistribution instance to copy. - */ - ExponentialDistribution(const ExponentialDistribution& orig); - - - /** - * Assignment operator for ExponentialDistribution. - * - * @param rhs the ExponentialDistribution object whose values are to be used - * as the basis of the assignment. - */ - ExponentialDistribution& operator=(const ExponentialDistribution& rhs); - - - /** - * Creates and returns a deep copy of this ExponentialDistribution object. - * - * @return a (deep) copy of this ExponentialDistribution object. - */ - virtual ExponentialDistribution* clone() const; - - - /** - * Destructor for ExponentialDistribution. - */ - virtual ~ExponentialDistribution(); - - - /** - * Returns the value of the "rate" element of this ExponentialDistribution. - * - * @return the value of the "rate" element of this ExponentialDistribution as - * a UncertValue*. - */ - const UncertValue* getRate() const; - - - /** - * Returns the value of the "rate" element of this ExponentialDistribution. - * - * @return the value of the "rate" element of this ExponentialDistribution as - * a UncertValue*. - */ - UncertValue* getRate(); - - - /** - * Predicate returning @c true if this ExponentialDistribution's "rate" - * element is set. - * - * @return @c true if this ExponentialDistribution's "rate" element has been - * set, otherwise @c false is returned. - */ - bool isSetRate() const; - - - /** - * Sets the value of the "rate" element of this ExponentialDistribution. - * - * @param rate UncertValue* value of the "rate" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setRate(const UncertValue* rate); - - - /** - * Creates a new UncertValue object, adds it to this ExponentialDistribution - * object and returns the UncertValue object created. - * - * @return a new UncertValue object instance. - */ - UncertValue* createRate(); - - - /** - * Unsets the value of the "rate" element of this ExponentialDistribution. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetRate(); - - - /** - * Returns the XML element name of this ExponentialDistribution object. - * - * For ExponentialDistribution, the XML element name is always - * @c "exponentialDistribution". - * - * @return the name of this element, i.e. @c "exponentialDistribution". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ExponentialDistribution object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_EXPONENTIALDISTRIBUTION, - * SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * ExponentialDistribution object have been set. - * - * @return @c true to indicate that all the required attributes of this - * ExponentialDistribution have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * ExponentialDistribution object have been set. - * - * @return @c true to indicate that all the required elements of this - * ExponentialDistribution have been set, otherwise @c false is returned. - * - * - * @note The required elements for the ExponentialDistribution object are: - * @li "rate" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ExponentialDistribution's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ExponentialDistribution's attribute - * "attributeName" has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * ExponentialDistribution. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this - * ExponentialDistribution. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this ExponentialDistribution. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * ExponentialDistribution. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this ExponentialDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this ExponentialDistribution. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ExponentialDistribution_t using the given SBML Level, Version - * and “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ExponentialDistribution_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ExponentialDistribution_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this ExponentialDistribution_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -ExponentialDistribution_t * -ExponentialDistribution_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ExponentialDistribution_t object. - * - * @param ed the ExponentialDistribution_t structure. - * - * @return a (deep) copy of this ExponentialDistribution_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -ExponentialDistribution_t* -ExponentialDistribution_clone(const ExponentialDistribution_t* ed); - - -/** - * Frees this ExponentialDistribution_t object. - * - * @param ed the ExponentialDistribution_t structure. - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -void -ExponentialDistribution_free(ExponentialDistribution_t* ed); - - -/** - * Returns the value of the "rate" element of this ExponentialDistribution_t. - * - * @param ed the ExponentialDistribution_t structure whose rate is sought. - * - * @return the value of the "rate" element of this ExponentialDistribution_t as - * a UncertValue*. - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -const UncertValue_t* -ExponentialDistribution_getRate(const ExponentialDistribution_t * ed); - - -/** - * Predicate returning @c 1 (true) if this ExponentialDistribution_t's "rate" - * element is set. - * - * @param ed the ExponentialDistribution_t structure. - * - * @return @c 1 (true) if this ExponentialDistribution_t's "rate" element has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -int -ExponentialDistribution_isSetRate(const ExponentialDistribution_t * ed); - - -/** - * Sets the value of the "rate" element of this ExponentialDistribution_t. - * - * @param ed the ExponentialDistribution_t structure. - * - * @param rate UncertValue_t* value of the "rate" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -int -ExponentialDistribution_setRate(ExponentialDistribution_t * ed, - const UncertValue_t* rate); - - -/** - * Creates a new UncertValue_t object, adds it to this - * ExponentialDistribution_t object and returns the UncertValue_t object - * created. - * - * @param ed the ExponentialDistribution_t structure to which the UncertValue_t - * should be added. - * - * @return a new UncertValue_t object instance. - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -UncertValue_t* -ExponentialDistribution_createRate(ExponentialDistribution_t* ed); - - -/** - * Unsets the value of the "rate" element of this ExponentialDistribution_t. - * - * @param ed the ExponentialDistribution_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -int -ExponentialDistribution_unsetRate(ExponentialDistribution_t * ed); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * ExponentialDistribution_t object have been set. - * - * @param ed the ExponentialDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * ExponentialDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -int -ExponentialDistribution_hasRequiredAttributes(const ExponentialDistribution_t * - ed); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * ExponentialDistribution_t object have been set. - * - * @param ed the ExponentialDistribution_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * ExponentialDistribution_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the ExponentialDistribution_t object are: - * @li "rate" - * - * @memberof ExponentialDistribution_t - */ -LIBSBML_EXTERN -int -ExponentialDistribution_hasRequiredElements(const ExponentialDistribution_t * - ed); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ExponentialDistribution_H__ */ - - +/** + * @file ExponentialDistribution.h + * @brief Definition of the ExponentialDistribution class. + * @author SBMLTeam + * + * + * + * @class ExponentialDistribution + * @sbmlbrief{distrib} TODO:Definition of the ExponentialDistribution class. + */ + + +#ifndef ExponentialDistribution_H__ +#define ExponentialDistribution_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN ExponentialDistribution : public + ContinuousUnivariateDistribution +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + UncertValue* mRate; + + /** @endcond */ + +public: + + /** + * Creates a new ExponentialDistribution using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ExponentialDistribution. + * + * @param version an unsigned int, the SBML Version to assign to this + * ExponentialDistribution. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this ExponentialDistribution. + * + * @copydetails doc_note_setting_lv_pkg + */ + ExponentialDistribution( + unsigned int level = + DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ExponentialDistribution using the given DistribPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ExponentialDistribution(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for ExponentialDistribution. + * + * @param orig the ExponentialDistribution instance to copy. + */ + ExponentialDistribution(const ExponentialDistribution& orig); + + + /** + * Assignment operator for ExponentialDistribution. + * + * @param rhs the ExponentialDistribution object whose values are to be used + * as the basis of the assignment. + */ + ExponentialDistribution& operator=(const ExponentialDistribution& rhs); + + + /** + * Creates and returns a deep copy of this ExponentialDistribution object. + * + * @return a (deep) copy of this ExponentialDistribution object. + */ + virtual ExponentialDistribution* clone() const; + + + /** + * Destructor for ExponentialDistribution. + */ + virtual ~ExponentialDistribution(); + + + /** + * Returns the value of the "rate" element of this ExponentialDistribution. + * + * @return the value of the "rate" element of this ExponentialDistribution as + * a UncertValue*. + */ + const UncertValue* getRate() const; + + + /** + * Returns the value of the "rate" element of this ExponentialDistribution. + * + * @return the value of the "rate" element of this ExponentialDistribution as + * a UncertValue*. + */ + UncertValue* getRate(); + + + /** + * Predicate returning @c true if this ExponentialDistribution's "rate" + * element is set. + * + * @return @c true if this ExponentialDistribution's "rate" element has been + * set, otherwise @c false is returned. + */ + bool isSetRate() const; + + + /** + * Sets the value of the "rate" element of this ExponentialDistribution. + * + * @param rate UncertValue* value of the "rate" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setRate(const UncertValue* rate); + + + /** + * Creates a new UncertValue object, adds it to this ExponentialDistribution + * object and returns the UncertValue object created. + * + * @return a new UncertValue object instance. + */ + UncertValue* createRate(); + + + /** + * Unsets the value of the "rate" element of this ExponentialDistribution. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetRate(); + + + /** + * Returns the XML element name of this ExponentialDistribution object. + * + * For ExponentialDistribution, the XML element name is always + * @c "exponentialDistribution". + * + * @return the name of this element, i.e. @c "exponentialDistribution". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ExponentialDistribution object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_EXPONENTIALDISTRIBUTION, + * SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * ExponentialDistribution object have been set. + * + * @return @c true to indicate that all the required attributes of this + * ExponentialDistribution have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * ExponentialDistribution object have been set. + * + * @return @c true to indicate that all the required elements of this + * ExponentialDistribution have been set, otherwise @c false is returned. + * + * + * @note The required elements for the ExponentialDistribution object are: + * @li "rate" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ExponentialDistribution's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ExponentialDistribution's attribute + * "attributeName" has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * ExponentialDistribution. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this + * ExponentialDistribution. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this ExponentialDistribution. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * ExponentialDistribution. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this ExponentialDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this ExponentialDistribution. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ExponentialDistribution_t using the given SBML Level, Version + * and “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ExponentialDistribution_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ExponentialDistribution_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this ExponentialDistribution_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +ExponentialDistribution_t * +ExponentialDistribution_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ExponentialDistribution_t object. + * + * @param ed the ExponentialDistribution_t structure. + * + * @return a (deep) copy of this ExponentialDistribution_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +ExponentialDistribution_t* +ExponentialDistribution_clone(const ExponentialDistribution_t* ed); + + +/** + * Frees this ExponentialDistribution_t object. + * + * @param ed the ExponentialDistribution_t structure. + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +void +ExponentialDistribution_free(ExponentialDistribution_t* ed); + + +/** + * Returns the value of the "rate" element of this ExponentialDistribution_t. + * + * @param ed the ExponentialDistribution_t structure whose rate is sought. + * + * @return the value of the "rate" element of this ExponentialDistribution_t as + * a UncertValue*. + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +const UncertValue_t* +ExponentialDistribution_getRate(const ExponentialDistribution_t * ed); + + +/** + * Predicate returning @c 1 (true) if this ExponentialDistribution_t's "rate" + * element is set. + * + * @param ed the ExponentialDistribution_t structure. + * + * @return @c 1 (true) if this ExponentialDistribution_t's "rate" element has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +int +ExponentialDistribution_isSetRate(const ExponentialDistribution_t * ed); + + +/** + * Sets the value of the "rate" element of this ExponentialDistribution_t. + * + * @param ed the ExponentialDistribution_t structure. + * + * @param rate UncertValue_t* value of the "rate" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +int +ExponentialDistribution_setRate(ExponentialDistribution_t * ed, + const UncertValue_t* rate); + + +/** + * Creates a new UncertValue_t object, adds it to this + * ExponentialDistribution_t object and returns the UncertValue_t object + * created. + * + * @param ed the ExponentialDistribution_t structure to which the UncertValue_t + * should be added. + * + * @return a new UncertValue_t object instance. + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +UncertValue_t* +ExponentialDistribution_createRate(ExponentialDistribution_t* ed); + + +/** + * Unsets the value of the "rate" element of this ExponentialDistribution_t. + * + * @param ed the ExponentialDistribution_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +int +ExponentialDistribution_unsetRate(ExponentialDistribution_t * ed); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * ExponentialDistribution_t object have been set. + * + * @param ed the ExponentialDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * ExponentialDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +int +ExponentialDistribution_hasRequiredAttributes(const ExponentialDistribution_t * + ed); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * ExponentialDistribution_t object have been set. + * + * @param ed the ExponentialDistribution_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * ExponentialDistribution_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the ExponentialDistribution_t object are: + * @li "rate" + * + * @memberof ExponentialDistribution_t + */ +LIBSBML_EXTERN +int +ExponentialDistribution_hasRequiredElements(const ExponentialDistribution_t * + ed); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ExponentialDistribution_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/ExternalParameter.cpp b/generator/tests/test_cpp_code/test-code/ExternalParameter.cpp index a250ff41..5d48f745 100644 --- a/generator/tests/test_cpp_code/test-code/ExternalParameter.cpp +++ b/generator/tests/test_cpp_code/test-code/ExternalParameter.cpp @@ -1,1303 +1,1303 @@ -/** - * @file ExternalParameter.cpp - * @brief Implementation of the ExternalParameter class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new ExternalParameter using the given SBML Level, Version and - * “distrib” package version. - */ -ExternalParameter::ExternalParameter(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : UncertValue(level, version, pkgVersion) - , mDefinitionURL ("") - , mExternalParameters (new ListOfExternalParameters (level, version, - pkgVersion)) -{ - setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new ExternalParameter using the given DistribPkgNamespaces object. - */ -ExternalParameter::ExternalParameter(DistribPkgNamespaces *distribns) - : UncertValue(distribns) - , mDefinitionURL ("") - , mExternalParameters (new ListOfExternalParameters (distribns)) -{ - setElementNamespace(distribns->getURI()); - connectToChild(); - loadPlugins(distribns); -} - - -/* - * Copy constructor for ExternalParameter. - */ -ExternalParameter::ExternalParameter(const ExternalParameter& orig) - : UncertValue( orig ) - , mDefinitionURL ( orig.mDefinitionURL ) - , mExternalParameters ( NULL ) -{ - if (orig.mExternalParameters != NULL) - { - mExternalParameters = orig.mExternalParameters->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for ExternalParameter. - */ -ExternalParameter& -ExternalParameter::operator=(const ExternalParameter& rhs) -{ - if (&rhs != this) - { - UncertValue::operator=(rhs); - mDefinitionURL = rhs.mDefinitionURL; - delete mExternalParameters; - if (rhs.mExternalParameters != NULL) - { - mExternalParameters = rhs.mExternalParameters->clone(); - } - else - { - mExternalParameters = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this ExternalParameter object. - */ -ExternalParameter* -ExternalParameter::clone() const -{ - return new ExternalParameter(*this); -} - - -/* - * Destructor for ExternalParameter. - */ -ExternalParameter::~ExternalParameter() -{ - delete mExternalParameters; - mExternalParameters = NULL; -} - - -/* - * Returns the value of the "definitionURL" attribute of this - * ExternalParameter. - */ -const std::string& -ExternalParameter::getDefinitionURL() const -{ - return mDefinitionURL; -} - - -/* - * Predicate returning @c true if this ExternalParameter's "definitionURL" - * attribute is set. - */ -bool -ExternalParameter::isSetDefinitionURL() const -{ - return (mDefinitionURL.empty() == false); -} - - -/* - * Sets the value of the "definitionURL" attribute of this ExternalParameter. - */ -int -ExternalParameter::setDefinitionURL(const std::string& definitionURL) -{ - mDefinitionURL = definitionURL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "definitionURL" attribute of this ExternalParameter. - */ -int -ExternalParameter::unsetDefinitionURL() -{ - mDefinitionURL.erase(); - - if (mDefinitionURL.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the ListOfExternalParameters * from this ExternalParameter. - */ -const ListOfExternalParameters * -ExternalParameter::getListOfExternalParameters() const -{ - return mExternalParameters; -} - - -/* - * Returns the ListOfExternalParameters * from this ExternalParameter. - */ -ListOfExternalParameters * -ExternalParameter::getListOfExternalParameters() -{ - return mExternalParameters; -} - - -/* - * Get an ExternalParameter from the ExternalParameter. - */ -ExternalParameter* -ExternalParameter::getExternalParameter(unsigned int n) -{ - return mExternalParameters->get(n); -} - - -/* - * Get an ExternalParameter from the ExternalParameter. - */ -const ExternalParameter* -ExternalParameter::getExternalParameter(unsigned int n) const -{ - return mExternalParameters->get(n); -} - - -/* - * Adds a copy of the given ExternalParameter to this ExternalParameter. - */ -int -ExternalParameter::addExternalParameter(const ExternalParameter* ep1) -{ - if (ep1 == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (ep1->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != ep1->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != ep1->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(ep1)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else - { - return mExternalParameters->append(ep1); - } -} - - -/* - * Get the number of ExternalParameter objects in this ExternalParameter. - */ -unsigned int -ExternalParameter::getNumExternalParameters() const -{ - return mExternalParameters->size(); -} - - -/* - * Creates a new ExternalParameter object, adds it to this ExternalParameter - * object and returns the ExternalParameter object created. - */ -ExternalParameter* -ExternalParameter::createExternalParameter() -{ - ExternalParameter* ep1 = NULL; - - try - { - DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); - ep1 = new ExternalParameter(distribns); - delete distribns; - } - catch (...) - { - } - - if (ep1 != NULL) - { - mExternalParameters->appendAndOwn(ep1); - } - - return ep1; -} - - -/* - * Removes the nth ExternalParameter from this ExternalParameter and returns a - * pointer to it. - */ -ExternalParameter* -ExternalParameter::removeExternalParameter(unsigned int n) -{ - return mExternalParameters->remove(n); -} - - -/* - * Returns the XML element name of this ExternalParameter object. - */ -const std::string& -ExternalParameter::getElementName() const -{ - static const string name = "externalParameter"; - return name; -} - - -/* - * Returns the libSBML type code for this ExternalParameter object. - */ -int -ExternalParameter::getTypeCode() const -{ - return SBML_DISTRIB_EXTERNALPARAMETER; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * ExternalParameter object have been set. - */ -bool -ExternalParameter::hasRequiredAttributes() const -{ - bool allPresent = UncertValue::hasRequiredAttributes(); - - if (isSetDefinitionURL() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * ExternalParameter object have been set. - */ -bool -ExternalParameter::hasRequiredElements() const -{ - bool allPresent = UncertValue::hasRequiredElements(); - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -ExternalParameter::writeElements(XMLOutputStream& stream) const -{ - UncertValue::writeElements(stream); - - if (getNumExternalParameters() > 0) - { - mExternalParameters->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -ExternalParameter::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mExternalParameters->accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -ExternalParameter::setSBMLDocument(SBMLDocument* d) -{ - UncertValue::setSBMLDocument(d); - - mExternalParameters->setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -ExternalParameter::connectToChild() -{ - UncertValue::connectToChild(); - - mExternalParameters->connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -ExternalParameter::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - UncertValue::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mExternalParameters->enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -ExternalParameter::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - UncertValue::updateSBMLNamespace(package, level, version); - - mExternalParameters->updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = UncertValue::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = UncertValue::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = UncertValue::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = UncertValue::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = UncertValue::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "definitionURL") - { - value = getDefinitionURL(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this ExternalParameter's attribute - * "attributeName" is set. - */ -bool -ExternalParameter::isSetAttribute(const std::string& attributeName) const -{ - bool value = UncertValue::isSetAttribute(attributeName); - - if (attributeName == "definitionURL") - { - value = isSetDefinitionURL(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = UncertValue::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::setAttribute(const std::string& attributeName, int value) -{ - int return_value = UncertValue::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = UncertValue::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = UncertValue::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = UncertValue::setAttribute(attributeName, value); - - if (attributeName == "definitionURL") - { - return_value = setDefinitionURL(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this ExternalParameter. - */ -int -ExternalParameter::unsetAttribute(const std::string& attributeName) -{ - int value = UncertValue::unsetAttribute(attributeName); - - if (attributeName == "definitionURL") - { - value = unsetDefinitionURL(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this ExternalParameter. - */ -SBase* -ExternalParameter::createChildObject(const std::string& elementName) -{ - UncertValue* obj = NULL; - - if (elementName == "externalParameter") - { - return createExternalParameter(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this ExternalParameter. - */ -int -ExternalParameter::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "externalParameter" && element->getTypeCode() == - SBML_DISTRIB_EXTERNALPARAMETER) - { - return addExternalParameter((const ExternalParameter*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * ExternalParameter. - */ -SBase* -ExternalParameter::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "externalParameter") - { - for (unsigned int i = 0; i < getNumExternalParameters(); i++) - { - if (getExternalParameter(i)->getId() == id) - { - return removeExternalParameter(i); - } - } - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this ExternalParameter. - */ -unsigned int -ExternalParameter::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "externalParameter") - { - return getNumExternalParameters(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this ExternalParameter. - */ -SBase* -ExternalParameter::getObject(const std::string& elementName, - unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "externalParameter") - { - return getExternalParameter(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -ExternalParameter::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mExternalParameters->getId() == id) - { - return mExternalParameters; - } - - obj = mExternalParameters->getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -ExternalParameter::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mExternalParameters->getMetaId() == metaid) - { - return mExternalParameters; - } - - obj = mExternalParameters->getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -ExternalParameter::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_POINTER(ret, sublist, mExternalParameters, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -ExternalParameter::createObject(XMLInputStream& stream) -{ - SBase* obj = UncertValue::createObject(stream); - - const std::string& name = stream.peek().getName(); - - if (name == "listOfExternalParameters") - { - if (getErrorLog() && mExternalParameters->size() != 0) - { - getErrorLog()->logPackageError("distrib", - DistribExternalParameterAllowedElements, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - obj = mExternalParameters; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -ExternalParameter::addExpectedAttributes(ExpectedAttributes& attributes) -{ - UncertValue::addExpectedAttributes(attributes); - - attributes.add("definitionURL"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -ExternalParameter::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribExternalDistributionLOExternalParametersAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", DistribExternalDistributionLOExternalParametersAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - UncertValue::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("distrib", - DistribExternalParameterAllowedAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("distrib", - DistribExternalParameterAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - // - // definitionURL string (use = "required" ) - // - - assigned = attributes.readInto("definitionURL", mDefinitionURL); - - if (assigned == true) - { - if (mDefinitionURL.empty() == true) - { - logEmptyString(mDefinitionURL, level, version, ""); - } - } - else - { - if (log) - { - std::string message = "Distrib attribute 'definitionURL' is missing from " - "the element."; - log->logPackageError("distrib", - DistribExternalParameterAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -ExternalParameter::writeAttributes(XMLOutputStream& stream) const -{ - UncertValue::writeAttributes(stream); - - if (isSetDefinitionURL() == true) - { - stream.writeAttribute("definitionURL", getPrefix(), mDefinitionURL); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new ExternalParameter_t using the given SBML Level, Version and - * “distrib” package version. - */ -LIBSBML_EXTERN -ExternalParameter_t * -ExternalParameter_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ExternalParameter(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this ExternalParameter_t object. - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_clone(const ExternalParameter_t* ep) -{ - if (ep != NULL) - { - return static_cast(ep->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this ExternalParameter_t object. - */ -LIBSBML_EXTERN -void -ExternalParameter_free(ExternalParameter_t* ep) -{ - if (ep != NULL) - { - delete ep; - } -} - - -/* - * Returns the value of the "definitionURL" attribute of this - * ExternalParameter_t. - */ -LIBSBML_EXTERN -char * -ExternalParameter_getDefinitionURL(const ExternalParameter_t * ep) -{ - if (ep == NULL) - { - return NULL; - } - - return ep->getDefinitionURL().empty() ? NULL : - safe_strdup(ep->getDefinitionURL().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this ExternalParameter_t's - * "definitionURL" attribute is set. - */ -LIBSBML_EXTERN -int -ExternalParameter_isSetDefinitionURL(const ExternalParameter_t * ep) -{ - return (ep != NULL) ? static_cast(ep->isSetDefinitionURL()) : 0; -} - - -/* - * Sets the value of the "definitionURL" attribute of this ExternalParameter_t. - */ -LIBSBML_EXTERN -int -ExternalParameter_setDefinitionURL(ExternalParameter_t * ep, - const char * definitionURL) -{ - return (ep != NULL) ? ep->setDefinitionURL(definitionURL) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "definitionURL" attribute of this - * ExternalParameter_t. - */ -LIBSBML_EXTERN -int -ExternalParameter_unsetDefinitionURL(ExternalParameter_t * ep) -{ - return (ep != NULL) ? ep->unsetDefinitionURL() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing ExternalParameter_t objects from this - * ExternalParameter_t. - */ -LIBSBML_EXTERN -ListOf_t* -ExternalParameter_getListOfExternalParameters(ExternalParameter_t* ep) -{ - return (ep != NULL) ? ep->getListOfExternalParameters() : NULL; -} - - -/* - * Get an ExternalParameter_t from the ExternalParameter_t. - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_getExternalParameter(ExternalParameter_t* ep, - unsigned int n) -{ - return (ep != NULL) ? ep->getExternalParameter(n) : NULL; -} - - -/* - * Adds a copy of the given ExternalParameter_t to this ExternalParameter_t. - */ -LIBSBML_EXTERN -int -ExternalParameter_addExternalParameter(ExternalParameter_t* ep, - const ExternalParameter_t* ep1) -{ - return (ep != NULL) ? ep->addExternalParameter(ep1) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of ExternalParameter_t objects in this ExternalParameter_t. - */ -LIBSBML_EXTERN -unsigned int -ExternalParameter_getNumExternalParameters(ExternalParameter_t* ep) -{ - return (ep != NULL) ? ep->getNumExternalParameters() : SBML_INT_MAX; -} - - -/* - * Creates a new ExternalParameter_t object, adds it to this - * ExternalParameter_t object and returns the ExternalParameter_t object - * created. - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_createExternalParameter(ExternalParameter_t* ep) -{ - return (ep != NULL) ? ep->createExternalParameter() : NULL; -} - - -/* - * Removes the nth ExternalParameter_t from this ExternalParameter_t and - * returns a pointer to it. - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_removeExternalParameter(ExternalParameter_t* ep, - unsigned int n) -{ - return (ep != NULL) ? ep->removeExternalParameter(n) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * ExternalParameter_t object have been set. - */ -LIBSBML_EXTERN -int -ExternalParameter_hasRequiredAttributes(const ExternalParameter_t * ep) -{ - return (ep != NULL) ? static_cast(ep->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * ExternalParameter_t object have been set. - */ -LIBSBML_EXTERN -int -ExternalParameter_hasRequiredElements(const ExternalParameter_t * ep) -{ - return (ep != NULL) ? static_cast(ep->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file ExternalParameter.cpp + * @brief Implementation of the ExternalParameter class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new ExternalParameter using the given SBML Level, Version and + * “distrib” package version. + */ +ExternalParameter::ExternalParameter(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : UncertValue(level, version, pkgVersion) + , mDefinitionURL ("") + , mExternalParameters (new ListOfExternalParameters (level, version, + pkgVersion)) +{ + setSBMLNamespacesAndOwn(new DistribPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new ExternalParameter using the given DistribPkgNamespaces object. + */ +ExternalParameter::ExternalParameter(DistribPkgNamespaces *distribns) + : UncertValue(distribns) + , mDefinitionURL ("") + , mExternalParameters (new ListOfExternalParameters (distribns)) +{ + setElementNamespace(distribns->getURI()); + connectToChild(); + loadPlugins(distribns); +} + + +/* + * Copy constructor for ExternalParameter. + */ +ExternalParameter::ExternalParameter(const ExternalParameter& orig) + : UncertValue( orig ) + , mDefinitionURL ( orig.mDefinitionURL ) + , mExternalParameters ( NULL ) +{ + if (orig.mExternalParameters != NULL) + { + mExternalParameters = orig.mExternalParameters->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for ExternalParameter. + */ +ExternalParameter& +ExternalParameter::operator=(const ExternalParameter& rhs) +{ + if (&rhs != this) + { + UncertValue::operator=(rhs); + mDefinitionURL = rhs.mDefinitionURL; + delete mExternalParameters; + if (rhs.mExternalParameters != NULL) + { + mExternalParameters = rhs.mExternalParameters->clone(); + } + else + { + mExternalParameters = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this ExternalParameter object. + */ +ExternalParameter* +ExternalParameter::clone() const +{ + return new ExternalParameter(*this); +} + + +/* + * Destructor for ExternalParameter. + */ +ExternalParameter::~ExternalParameter() +{ + delete mExternalParameters; + mExternalParameters = NULL; +} + + +/* + * Returns the value of the "definitionURL" attribute of this + * ExternalParameter. + */ +const std::string& +ExternalParameter::getDefinitionURL() const +{ + return mDefinitionURL; +} + + +/* + * Predicate returning @c true if this ExternalParameter's "definitionURL" + * attribute is set. + */ +bool +ExternalParameter::isSetDefinitionURL() const +{ + return (mDefinitionURL.empty() == false); +} + + +/* + * Sets the value of the "definitionURL" attribute of this ExternalParameter. + */ +int +ExternalParameter::setDefinitionURL(const std::string& definitionURL) +{ + mDefinitionURL = definitionURL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "definitionURL" attribute of this ExternalParameter. + */ +int +ExternalParameter::unsetDefinitionURL() +{ + mDefinitionURL.erase(); + + if (mDefinitionURL.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the ListOfExternalParameters * from this ExternalParameter. + */ +const ListOfExternalParameters * +ExternalParameter::getListOfExternalParameters() const +{ + return mExternalParameters; +} + + +/* + * Returns the ListOfExternalParameters * from this ExternalParameter. + */ +ListOfExternalParameters * +ExternalParameter::getListOfExternalParameters() +{ + return mExternalParameters; +} + + +/* + * Get an ExternalParameter from the ExternalParameter. + */ +ExternalParameter* +ExternalParameter::getExternalParameter(unsigned int n) +{ + return mExternalParameters->get(n); +} + + +/* + * Get an ExternalParameter from the ExternalParameter. + */ +const ExternalParameter* +ExternalParameter::getExternalParameter(unsigned int n) const +{ + return mExternalParameters->get(n); +} + + +/* + * Adds a copy of the given ExternalParameter to this ExternalParameter. + */ +int +ExternalParameter::addExternalParameter(const ExternalParameter* ep1) +{ + if (ep1 == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (ep1->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != ep1->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != ep1->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(ep1)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else + { + return mExternalParameters->append(ep1); + } +} + + +/* + * Get the number of ExternalParameter objects in this ExternalParameter. + */ +unsigned int +ExternalParameter::getNumExternalParameters() const +{ + return mExternalParameters->size(); +} + + +/* + * Creates a new ExternalParameter object, adds it to this ExternalParameter + * object and returns the ExternalParameter object created. + */ +ExternalParameter* +ExternalParameter::createExternalParameter() +{ + ExternalParameter* ep1 = NULL; + + try + { + DISTRIB_CREATE_NS(distribns, getSBMLNamespaces()); + ep1 = new ExternalParameter(distribns); + delete distribns; + } + catch (...) + { + } + + if (ep1 != NULL) + { + mExternalParameters->appendAndOwn(ep1); + } + + return ep1; +} + + +/* + * Removes the nth ExternalParameter from this ExternalParameter and returns a + * pointer to it. + */ +ExternalParameter* +ExternalParameter::removeExternalParameter(unsigned int n) +{ + return mExternalParameters->remove(n); +} + + +/* + * Returns the XML element name of this ExternalParameter object. + */ +const std::string& +ExternalParameter::getElementName() const +{ + static const string name = "externalParameter"; + return name; +} + + +/* + * Returns the libSBML type code for this ExternalParameter object. + */ +int +ExternalParameter::getTypeCode() const +{ + return SBML_DISTRIB_EXTERNALPARAMETER; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * ExternalParameter object have been set. + */ +bool +ExternalParameter::hasRequiredAttributes() const +{ + bool allPresent = UncertValue::hasRequiredAttributes(); + + if (isSetDefinitionURL() == false) + { + allPresent = false; + } + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * ExternalParameter object have been set. + */ +bool +ExternalParameter::hasRequiredElements() const +{ + bool allPresent = UncertValue::hasRequiredElements(); + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +ExternalParameter::writeElements(XMLOutputStream& stream) const +{ + UncertValue::writeElements(stream); + + if (getNumExternalParameters() > 0) + { + mExternalParameters->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +ExternalParameter::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mExternalParameters->accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +ExternalParameter::setSBMLDocument(SBMLDocument* d) +{ + UncertValue::setSBMLDocument(d); + + mExternalParameters->setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +ExternalParameter::connectToChild() +{ + UncertValue::connectToChild(); + + mExternalParameters->connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +ExternalParameter::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + UncertValue::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mExternalParameters->enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +ExternalParameter::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + UncertValue::updateSBMLNamespace(package, level, version); + + mExternalParameters->updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = UncertValue::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = UncertValue::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = UncertValue::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = UncertValue::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = UncertValue::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "definitionURL") + { + value = getDefinitionURL(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this ExternalParameter's attribute + * "attributeName" is set. + */ +bool +ExternalParameter::isSetAttribute(const std::string& attributeName) const +{ + bool value = UncertValue::isSetAttribute(attributeName); + + if (attributeName == "definitionURL") + { + value = isSetDefinitionURL(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = UncertValue::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::setAttribute(const std::string& attributeName, int value) +{ + int return_value = UncertValue::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = UncertValue::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = UncertValue::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = UncertValue::setAttribute(attributeName, value); + + if (attributeName == "definitionURL") + { + return_value = setDefinitionURL(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this ExternalParameter. + */ +int +ExternalParameter::unsetAttribute(const std::string& attributeName) +{ + int value = UncertValue::unsetAttribute(attributeName); + + if (attributeName == "definitionURL") + { + value = unsetDefinitionURL(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this ExternalParameter. + */ +SBase* +ExternalParameter::createChildObject(const std::string& elementName) +{ + UncertValue* obj = NULL; + + if (elementName == "externalParameter") + { + return createExternalParameter(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this ExternalParameter. + */ +int +ExternalParameter::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "externalParameter" && element->getTypeCode() == + SBML_DISTRIB_EXTERNALPARAMETER) + { + return addExternalParameter((const ExternalParameter*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * ExternalParameter. + */ +SBase* +ExternalParameter::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "externalParameter") + { + for (unsigned int i = 0; i < getNumExternalParameters(); i++) + { + if (getExternalParameter(i)->getId() == id) + { + return removeExternalParameter(i); + } + } + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this ExternalParameter. + */ +unsigned int +ExternalParameter::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "externalParameter") + { + return getNumExternalParameters(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this ExternalParameter. + */ +SBase* +ExternalParameter::getObject(const std::string& elementName, + unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "externalParameter") + { + return getExternalParameter(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +ExternalParameter::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mExternalParameters->getId() == id) + { + return mExternalParameters; + } + + obj = mExternalParameters->getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +ExternalParameter::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mExternalParameters->getMetaId() == metaid) + { + return mExternalParameters; + } + + obj = mExternalParameters->getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +ExternalParameter::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_POINTER(ret, sublist, mExternalParameters, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +ExternalParameter::createObject(XMLInputStream& stream) +{ + SBase* obj = UncertValue::createObject(stream); + + const std::string& name = stream.peek().getName(); + + if (name == "listOfExternalParameters") + { + if (getErrorLog() && mExternalParameters->size() != 0) + { + getErrorLog()->logPackageError("distrib", + DistribExternalParameterAllowedElements, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + obj = mExternalParameters; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +ExternalParameter::addExpectedAttributes(ExpectedAttributes& attributes) +{ + UncertValue::addExpectedAttributes(attributes); + + attributes.add("definitionURL"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +ExternalParameter::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribExternalDistributionLOExternalParametersAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", DistribExternalDistributionLOExternalParametersAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + UncertValue::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("distrib", + DistribExternalParameterAllowedAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("distrib", + DistribExternalParameterAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + // + // definitionURL string (use = "required" ) + // + + assigned = attributes.readInto("definitionURL", mDefinitionURL); + + if (assigned == true) + { + if (mDefinitionURL.empty() == true) + { + logEmptyString(mDefinitionURL, level, version, ""); + } + } + else + { + if (log) + { + std::string message = "Distrib attribute 'definitionURL' is missing from " + "the element."; + log->logPackageError("distrib", + DistribExternalParameterAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +ExternalParameter::writeAttributes(XMLOutputStream& stream) const +{ + UncertValue::writeAttributes(stream); + + if (isSetDefinitionURL() == true) + { + stream.writeAttribute("definitionURL", getPrefix(), mDefinitionURL); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new ExternalParameter_t using the given SBML Level, Version and + * “distrib” package version. + */ +LIBSBML_EXTERN +ExternalParameter_t * +ExternalParameter_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ExternalParameter(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this ExternalParameter_t object. + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_clone(const ExternalParameter_t* ep) +{ + if (ep != NULL) + { + return static_cast(ep->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this ExternalParameter_t object. + */ +LIBSBML_EXTERN +void +ExternalParameter_free(ExternalParameter_t* ep) +{ + if (ep != NULL) + { + delete ep; + } +} + + +/* + * Returns the value of the "definitionURL" attribute of this + * ExternalParameter_t. + */ +LIBSBML_EXTERN +char * +ExternalParameter_getDefinitionURL(const ExternalParameter_t * ep) +{ + if (ep == NULL) + { + return NULL; + } + + return ep->getDefinitionURL().empty() ? NULL : + safe_strdup(ep->getDefinitionURL().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this ExternalParameter_t's + * "definitionURL" attribute is set. + */ +LIBSBML_EXTERN +int +ExternalParameter_isSetDefinitionURL(const ExternalParameter_t * ep) +{ + return (ep != NULL) ? static_cast(ep->isSetDefinitionURL()) : 0; +} + + +/* + * Sets the value of the "definitionURL" attribute of this ExternalParameter_t. + */ +LIBSBML_EXTERN +int +ExternalParameter_setDefinitionURL(ExternalParameter_t * ep, + const char * definitionURL) +{ + return (ep != NULL) ? ep->setDefinitionURL(definitionURL) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "definitionURL" attribute of this + * ExternalParameter_t. + */ +LIBSBML_EXTERN +int +ExternalParameter_unsetDefinitionURL(ExternalParameter_t * ep) +{ + return (ep != NULL) ? ep->unsetDefinitionURL() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing ExternalParameter_t objects from this + * ExternalParameter_t. + */ +LIBSBML_EXTERN +ListOf_t* +ExternalParameter_getListOfExternalParameters(ExternalParameter_t* ep) +{ + return (ep != NULL) ? ep->getListOfExternalParameters() : NULL; +} + + +/* + * Get an ExternalParameter_t from the ExternalParameter_t. + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_getExternalParameter(ExternalParameter_t* ep, + unsigned int n) +{ + return (ep != NULL) ? ep->getExternalParameter(n) : NULL; +} + + +/* + * Adds a copy of the given ExternalParameter_t to this ExternalParameter_t. + */ +LIBSBML_EXTERN +int +ExternalParameter_addExternalParameter(ExternalParameter_t* ep, + const ExternalParameter_t* ep1) +{ + return (ep != NULL) ? ep->addExternalParameter(ep1) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of ExternalParameter_t objects in this ExternalParameter_t. + */ +LIBSBML_EXTERN +unsigned int +ExternalParameter_getNumExternalParameters(ExternalParameter_t* ep) +{ + return (ep != NULL) ? ep->getNumExternalParameters() : SBML_INT_MAX; +} + + +/* + * Creates a new ExternalParameter_t object, adds it to this + * ExternalParameter_t object and returns the ExternalParameter_t object + * created. + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_createExternalParameter(ExternalParameter_t* ep) +{ + return (ep != NULL) ? ep->createExternalParameter() : NULL; +} + + +/* + * Removes the nth ExternalParameter_t from this ExternalParameter_t and + * returns a pointer to it. + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_removeExternalParameter(ExternalParameter_t* ep, + unsigned int n) +{ + return (ep != NULL) ? ep->removeExternalParameter(n) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * ExternalParameter_t object have been set. + */ +LIBSBML_EXTERN +int +ExternalParameter_hasRequiredAttributes(const ExternalParameter_t * ep) +{ + return (ep != NULL) ? static_cast(ep->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * ExternalParameter_t object have been set. + */ +LIBSBML_EXTERN +int +ExternalParameter_hasRequiredElements(const ExternalParameter_t * ep) +{ + return (ep != NULL) ? static_cast(ep->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/ExternalParameter.h b/generator/tests/test_cpp_code/test-code/ExternalParameter.h index 33115e3b..91be43ee 100644 --- a/generator/tests/test_cpp_code/test-code/ExternalParameter.h +++ b/generator/tests/test_cpp_code/test-code/ExternalParameter.h @@ -1,1229 +1,1229 @@ -/** - * @file ExternalParameter.h - * @brief Definition of the ExternalParameter class. - * @author SBMLTeam - * - * - * - * @class ExternalParameter - * @sbmlbrief{distrib} TODO:Definition of the ExternalParameter class. - */ - - -#ifndef ExternalParameter_H__ -#define ExternalParameter_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class ListOfExternalParameters; - -class LIBSBML_EXTERN ExternalParameter : public UncertValue -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - std::string mDefinitionURL; - ListOfExternalParameters * mExternalParameters; - - /** @endcond */ - -public: - - /** - * Creates a new ExternalParameter using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ExternalParameter. - * - * @param version an unsigned int, the SBML Version to assign to this - * ExternalParameter. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this ExternalParameter. - * - * @copydetails doc_note_setting_lv_pkg - */ - ExternalParameter(unsigned int level = DistribExtension::getDefaultLevel(), - unsigned int version = - DistribExtension::getDefaultVersion(), - unsigned int pkgVersion = - DistribExtension::getDefaultPackageVersion()); - - - /** - * Creates a new ExternalParameter using the given DistribPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param distribns the DistribPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - ExternalParameter(DistribPkgNamespaces *distribns); - - - /** - * Copy constructor for ExternalParameter. - * - * @param orig the ExternalParameter instance to copy. - */ - ExternalParameter(const ExternalParameter& orig); - - - /** - * Assignment operator for ExternalParameter. - * - * @param rhs the ExternalParameter object whose values are to be used as the - * basis of the assignment. - */ - ExternalParameter& operator=(const ExternalParameter& rhs); - - - /** - * Creates and returns a deep copy of this ExternalParameter object. - * - * @return a (deep) copy of this ExternalParameter object. - */ - virtual ExternalParameter* clone() const; - - - /** - * Destructor for ExternalParameter. - */ - virtual ~ExternalParameter(); - - - /** - * Returns the value of the "definitionURL" attribute of this - * ExternalParameter. - * - * @return the value of the "definitionURL" attribute of this - * ExternalParameter as a string. - */ - const std::string& getDefinitionURL() const; - - - /** - * Predicate returning @c true if this ExternalParameter's "definitionURL" - * attribute is set. - * - * @return @c true if this ExternalParameter's "definitionURL" attribute has - * been set, otherwise @c false is returned. - */ - bool isSetDefinitionURL() const; - - - /** - * Sets the value of the "definitionURL" attribute of this ExternalParameter. - * - * @param definitionURL std::string& value of the "definitionURL" attribute - * to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p definitionURL = @c NULL or an empty string - * is equivalent to calling unsetDefinitionURL(). - */ - int setDefinitionURL(const std::string& definitionURL); - - - /** - * Unsets the value of the "definitionURL" attribute of this - * ExternalParameter. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetDefinitionURL(); - - - /** - * Returns the ListOfExternalParameters * from this ExternalParameter. - * - * @return the ListOfExternalParameters * from this ExternalParameter. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addExternalParameter(const ExternalParameter* object) - * @see createExternalParameter() - * @see getExternalParameter(const std::string& sid) - * @see getExternalParameter(unsigned int n) - * @see getNumExternalParameters() - * @see removeExternalParameter(const std::string& sid) - * @see removeExternalParameter(unsigned int n) - */ - const ListOfExternalParameters * getListOfExternalParameters() const; - - - /** - * Returns the ListOfExternalParameters * from this ExternalParameter. - * - * @return the ListOfExternalParameters * from this ExternalParameter. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addExternalParameter(const ExternalParameter* object) - * @see createExternalParameter() - * @see getExternalParameter(const std::string& sid) - * @see getExternalParameter(unsigned int n) - * @see getNumExternalParameters() - * @see removeExternalParameter(const std::string& sid) - * @see removeExternalParameter(unsigned int n) - */ - ListOfExternalParameters * getListOfExternalParameters(); - - - /** - * Get an ExternalParameter from the ExternalParameter. - * - * @param n an unsigned int representing the index of the ExternalParameter - * to retrieve. - * - * @return the nth ExternalParameter in the ListOfExternalParameters * within - * this ExternalParameter or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addExternalParameter(const ExternalParameter* object) - * @see createExternalParameter() - * @see getExternalParameter(const std::string& sid) - * @see getNumExternalParameters() - * @see removeExternalParameter(const std::string& sid) - * @see removeExternalParameter(unsigned int n) - */ - ExternalParameter* getExternalParameter(unsigned int n); - - - /** - * Get an ExternalParameter from the ExternalParameter. - * - * @param n an unsigned int representing the index of the ExternalParameter - * to retrieve. - * - * @return the nth ExternalParameter in the ListOfExternalParameters * within - * this ExternalParameter or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addExternalParameter(const ExternalParameter* object) - * @see createExternalParameter() - * @see getExternalParameter(const std::string& sid) - * @see getNumExternalParameters() - * @see removeExternalParameter(const std::string& sid) - * @see removeExternalParameter(unsigned int n) - */ - const ExternalParameter* getExternalParameter(unsigned int n) const; - - - /** - * Adds a copy of the given ExternalParameter to this ExternalParameter. - * - * @param ep1 the ExternalParameter object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createExternalParameter() - * @see getExternalParameter(const std::string& sid) - * @see getExternalParameter(unsigned int n) - * @see getNumExternalParameters() - * @see removeExternalParameter(const std::string& sid) - * @see removeExternalParameter(unsigned int n) - */ - int addExternalParameter(const ExternalParameter* ep1); - - - /** - * Get the number of ExternalParameter objects in this ExternalParameter. - * - * @return the number of ExternalParameter objects in this ExternalParameter. - * - * @see addExternalParameter(const ExternalParameter* object) - * @see createExternalParameter() - * @see getExternalParameter(const std::string& sid) - * @see getExternalParameter(unsigned int n) - * @see removeExternalParameter(const std::string& sid) - * @see removeExternalParameter(unsigned int n) - */ - unsigned int getNumExternalParameters() const; - - - /** - * Creates a new ExternalParameter object, adds it to this ExternalParameter - * object and returns the ExternalParameter object created. - * - * @return a new ExternalParameter object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addExternalParameter(const ExternalParameter* object) - * @see getExternalParameter(const std::string& sid) - * @see getExternalParameter(unsigned int n) - * @see getNumExternalParameters() - * @see removeExternalParameter(const std::string& sid) - * @see removeExternalParameter(unsigned int n) - */ - ExternalParameter* createExternalParameter(); - - - /** - * Removes the nth ExternalParameter from this ExternalParameter and returns - * a pointer to it. - * - * @param n an unsigned int representing the index of the ExternalParameter - * to remove. - * - * @return a pointer to the nth ExternalParameter in this ExternalParameter. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addExternalParameter(const ExternalParameter* object) - * @see createExternalParameter() - * @see getExternalParameter(const std::string& sid) - * @see getExternalParameter(unsigned int n) - * @see getNumExternalParameters() - * @see removeExternalParameter(const std::string& sid) - */ - ExternalParameter* removeExternalParameter(unsigned int n); - - - /** - * Returns the XML element name of this ExternalParameter object. - * - * For ExternalParameter, the XML element name is always - * @c "externalParameter". - * - * @return the name of this element, i.e. @c "externalParameter". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this ExternalParameter object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_DISTRIB_EXTERNALPARAMETER, SBMLDistribTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * ExternalParameter object have been set. - * - * @return @c true to indicate that all the required attributes of this - * ExternalParameter have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the ExternalParameter object are: - * @li "definitionURL" - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * ExternalParameter object have been set. - * - * @return @c true to indicate that all the required elements of this - * ExternalParameter have been set, otherwise @c false is returned. - * - * - * @note The required elements for the ExternalParameter object are: - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this ExternalParameter's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this ExternalParameter's attribute "attributeName" has - * been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this ExternalParameter. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * ExternalParameter. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this ExternalParameter. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this ExternalParameter. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * ExternalParameter. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this ExternalParameter. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this ExternalParameter. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new ExternalParameter_t using the given SBML Level, Version and - * “distrib” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * ExternalParameter_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * ExternalParameter_t. - * - * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to - * this ExternalParameter_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -ExternalParameter_t * -ExternalParameter_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this ExternalParameter_t object. - * - * @param ep the ExternalParameter_t structure. - * - * @return a (deep) copy of this ExternalParameter_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_clone(const ExternalParameter_t* ep); - - -/** - * Frees this ExternalParameter_t object. - * - * @param ep the ExternalParameter_t structure. - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -void -ExternalParameter_free(ExternalParameter_t* ep); - - -/** - * Returns the value of the "definitionURL" attribute of this - * ExternalParameter_t. - * - * @param ep the ExternalParameter_t structure whose definitionURL is sought. - * - * @return the value of the "definitionURL" attribute of this - * ExternalParameter_t as a pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -char * -ExternalParameter_getDefinitionURL(const ExternalParameter_t * ep); - - -/** - * Predicate returning @c 1 (true) if this ExternalParameter_t's - * "definitionURL" attribute is set. - * - * @param ep the ExternalParameter_t structure. - * - * @return @c 1 (true) if this ExternalParameter_t's "definitionURL" attribute - * has been set, otherwise @c 0 (false) is returned. - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -int -ExternalParameter_isSetDefinitionURL(const ExternalParameter_t * ep); - - -/** - * Sets the value of the "definitionURL" attribute of this ExternalParameter_t. - * - * @param ep the ExternalParameter_t structure. - * - * @param definitionURL const char * value of the "definitionURL" attribute to - * be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p definitionURL = @c NULL or an empty string is - * equivalent to calling ExternalParameter_unsetDefinitionURL(). - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -int -ExternalParameter_setDefinitionURL(ExternalParameter_t * ep, - const char * definitionURL); - - -/** - * Unsets the value of the "definitionURL" attribute of this - * ExternalParameter_t. - * - * @param ep the ExternalParameter_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -int -ExternalParameter_unsetDefinitionURL(ExternalParameter_t * ep); - - -/** - * Returns a ListOf_t * containing ExternalParameter_t objects from this - * ExternalParameter_t. - * - * @param ep the ExternalParameter_t structure whose ListOfExternalParameters * - * is sought. - * - * @return the ListOfExternalParameters * from this ExternalParameter_t as a - * ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see ExternalParameter_addExternalParameter() - * @see ExternalParameter_createExternalParameter() - * @see ExternalParameter_getExternalParameterById() - * @see ExternalParameter_getExternalParameter() - * @see ExternalParameter_getNumExternalParameters() - * @see ExternalParameter_removeExternalParameterById() - * @see ExternalParameter_removeExternalParameter() - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -ListOf_t* -ExternalParameter_getListOfExternalParameters(ExternalParameter_t* ep); - - -/** - * Get an ExternalParameter_t from the ExternalParameter_t. - * - * @param ep the ExternalParameter_t structure to search. - * - * @param n an unsigned int representing the index of the ExternalParameter_t - * to retrieve. - * - * @return the nth ExternalParameter_t in the ListOfExternalParameters * within - * this ExternalParameter or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_getExternalParameter(ExternalParameter_t* ep, - unsigned int n); - - -/** - * Adds a copy of the given ExternalParameter_t to this ExternalParameter_t. - * - * @param ep the ExternalParameter_t structure to which the ExternalParameter_t - * should be added. - * - * @param ep1 the ExternalParameter_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -int -ExternalParameter_addExternalParameter(ExternalParameter_t* ep, - const ExternalParameter_t* ep1); - - -/** - * Get the number of ExternalParameter_t objects in this ExternalParameter_t. - * - * @param ep the ExternalParameter_t structure to query. - * - * @return the number of ExternalParameter_t objects in this - * ExternalParameter_t. - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -unsigned int -ExternalParameter_getNumExternalParameters(ExternalParameter_t* ep); - - -/** - * Creates a new ExternalParameter_t object, adds it to this - * ExternalParameter_t object and returns the ExternalParameter_t object - * created. - * - * @param ep the ExternalParameter_t structure to which the ExternalParameter_t - * should be added. - * - * @return a new ExternalParameter_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_createExternalParameter(ExternalParameter_t* ep); - - -/** - * Removes the nth ExternalParameter_t from this ExternalParameter_t and - * returns a pointer to it. - * - * @param ep the ExternalParameter_t structure to search. - * - * @param n an unsigned int representing the index of the ExternalParameter_t - * to remove. - * - * @return a pointer to the nth ExternalParameter_t in this - * ExternalParameter_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -ExternalParameter_t* -ExternalParameter_removeExternalParameter(ExternalParameter_t* ep, - unsigned int n); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * ExternalParameter_t object have been set. - * - * @param ep the ExternalParameter_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * ExternalParameter_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the ExternalParameter_t object are: - * @li "definitionURL" - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -int -ExternalParameter_hasRequiredAttributes(const ExternalParameter_t * ep); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * ExternalParameter_t object have been set. - * - * @param ep the ExternalParameter_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * ExternalParameter_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the ExternalParameter_t object are: - * - * @memberof ExternalParameter_t - */ -LIBSBML_EXTERN -int -ExternalParameter_hasRequiredElements(const ExternalParameter_t * ep); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !ExternalParameter_H__ */ - - +/** + * @file ExternalParameter.h + * @brief Definition of the ExternalParameter class. + * @author SBMLTeam + * + * + * + * @class ExternalParameter + * @sbmlbrief{distrib} TODO:Definition of the ExternalParameter class. + */ + + +#ifndef ExternalParameter_H__ +#define ExternalParameter_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class ListOfExternalParameters; + +class LIBSBML_EXTERN ExternalParameter : public UncertValue +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + std::string mDefinitionURL; + ListOfExternalParameters * mExternalParameters; + + /** @endcond */ + +public: + + /** + * Creates a new ExternalParameter using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ExternalParameter. + * + * @param version an unsigned int, the SBML Version to assign to this + * ExternalParameter. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this ExternalParameter. + * + * @copydetails doc_note_setting_lv_pkg + */ + ExternalParameter(unsigned int level = DistribExtension::getDefaultLevel(), + unsigned int version = + DistribExtension::getDefaultVersion(), + unsigned int pkgVersion = + DistribExtension::getDefaultPackageVersion()); + + + /** + * Creates a new ExternalParameter using the given DistribPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param distribns the DistribPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + ExternalParameter(DistribPkgNamespaces *distribns); + + + /** + * Copy constructor for ExternalParameter. + * + * @param orig the ExternalParameter instance to copy. + */ + ExternalParameter(const ExternalParameter& orig); + + + /** + * Assignment operator for ExternalParameter. + * + * @param rhs the ExternalParameter object whose values are to be used as the + * basis of the assignment. + */ + ExternalParameter& operator=(const ExternalParameter& rhs); + + + /** + * Creates and returns a deep copy of this ExternalParameter object. + * + * @return a (deep) copy of this ExternalParameter object. + */ + virtual ExternalParameter* clone() const; + + + /** + * Destructor for ExternalParameter. + */ + virtual ~ExternalParameter(); + + + /** + * Returns the value of the "definitionURL" attribute of this + * ExternalParameter. + * + * @return the value of the "definitionURL" attribute of this + * ExternalParameter as a string. + */ + const std::string& getDefinitionURL() const; + + + /** + * Predicate returning @c true if this ExternalParameter's "definitionURL" + * attribute is set. + * + * @return @c true if this ExternalParameter's "definitionURL" attribute has + * been set, otherwise @c false is returned. + */ + bool isSetDefinitionURL() const; + + + /** + * Sets the value of the "definitionURL" attribute of this ExternalParameter. + * + * @param definitionURL std::string& value of the "definitionURL" attribute + * to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p definitionURL = @c NULL or an empty string + * is equivalent to calling unsetDefinitionURL(). + */ + int setDefinitionURL(const std::string& definitionURL); + + + /** + * Unsets the value of the "definitionURL" attribute of this + * ExternalParameter. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetDefinitionURL(); + + + /** + * Returns the ListOfExternalParameters * from this ExternalParameter. + * + * @return the ListOfExternalParameters * from this ExternalParameter. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addExternalParameter(const ExternalParameter* object) + * @see createExternalParameter() + * @see getExternalParameter(const std::string& sid) + * @see getExternalParameter(unsigned int n) + * @see getNumExternalParameters() + * @see removeExternalParameter(const std::string& sid) + * @see removeExternalParameter(unsigned int n) + */ + const ListOfExternalParameters * getListOfExternalParameters() const; + + + /** + * Returns the ListOfExternalParameters * from this ExternalParameter. + * + * @return the ListOfExternalParameters * from this ExternalParameter. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addExternalParameter(const ExternalParameter* object) + * @see createExternalParameter() + * @see getExternalParameter(const std::string& sid) + * @see getExternalParameter(unsigned int n) + * @see getNumExternalParameters() + * @see removeExternalParameter(const std::string& sid) + * @see removeExternalParameter(unsigned int n) + */ + ListOfExternalParameters * getListOfExternalParameters(); + + + /** + * Get an ExternalParameter from the ExternalParameter. + * + * @param n an unsigned int representing the index of the ExternalParameter + * to retrieve. + * + * @return the nth ExternalParameter in the ListOfExternalParameters * within + * this ExternalParameter or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addExternalParameter(const ExternalParameter* object) + * @see createExternalParameter() + * @see getExternalParameter(const std::string& sid) + * @see getNumExternalParameters() + * @see removeExternalParameter(const std::string& sid) + * @see removeExternalParameter(unsigned int n) + */ + ExternalParameter* getExternalParameter(unsigned int n); + + + /** + * Get an ExternalParameter from the ExternalParameter. + * + * @param n an unsigned int representing the index of the ExternalParameter + * to retrieve. + * + * @return the nth ExternalParameter in the ListOfExternalParameters * within + * this ExternalParameter or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addExternalParameter(const ExternalParameter* object) + * @see createExternalParameter() + * @see getExternalParameter(const std::string& sid) + * @see getNumExternalParameters() + * @see removeExternalParameter(const std::string& sid) + * @see removeExternalParameter(unsigned int n) + */ + const ExternalParameter* getExternalParameter(unsigned int n) const; + + + /** + * Adds a copy of the given ExternalParameter to this ExternalParameter. + * + * @param ep1 the ExternalParameter object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createExternalParameter() + * @see getExternalParameter(const std::string& sid) + * @see getExternalParameter(unsigned int n) + * @see getNumExternalParameters() + * @see removeExternalParameter(const std::string& sid) + * @see removeExternalParameter(unsigned int n) + */ + int addExternalParameter(const ExternalParameter* ep1); + + + /** + * Get the number of ExternalParameter objects in this ExternalParameter. + * + * @return the number of ExternalParameter objects in this ExternalParameter. + * + * @see addExternalParameter(const ExternalParameter* object) + * @see createExternalParameter() + * @see getExternalParameter(const std::string& sid) + * @see getExternalParameter(unsigned int n) + * @see removeExternalParameter(const std::string& sid) + * @see removeExternalParameter(unsigned int n) + */ + unsigned int getNumExternalParameters() const; + + + /** + * Creates a new ExternalParameter object, adds it to this ExternalParameter + * object and returns the ExternalParameter object created. + * + * @return a new ExternalParameter object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addExternalParameter(const ExternalParameter* object) + * @see getExternalParameter(const std::string& sid) + * @see getExternalParameter(unsigned int n) + * @see getNumExternalParameters() + * @see removeExternalParameter(const std::string& sid) + * @see removeExternalParameter(unsigned int n) + */ + ExternalParameter* createExternalParameter(); + + + /** + * Removes the nth ExternalParameter from this ExternalParameter and returns + * a pointer to it. + * + * @param n an unsigned int representing the index of the ExternalParameter + * to remove. + * + * @return a pointer to the nth ExternalParameter in this ExternalParameter. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addExternalParameter(const ExternalParameter* object) + * @see createExternalParameter() + * @see getExternalParameter(const std::string& sid) + * @see getExternalParameter(unsigned int n) + * @see getNumExternalParameters() + * @see removeExternalParameter(const std::string& sid) + */ + ExternalParameter* removeExternalParameter(unsigned int n); + + + /** + * Returns the XML element name of this ExternalParameter object. + * + * For ExternalParameter, the XML element name is always + * @c "externalParameter". + * + * @return the name of this element, i.e. @c "externalParameter". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this ExternalParameter object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_DISTRIB_EXTERNALPARAMETER, SBMLDistribTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * ExternalParameter object have been set. + * + * @return @c true to indicate that all the required attributes of this + * ExternalParameter have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the ExternalParameter object are: + * @li "definitionURL" + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * ExternalParameter object have been set. + * + * @return @c true to indicate that all the required elements of this + * ExternalParameter have been set, otherwise @c false is returned. + * + * + * @note The required elements for the ExternalParameter object are: + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this ExternalParameter's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this ExternalParameter's attribute "attributeName" has + * been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this ExternalParameter. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * ExternalParameter. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this ExternalParameter. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this ExternalParameter. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * ExternalParameter. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this ExternalParameter. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this ExternalParameter. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new ExternalParameter_t using the given SBML Level, Version and + * “distrib” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * ExternalParameter_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * ExternalParameter_t. + * + * @param pkgVersion an unsigned int, the SBML Distrib Version to assign to + * this ExternalParameter_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +ExternalParameter_t * +ExternalParameter_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this ExternalParameter_t object. + * + * @param ep the ExternalParameter_t structure. + * + * @return a (deep) copy of this ExternalParameter_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_clone(const ExternalParameter_t* ep); + + +/** + * Frees this ExternalParameter_t object. + * + * @param ep the ExternalParameter_t structure. + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +void +ExternalParameter_free(ExternalParameter_t* ep); + + +/** + * Returns the value of the "definitionURL" attribute of this + * ExternalParameter_t. + * + * @param ep the ExternalParameter_t structure whose definitionURL is sought. + * + * @return the value of the "definitionURL" attribute of this + * ExternalParameter_t as a pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +char * +ExternalParameter_getDefinitionURL(const ExternalParameter_t * ep); + + +/** + * Predicate returning @c 1 (true) if this ExternalParameter_t's + * "definitionURL" attribute is set. + * + * @param ep the ExternalParameter_t structure. + * + * @return @c 1 (true) if this ExternalParameter_t's "definitionURL" attribute + * has been set, otherwise @c 0 (false) is returned. + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +int +ExternalParameter_isSetDefinitionURL(const ExternalParameter_t * ep); + + +/** + * Sets the value of the "definitionURL" attribute of this ExternalParameter_t. + * + * @param ep the ExternalParameter_t structure. + * + * @param definitionURL const char * value of the "definitionURL" attribute to + * be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p definitionURL = @c NULL or an empty string is + * equivalent to calling ExternalParameter_unsetDefinitionURL(). + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +int +ExternalParameter_setDefinitionURL(ExternalParameter_t * ep, + const char * definitionURL); + + +/** + * Unsets the value of the "definitionURL" attribute of this + * ExternalParameter_t. + * + * @param ep the ExternalParameter_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +int +ExternalParameter_unsetDefinitionURL(ExternalParameter_t * ep); + + +/** + * Returns a ListOf_t * containing ExternalParameter_t objects from this + * ExternalParameter_t. + * + * @param ep the ExternalParameter_t structure whose ListOfExternalParameters * + * is sought. + * + * @return the ListOfExternalParameters * from this ExternalParameter_t as a + * ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see ExternalParameter_addExternalParameter() + * @see ExternalParameter_createExternalParameter() + * @see ExternalParameter_getExternalParameterById() + * @see ExternalParameter_getExternalParameter() + * @see ExternalParameter_getNumExternalParameters() + * @see ExternalParameter_removeExternalParameterById() + * @see ExternalParameter_removeExternalParameter() + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +ListOf_t* +ExternalParameter_getListOfExternalParameters(ExternalParameter_t* ep); + + +/** + * Get an ExternalParameter_t from the ExternalParameter_t. + * + * @param ep the ExternalParameter_t structure to search. + * + * @param n an unsigned int representing the index of the ExternalParameter_t + * to retrieve. + * + * @return the nth ExternalParameter_t in the ListOfExternalParameters * within + * this ExternalParameter or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_getExternalParameter(ExternalParameter_t* ep, + unsigned int n); + + +/** + * Adds a copy of the given ExternalParameter_t to this ExternalParameter_t. + * + * @param ep the ExternalParameter_t structure to which the ExternalParameter_t + * should be added. + * + * @param ep1 the ExternalParameter_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +int +ExternalParameter_addExternalParameter(ExternalParameter_t* ep, + const ExternalParameter_t* ep1); + + +/** + * Get the number of ExternalParameter_t objects in this ExternalParameter_t. + * + * @param ep the ExternalParameter_t structure to query. + * + * @return the number of ExternalParameter_t objects in this + * ExternalParameter_t. + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +unsigned int +ExternalParameter_getNumExternalParameters(ExternalParameter_t* ep); + + +/** + * Creates a new ExternalParameter_t object, adds it to this + * ExternalParameter_t object and returns the ExternalParameter_t object + * created. + * + * @param ep the ExternalParameter_t structure to which the ExternalParameter_t + * should be added. + * + * @return a new ExternalParameter_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_createExternalParameter(ExternalParameter_t* ep); + + +/** + * Removes the nth ExternalParameter_t from this ExternalParameter_t and + * returns a pointer to it. + * + * @param ep the ExternalParameter_t structure to search. + * + * @param n an unsigned int representing the index of the ExternalParameter_t + * to remove. + * + * @return a pointer to the nth ExternalParameter_t in this + * ExternalParameter_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +ExternalParameter_t* +ExternalParameter_removeExternalParameter(ExternalParameter_t* ep, + unsigned int n); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * ExternalParameter_t object have been set. + * + * @param ep the ExternalParameter_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * ExternalParameter_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the ExternalParameter_t object are: + * @li "definitionURL" + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +int +ExternalParameter_hasRequiredAttributes(const ExternalParameter_t * ep); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * ExternalParameter_t object have been set. + * + * @param ep the ExternalParameter_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * ExternalParameter_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the ExternalParameter_t object are: + * + * @memberof ExternalParameter_t + */ +LIBSBML_EXTERN +int +ExternalParameter_hasRequiredElements(const ExternalParameter_t * ep); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !ExternalParameter_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/FbcAnd.cpp b/generator/tests/test_cpp_code/test-code/FbcAnd.cpp index 76f3aada..69804820 100644 --- a/generator/tests/test_cpp_code/test-code/FbcAnd.cpp +++ b/generator/tests/test_cpp_code/test-code/FbcAnd.cpp @@ -1,1182 +1,1182 @@ -/** - * @file FbcAnd.cpp - * @brief Implementation of the FbcAnd class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new FbcAnd using the given SBML Level, Version and - * “fbc” package version. - */ -FbcAnd::FbcAnd(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : Association(level, version, pkgVersion) - , mAssociations (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new FbcPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new FbcAnd using the given FbcPkgNamespaces object. - */ -FbcAnd::FbcAnd(FbcPkgNamespaces *fbcns) - : Association(fbcns) - , mAssociations (fbcns) -{ - setElementNamespace(fbcns->getURI()); - connectToChild(); - loadPlugins(fbcns); -} - - -/* - * Copy constructor for FbcAnd. - */ -FbcAnd::FbcAnd(const FbcAnd& orig) - : Association( orig ) - , mAssociations ( orig.mAssociations ) -{ - connectToChild(); -} - - -/* - * Assignment operator for FbcAnd. - */ -FbcAnd& -FbcAnd::operator=(const FbcAnd& rhs) -{ - if (&rhs != this) - { - Association::operator=(rhs); - mAssociations = rhs.mAssociations; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this FbcAnd object. - */ -FbcAnd* -FbcAnd::clone() const -{ - return new FbcAnd(*this); -} - - -/* - * Destructor for FbcAnd. - */ -FbcAnd::~FbcAnd() -{ -} - - -/* - * Returns the ListOfAssociations from this FbcAnd. - */ -const ListOfAssociations* -FbcAnd::getListOfAssociations() const -{ - return &mAssociations; -} - - -/* - * Returns the ListOfAssociations from this FbcAnd. - */ -ListOfAssociations* -FbcAnd::getListOfAssociations() -{ - return &mAssociations; -} - - -/* - * Get an Association from the FbcAnd. - */ -Association* -FbcAnd::getAssociation(unsigned int n) -{ - return mAssociations.get(n); -} - - -/* - * Get an Association from the FbcAnd. - */ -const Association* -FbcAnd::getAssociation(unsigned int n) const -{ - return mAssociations.get(n); -} - - -/* - * Adds a copy of the given Association to this FbcAnd. - */ -int -FbcAnd::addAssociation(const Association* a) -{ - if (a == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (a->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != a->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != a->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(a)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else - { - return mAssociations.append(a); - } -} - - -/* - * Get the number of Association objects in this FbcAnd. - */ -unsigned int -FbcAnd::getNumAssociations() const -{ - return mAssociations.size(); -} - - -/* - * Creates a new FbcAnd object, adds it to this FbcAnd object and returns the - * FbcAnd object created. - */ -FbcAnd* -FbcAnd::createAnd() -{ - FbcAnd* fa = NULL; - - try - { - FBC_CREATE_NS_WITH_VERSION(fbcns, getSBMLNamespaces(), - getPackageVersion()); - fa = new FbcAnd(fbcns); - delete fbcns; - } - catch (...) - { - } - - if (fa != NULL) - { - mAssociations.appendAndOwn(fa); - } - - return fa; -} - - -/* - * Creates a new FbcOr object, adds it to this FbcAnd object and returns the - * FbcOr object created. - */ -FbcOr* -FbcAnd::createOr() -{ - FbcOr* fo = NULL; - - try - { - FBC_CREATE_NS_WITH_VERSION(fbcns, getSBMLNamespaces(), - getPackageVersion()); - fo = new FbcOr(fbcns); - delete fbcns; - } - catch (...) - { - } - - if (fo != NULL) - { - mAssociations.appendAndOwn(fo); - } - - return fo; -} - - -/* - * Creates a new GeneProductRef object, adds it to this FbcAnd object and - * returns the GeneProductRef object created. - */ -GeneProductRef* -FbcAnd::createGeneProductRef() -{ - GeneProductRef* gpr = NULL; - - try - { - FBC_CREATE_NS_WITH_VERSION(fbcns, getSBMLNamespaces(), - getPackageVersion()); - gpr = new GeneProductRef(fbcns); - delete fbcns; - } - catch (...) - { - } - - if (gpr != NULL) - { - mAssociations.appendAndOwn(gpr); - } - - return gpr; -} - - -/* - * Removes the nth Association from this FbcAnd and returns a pointer to it. - */ -Association* -FbcAnd::removeAssociation(unsigned int n) -{ - return mAssociations.remove(n); -} - - -/* - * Returns the XML element name of this FbcAnd object. - */ -const std::string& -FbcAnd::getElementName() const -{ - static const string name = "and"; - return name; -} - - -/* - * Returns the libSBML type code for this FbcAnd object. - */ -int -FbcAnd::getTypeCode() const -{ - return SBML_FBC_AND; -} - - -/* - * Predicate returning @c true if all the required attributes for this FbcAnd - * object have been set. - */ -bool -FbcAnd::hasRequiredAttributes() const -{ - bool allPresent = Association::hasRequiredAttributes(); - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this FbcAnd - * object have been set. - */ -bool -FbcAnd::hasRequiredElements() const -{ - bool allPresent = Association::hasRequiredElements(); - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -FbcAnd::writeElements(XMLOutputStream& stream) const -{ - Association::writeElements(stream); - - for (unsigned int i = 0; i < getNumAssociations(); i++) - { - getAssociation(i)->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -FbcAnd::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mAssociations.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -FbcAnd::setSBMLDocument(SBMLDocument* d) -{ - Association::setSBMLDocument(d); - - mAssociations.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -FbcAnd::connectToChild() -{ - Association::connectToChild(); - - mAssociations.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -FbcAnd::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - Association::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mAssociations.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -FbcAnd::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - Association::updateSBMLNamespace(package, level, version); - - mAssociations.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = Association::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = Association::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = Association::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = Association::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = Association::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this FbcAnd's attribute "attributeName" is - * set. - */ -bool -FbcAnd::isSetAttribute(const std::string& attributeName) const -{ - bool value = Association::isSetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = Association::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::setAttribute(const std::string& attributeName, int value) -{ - int return_value = Association::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::setAttribute(const std::string& attributeName, double value) -{ - int return_value = Association::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = Association::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = Association::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this FbcAnd. - */ -int -FbcAnd::unsetAttribute(const std::string& attributeName) -{ - int value = Association::unsetAttribute(attributeName); - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this FbcAnd. - */ -SBase* -FbcAnd::createChildObject(const std::string& elementName) -{ - Association* obj = NULL; - - if (elementName == "and") - { - return createAnd(); - } - else if (elementName == "or") - { - return createOr(); - } - else if (elementName == "geneProductRef") - { - return createGeneProductRef(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this FbcAnd. - */ -int -FbcAnd::addChildObject(const std::string& elementName, const SBase* element) -{ - if (elementName == "and" && element->getTypeCode() == SBML_FBC_AND) - { - return addAssociation((const Association*)(element)); - } - else if (elementName == "or" && element->getTypeCode() == SBML_FBC_OR) - { - return addAssociation((const Association*)(element)); - } - else if (elementName == "geneProductRef" && element->getTypeCode() == - SBML_FBC_GENEPRODUCTREF) - { - return addAssociation((const Association*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * FbcAnd. - */ -SBase* -FbcAnd::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "and") - { - for (unsigned int i = 0; i < getNumAssociations(); i++) - { - if (getAssociation(i)->getId() == id) - { - return removeAssociation(i); - } - } - } - else if (elementName == "or") - { - for (unsigned int i = 0; i < getNumAssociations(); i++) - { - if (getAssociation(i)->getId() == id) - { - return removeAssociation(i); - } - } - } - else if (elementName == "geneProductRef") - { - for (unsigned int i = 0; i < getNumAssociations(); i++) - { - if (getAssociation(i)->getId() == id) - { - return removeAssociation(i); - } - } - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this FbcAnd. - */ -unsigned int -FbcAnd::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "association") - { - return getNumAssociations(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this FbcAnd. - */ -SBase* -FbcAnd::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "association") - { - return getAssociation(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -FbcAnd::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - obj = mAssociations.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -FbcAnd::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mAssociations.getMetaId() == metaid) - { - return &mAssociations; - } - - obj = mAssociations.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -FbcAnd::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mAssociations, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -FbcAnd::createObject(XMLInputStream& stream) -{ - SBase* obj = Association::createObject(stream); - - const std::string& name = stream.peek().getName(); - - if (name == "association") - { - obj = mAssociations.createObject(stream); - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -FbcAnd::addExpectedAttributes(ExpectedAttributes& attributes) -{ - Association::addExpectedAttributes(attributes); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -FbcAnd::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - Association::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("fbc", FbcAndAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("fbc", FbcAndAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -FbcAnd::writeAttributes(XMLOutputStream& stream) const -{ - Association::writeAttributes(stream); - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new FbcAnd_t using the given SBML Level, Version and - * “fbc” package version. - */ -LIBSBML_EXTERN -FbcAnd_t * -FbcAnd_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new FbcAnd(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this FbcAnd_t object. - */ -LIBSBML_EXTERN -FbcAnd_t* -FbcAnd_clone(const FbcAnd_t* fa) -{ - if (fa != NULL) - { - return static_cast(fa->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this FbcAnd_t object. - */ -LIBSBML_EXTERN -void -FbcAnd_free(FbcAnd_t* fa) -{ - if (fa != NULL) - { - delete fa; - } -} - - -/* - * Returns a ListOf_t * containing Association_t objects from this FbcAnd_t. - */ -LIBSBML_EXTERN -ListOf_t* -FbcAnd_getListOfAssociations(FbcAnd_t* fa) -{ - return (fa != NULL) ? fa->getListOfAssociations() : NULL; -} - - -/* - * Get an Association_t from the FbcAnd_t. - */ -LIBSBML_EXTERN -Association_t* -FbcAnd_getAssociation(FbcAnd_t* fa, unsigned int n) -{ - return (fa != NULL) ? fa->getAssociation(n) : NULL; -} - - -/* - * Adds a copy of the given Association_t to this FbcAnd_t. - */ -LIBSBML_EXTERN -int -FbcAnd_addAssociation(FbcAnd_t* fa, const Association_t* a) -{ - return (fa != NULL) ? fa->addAssociation(a) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of Association_t objects in this FbcAnd_t. - */ -LIBSBML_EXTERN -unsigned int -FbcAnd_getNumAssociations(FbcAnd_t* fa) -{ - return (fa != NULL) ? fa->getNumAssociations() : SBML_INT_MAX; -} - - -/* - * Creates a new FbcAnd_t object, adds it to this FbcAnd_t object and returns - * the FbcAnd_t object created. - */ -LIBSBML_EXTERN -FbcAnd_t* -FbcAnd_createAnd(FbcAnd_t* fa) -{ - return (fa != NULL) ? fa->createAnd() : NULL; -} - - -/* - * Creates a new FbcOr_t object, adds it to this FbcAnd_t object and returns - * the FbcOr_t object created. - */ -LIBSBML_EXTERN -FbcOr_t* -FbcAnd_createOr(FbcAnd_t* fa) -{ - return (fa != NULL) ? fa->createOr() : NULL; -} - - -/* - * Creates a new GeneProductRef_t object, adds it to this FbcAnd_t object and - * returns the GeneProductRef_t object created. - */ -LIBSBML_EXTERN -GeneProductRef_t* -FbcAnd_createGeneProductRef(FbcAnd_t* fa) -{ - return (fa != NULL) ? fa->createGeneProductRef() : NULL; -} - - -/* - * Removes the nth Association_t from this FbcAnd_t and returns a pointer to - * it. - */ -LIBSBML_EXTERN -Association_t* -FbcAnd_removeAssociation(FbcAnd_t* fa, unsigned int n) -{ - return (fa != NULL) ? fa->removeAssociation(n) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * FbcAnd_t object have been set. - */ -LIBSBML_EXTERN -int -FbcAnd_hasRequiredAttributes(const FbcAnd_t * fa) -{ - return (fa != NULL) ? static_cast(fa->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * FbcAnd_t object have been set. - */ -LIBSBML_EXTERN -int -FbcAnd_hasRequiredElements(const FbcAnd_t * fa) -{ - return (fa != NULL) ? static_cast(fa->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file FbcAnd.cpp + * @brief Implementation of the FbcAnd class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new FbcAnd using the given SBML Level, Version and + * “fbc” package version. + */ +FbcAnd::FbcAnd(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : Association(level, version, pkgVersion) + , mAssociations (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new FbcPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new FbcAnd using the given FbcPkgNamespaces object. + */ +FbcAnd::FbcAnd(FbcPkgNamespaces *fbcns) + : Association(fbcns) + , mAssociations (fbcns) +{ + setElementNamespace(fbcns->getURI()); + connectToChild(); + loadPlugins(fbcns); +} + + +/* + * Copy constructor for FbcAnd. + */ +FbcAnd::FbcAnd(const FbcAnd& orig) + : Association( orig ) + , mAssociations ( orig.mAssociations ) +{ + connectToChild(); +} + + +/* + * Assignment operator for FbcAnd. + */ +FbcAnd& +FbcAnd::operator=(const FbcAnd& rhs) +{ + if (&rhs != this) + { + Association::operator=(rhs); + mAssociations = rhs.mAssociations; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this FbcAnd object. + */ +FbcAnd* +FbcAnd::clone() const +{ + return new FbcAnd(*this); +} + + +/* + * Destructor for FbcAnd. + */ +FbcAnd::~FbcAnd() +{ +} + + +/* + * Returns the ListOfAssociations from this FbcAnd. + */ +const ListOfAssociations* +FbcAnd::getListOfAssociations() const +{ + return &mAssociations; +} + + +/* + * Returns the ListOfAssociations from this FbcAnd. + */ +ListOfAssociations* +FbcAnd::getListOfAssociations() +{ + return &mAssociations; +} + + +/* + * Get an Association from the FbcAnd. + */ +Association* +FbcAnd::getAssociation(unsigned int n) +{ + return mAssociations.get(n); +} + + +/* + * Get an Association from the FbcAnd. + */ +const Association* +FbcAnd::getAssociation(unsigned int n) const +{ + return mAssociations.get(n); +} + + +/* + * Adds a copy of the given Association to this FbcAnd. + */ +int +FbcAnd::addAssociation(const Association* a) +{ + if (a == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (a->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != a->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != a->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(a)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else + { + return mAssociations.append(a); + } +} + + +/* + * Get the number of Association objects in this FbcAnd. + */ +unsigned int +FbcAnd::getNumAssociations() const +{ + return mAssociations.size(); +} + + +/* + * Creates a new FbcAnd object, adds it to this FbcAnd object and returns the + * FbcAnd object created. + */ +FbcAnd* +FbcAnd::createAnd() +{ + FbcAnd* fa = NULL; + + try + { + FBC_CREATE_NS_WITH_VERSION(fbcns, getSBMLNamespaces(), + getPackageVersion()); + fa = new FbcAnd(fbcns); + delete fbcns; + } + catch (...) + { + } + + if (fa != NULL) + { + mAssociations.appendAndOwn(fa); + } + + return fa; +} + + +/* + * Creates a new FbcOr object, adds it to this FbcAnd object and returns the + * FbcOr object created. + */ +FbcOr* +FbcAnd::createOr() +{ + FbcOr* fo = NULL; + + try + { + FBC_CREATE_NS_WITH_VERSION(fbcns, getSBMLNamespaces(), + getPackageVersion()); + fo = new FbcOr(fbcns); + delete fbcns; + } + catch (...) + { + } + + if (fo != NULL) + { + mAssociations.appendAndOwn(fo); + } + + return fo; +} + + +/* + * Creates a new GeneProductRef object, adds it to this FbcAnd object and + * returns the GeneProductRef object created. + */ +GeneProductRef* +FbcAnd::createGeneProductRef() +{ + GeneProductRef* gpr = NULL; + + try + { + FBC_CREATE_NS_WITH_VERSION(fbcns, getSBMLNamespaces(), + getPackageVersion()); + gpr = new GeneProductRef(fbcns); + delete fbcns; + } + catch (...) + { + } + + if (gpr != NULL) + { + mAssociations.appendAndOwn(gpr); + } + + return gpr; +} + + +/* + * Removes the nth Association from this FbcAnd and returns a pointer to it. + */ +Association* +FbcAnd::removeAssociation(unsigned int n) +{ + return mAssociations.remove(n); +} + + +/* + * Returns the XML element name of this FbcAnd object. + */ +const std::string& +FbcAnd::getElementName() const +{ + static const string name = "and"; + return name; +} + + +/* + * Returns the libSBML type code for this FbcAnd object. + */ +int +FbcAnd::getTypeCode() const +{ + return SBML_FBC_AND; +} + + +/* + * Predicate returning @c true if all the required attributes for this FbcAnd + * object have been set. + */ +bool +FbcAnd::hasRequiredAttributes() const +{ + bool allPresent = Association::hasRequiredAttributes(); + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this FbcAnd + * object have been set. + */ +bool +FbcAnd::hasRequiredElements() const +{ + bool allPresent = Association::hasRequiredElements(); + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +FbcAnd::writeElements(XMLOutputStream& stream) const +{ + Association::writeElements(stream); + + for (unsigned int i = 0; i < getNumAssociations(); i++) + { + getAssociation(i)->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +FbcAnd::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mAssociations.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +FbcAnd::setSBMLDocument(SBMLDocument* d) +{ + Association::setSBMLDocument(d); + + mAssociations.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +FbcAnd::connectToChild() +{ + Association::connectToChild(); + + mAssociations.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +FbcAnd::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + Association::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mAssociations.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +FbcAnd::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + Association::updateSBMLNamespace(package, level, version); + + mAssociations.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = Association::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = Association::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = Association::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = Association::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = Association::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this FbcAnd's attribute "attributeName" is + * set. + */ +bool +FbcAnd::isSetAttribute(const std::string& attributeName) const +{ + bool value = Association::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = Association::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::setAttribute(const std::string& attributeName, int value) +{ + int return_value = Association::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::setAttribute(const std::string& attributeName, double value) +{ + int return_value = Association::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = Association::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = Association::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this FbcAnd. + */ +int +FbcAnd::unsetAttribute(const std::string& attributeName) +{ + int value = Association::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this FbcAnd. + */ +SBase* +FbcAnd::createChildObject(const std::string& elementName) +{ + Association* obj = NULL; + + if (elementName == "and") + { + return createAnd(); + } + else if (elementName == "or") + { + return createOr(); + } + else if (elementName == "geneProductRef") + { + return createGeneProductRef(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this FbcAnd. + */ +int +FbcAnd::addChildObject(const std::string& elementName, const SBase* element) +{ + if (elementName == "and" && element->getTypeCode() == SBML_FBC_AND) + { + return addAssociation((const Association*)(element)); + } + else if (elementName == "or" && element->getTypeCode() == SBML_FBC_OR) + { + return addAssociation((const Association*)(element)); + } + else if (elementName == "geneProductRef" && element->getTypeCode() == + SBML_FBC_GENEPRODUCTREF) + { + return addAssociation((const Association*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * FbcAnd. + */ +SBase* +FbcAnd::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "and") + { + for (unsigned int i = 0; i < getNumAssociations(); i++) + { + if (getAssociation(i)->getId() == id) + { + return removeAssociation(i); + } + } + } + else if (elementName == "or") + { + for (unsigned int i = 0; i < getNumAssociations(); i++) + { + if (getAssociation(i)->getId() == id) + { + return removeAssociation(i); + } + } + } + else if (elementName == "geneProductRef") + { + for (unsigned int i = 0; i < getNumAssociations(); i++) + { + if (getAssociation(i)->getId() == id) + { + return removeAssociation(i); + } + } + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this FbcAnd. + */ +unsigned int +FbcAnd::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "association") + { + return getNumAssociations(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this FbcAnd. + */ +SBase* +FbcAnd::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "association") + { + return getAssociation(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +FbcAnd::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + obj = mAssociations.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +FbcAnd::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mAssociations.getMetaId() == metaid) + { + return &mAssociations; + } + + obj = mAssociations.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +FbcAnd::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mAssociations, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +FbcAnd::createObject(XMLInputStream& stream) +{ + SBase* obj = Association::createObject(stream); + + const std::string& name = stream.peek().getName(); + + if (name == "association") + { + obj = mAssociations.createObject(stream); + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +FbcAnd::addExpectedAttributes(ExpectedAttributes& attributes) +{ + Association::addExpectedAttributes(attributes); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +FbcAnd::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + Association::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("fbc", FbcAndAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("fbc", FbcAndAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +FbcAnd::writeAttributes(XMLOutputStream& stream) const +{ + Association::writeAttributes(stream); + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new FbcAnd_t using the given SBML Level, Version and + * “fbc” package version. + */ +LIBSBML_EXTERN +FbcAnd_t * +FbcAnd_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new FbcAnd(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this FbcAnd_t object. + */ +LIBSBML_EXTERN +FbcAnd_t* +FbcAnd_clone(const FbcAnd_t* fa) +{ + if (fa != NULL) + { + return static_cast(fa->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this FbcAnd_t object. + */ +LIBSBML_EXTERN +void +FbcAnd_free(FbcAnd_t* fa) +{ + if (fa != NULL) + { + delete fa; + } +} + + +/* + * Returns a ListOf_t * containing Association_t objects from this FbcAnd_t. + */ +LIBSBML_EXTERN +ListOf_t* +FbcAnd_getListOfAssociations(FbcAnd_t* fa) +{ + return (fa != NULL) ? fa->getListOfAssociations() : NULL; +} + + +/* + * Get an Association_t from the FbcAnd_t. + */ +LIBSBML_EXTERN +Association_t* +FbcAnd_getAssociation(FbcAnd_t* fa, unsigned int n) +{ + return (fa != NULL) ? fa->getAssociation(n) : NULL; +} + + +/* + * Adds a copy of the given Association_t to this FbcAnd_t. + */ +LIBSBML_EXTERN +int +FbcAnd_addAssociation(FbcAnd_t* fa, const Association_t* a) +{ + return (fa != NULL) ? fa->addAssociation(a) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of Association_t objects in this FbcAnd_t. + */ +LIBSBML_EXTERN +unsigned int +FbcAnd_getNumAssociations(FbcAnd_t* fa) +{ + return (fa != NULL) ? fa->getNumAssociations() : SBML_INT_MAX; +} + + +/* + * Creates a new FbcAnd_t object, adds it to this FbcAnd_t object and returns + * the FbcAnd_t object created. + */ +LIBSBML_EXTERN +FbcAnd_t* +FbcAnd_createAnd(FbcAnd_t* fa) +{ + return (fa != NULL) ? fa->createAnd() : NULL; +} + + +/* + * Creates a new FbcOr_t object, adds it to this FbcAnd_t object and returns + * the FbcOr_t object created. + */ +LIBSBML_EXTERN +FbcOr_t* +FbcAnd_createOr(FbcAnd_t* fa) +{ + return (fa != NULL) ? fa->createOr() : NULL; +} + + +/* + * Creates a new GeneProductRef_t object, adds it to this FbcAnd_t object and + * returns the GeneProductRef_t object created. + */ +LIBSBML_EXTERN +GeneProductRef_t* +FbcAnd_createGeneProductRef(FbcAnd_t* fa) +{ + return (fa != NULL) ? fa->createGeneProductRef() : NULL; +} + + +/* + * Removes the nth Association_t from this FbcAnd_t and returns a pointer to + * it. + */ +LIBSBML_EXTERN +Association_t* +FbcAnd_removeAssociation(FbcAnd_t* fa, unsigned int n) +{ + return (fa != NULL) ? fa->removeAssociation(n) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * FbcAnd_t object have been set. + */ +LIBSBML_EXTERN +int +FbcAnd_hasRequiredAttributes(const FbcAnd_t * fa) +{ + return (fa != NULL) ? static_cast(fa->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * FbcAnd_t object have been set. + */ +LIBSBML_EXTERN +int +FbcAnd_hasRequiredElements(const FbcAnd_t * fa) +{ + return (fa != NULL) ? static_cast(fa->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/FbcAnd.h b/generator/tests/test_cpp_code/test-code/FbcAnd.h index 63e07bd5..b75b2a15 100644 --- a/generator/tests/test_cpp_code/test-code/FbcAnd.h +++ b/generator/tests/test_cpp_code/test-code/FbcAnd.h @@ -1,1148 +1,1148 @@ -/** - * @file FbcAnd.h - * @brief Definition of the FbcAnd class. - * @author SBMLTeam - * - * - * - * @class FbcAnd - * @sbmlbrief{fbc} TODO:Definition of the FbcAnd class. - */ - - -#ifndef FbcAnd_H__ -#define FbcAnd_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN FbcAnd : public Association -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - ListOfAssociations mAssociations; - - /** @endcond */ - -public: - - /** - * Creates a new FbcAnd using the given SBML Level, Version and - * “fbc” package version. - * - * @param level an unsigned int, the SBML Level to assign to this FbcAnd. - * - * @param version an unsigned int, the SBML Version to assign to this FbcAnd. - * - * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this - * FbcAnd. - * - * @copydetails doc_note_setting_lv_pkg - */ - FbcAnd(unsigned int level = FbcExtension::getDefaultLevel(), - unsigned int version = FbcExtension::getDefaultVersion(), - unsigned int pkgVersion = FbcExtension::getDefaultPackageVersion()); - - - /** - * Creates a new FbcAnd using the given FbcPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param fbcns the FbcPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - FbcAnd(FbcPkgNamespaces *fbcns); - - - /** - * Copy constructor for FbcAnd. - * - * @param orig the FbcAnd instance to copy. - */ - FbcAnd(const FbcAnd& orig); - - - /** - * Assignment operator for FbcAnd. - * - * @param rhs the FbcAnd object whose values are to be used as the basis of - * the assignment. - */ - FbcAnd& operator=(const FbcAnd& rhs); - - - /** - * Creates and returns a deep copy of this FbcAnd object. - * - * @return a (deep) copy of this FbcAnd object. - */ - virtual FbcAnd* clone() const; - - - /** - * Destructor for FbcAnd. - */ - virtual ~FbcAnd(); - - - /** - * Returns the ListOfAssociations from this FbcAnd. - * - * @return the ListOfAssociations from this FbcAnd. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAssociation(const Association* object) - * @see createAssociation() - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - const ListOfAssociations* getListOfAssociations() const; - - - /** - * Returns the ListOfAssociations from this FbcAnd. - * - * @return the ListOfAssociations from this FbcAnd. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAssociation(const Association* object) - * @see createAssociation() - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - ListOfAssociations* getListOfAssociations(); - - - /** - * Get an Association from the FbcAnd. - * - * @param n an unsigned int representing the index of the Association to - * retrieve. - * - * @return the nth Association in the ListOfAssociations within this FbcAnd - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAssociation(const Association* object) - * @see createAssociation() - * @see getAssociation(const std::string& sid) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - Association* getAssociation(unsigned int n); - - - /** - * Get an Association from the FbcAnd. - * - * @param n an unsigned int representing the index of the Association to - * retrieve. - * - * @return the nth Association in the ListOfAssociations within this FbcAnd - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAssociation(const Association* object) - * @see createAssociation() - * @see getAssociation(const std::string& sid) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - const Association* getAssociation(unsigned int n) const; - - - /** - * Adds a copy of the given Association to this FbcAnd. - * - * @param a the Association object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createAssociation() - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - int addAssociation(const Association* a); - - - /** - * Get the number of Association objects in this FbcAnd. - * - * @return the number of Association objects in this FbcAnd. - * - * @see addAssociation(const Association* object) - * @see createAssociation() - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - unsigned int getNumAssociations() const; - - - /** - * Creates a new FbcAnd object, adds it to this FbcAnd object and returns the - * FbcAnd object created. - * - * @return a new FbcAnd object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAssociation(const Association* object) - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - FbcAnd* createAnd(); - - - /** - * Creates a new FbcOr object, adds it to this FbcAnd object and returns the - * FbcOr object created. - * - * @return a new FbcOr object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAssociation(const Association* object) - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - FbcOr* createOr(); - - - /** - * Creates a new GeneProductRef object, adds it to this FbcAnd object and - * returns the GeneProductRef object created. - * - * @return a new GeneProductRef object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAssociation(const Association* object) - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - * @see removeAssociation(unsigned int n) - */ - GeneProductRef* createGeneProductRef(); - - - /** - * Removes the nth Association from this FbcAnd and returns a pointer to it. - * - * @param n an unsigned int representing the index of the Association to - * remove. - * - * @return a pointer to the nth Association in this FbcAnd. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addAssociation(const Association* object) - * @see createAssociation() - * @see getAssociation(const std::string& sid) - * @see getAssociation(unsigned int n) - * @see getNumAssociations() - * @see removeAssociation(const std::string& sid) - */ - Association* removeAssociation(unsigned int n); - - - /** - * Returns the XML element name of this FbcAnd object. - * - * For FbcAnd, the XML element name is always @c "and". - * - * @return the name of this element, i.e. @c "and". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this FbcAnd object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_FBC_AND, SBMLFbcTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this FbcAnd - * object have been set. - * - * @return @c true to indicate that all the required attributes of this - * FbcAnd have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this FbcAnd - * object have been set. - * - * @return @c true to indicate that all the required elements of this FbcAnd - * have been set, otherwise @c false is returned. - * - * - * @note The required elements for the FbcAnd object are: - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this FbcAnd's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this FbcAnd's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this FbcAnd. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this FbcAnd. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this FbcAnd. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * FbcAnd. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this FbcAnd. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this FbcAnd. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new FbcAnd_t using the given SBML Level, Version and - * “fbc” package version. - * - * @param level an unsigned int, the SBML Level to assign to this FbcAnd_t. - * - * @param version an unsigned int, the SBML Version to assign to this FbcAnd_t. - * - * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this - * FbcAnd_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -FbcAnd_t * -FbcAnd_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this FbcAnd_t object. - * - * @param fa the FbcAnd_t structure. - * - * @return a (deep) copy of this FbcAnd_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -FbcAnd_t* -FbcAnd_clone(const FbcAnd_t* fa); - - -/** - * Frees this FbcAnd_t object. - * - * @param fa the FbcAnd_t structure. - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -void -FbcAnd_free(FbcAnd_t* fa); - - -/** - * Returns a ListOf_t * containing Association_t objects from this FbcAnd_t. - * - * @param fa the FbcAnd_t structure whose ListOfAssociations is sought. - * - * @return the ListOfAssociations from this FbcAnd_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see FbcAnd_addAssociation() - * @see FbcAnd_createAssociation() - * @see FbcAnd_getAssociationById() - * @see FbcAnd_getAssociation() - * @see FbcAnd_getNumAssociations() - * @see FbcAnd_removeAssociationById() - * @see FbcAnd_removeAssociation() - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -ListOf_t* -FbcAnd_getListOfAssociations(FbcAnd_t* fa); - - -/** - * Get an Association_t from the FbcAnd_t. - * - * @param fa the FbcAnd_t structure to search. - * - * @param n an unsigned int representing the index of the Association_t to - * retrieve. - * - * @return the nth Association_t in the ListOfAssociations within this FbcAnd - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -Association_t* -FbcAnd_getAssociation(FbcAnd_t* fa, unsigned int n); - - -/** - * Adds a copy of the given Association_t to this FbcAnd_t. - * - * @param fa the FbcAnd_t structure to which the Association_t should be added. - * - * @param a the Association_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -int -FbcAnd_addAssociation(FbcAnd_t* fa, const Association_t* a); - - -/** - * Get the number of Association_t objects in this FbcAnd_t. - * - * @param fa the FbcAnd_t structure to query. - * - * @return the number of Association_t objects in this FbcAnd_t. - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -unsigned int -FbcAnd_getNumAssociations(FbcAnd_t* fa); - - -/** - * Creates a new FbcAnd_t object, adds it to this FbcAnd_t object and returns - * the FbcAnd_t object created. - * - * @param fa the FbcAnd_t structure to which the FbcAnd_t should be added. - * - * @return a new FbcAnd_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -FbcAnd_t* -FbcAnd_createAnd(FbcAnd_t* fa); - - -/** - * Creates a new FbcOr_t object, adds it to this FbcAnd_t object and returns - * the FbcOr_t object created. - * - * @param fa the FbcAnd_t structure to which the FbcOr_t should be added. - * - * @return a new FbcOr_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -FbcOr_t* -FbcAnd_createOr(FbcAnd_t* fa); - - -/** - * Creates a new GeneProductRef_t object, adds it to this FbcAnd_t object and - * returns the GeneProductRef_t object created. - * - * @param fa the FbcAnd_t structure to which the GeneProductRef_t should be - * added. - * - * @return a new GeneProductRef_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -GeneProductRef_t* -FbcAnd_createGeneProductRef(FbcAnd_t* fa); - - -/** - * Removes the nth Association_t from this FbcAnd_t and returns a pointer to - * it. - * - * @param fa the FbcAnd_t structure to search. - * - * @param n an unsigned int representing the index of the Association_t to - * remove. - * - * @return a pointer to the nth Association_t in this FbcAnd_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -Association_t* -FbcAnd_removeAssociation(FbcAnd_t* fa, unsigned int n); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * FbcAnd_t object have been set. - * - * @param fa the FbcAnd_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * FbcAnd_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -int -FbcAnd_hasRequiredAttributes(const FbcAnd_t * fa); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * FbcAnd_t object have been set. - * - * @param fa the FbcAnd_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * FbcAnd_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the FbcAnd_t object are: - * - * @memberof FbcAnd_t - */ -LIBSBML_EXTERN -int -FbcAnd_hasRequiredElements(const FbcAnd_t * fa); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !FbcAnd_H__ */ - - +/** + * @file FbcAnd.h + * @brief Definition of the FbcAnd class. + * @author SBMLTeam + * + * + * + * @class FbcAnd + * @sbmlbrief{fbc} TODO:Definition of the FbcAnd class. + */ + + +#ifndef FbcAnd_H__ +#define FbcAnd_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN FbcAnd : public Association +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + ListOfAssociations mAssociations; + + /** @endcond */ + +public: + + /** + * Creates a new FbcAnd using the given SBML Level, Version and + * “fbc” package version. + * + * @param level an unsigned int, the SBML Level to assign to this FbcAnd. + * + * @param version an unsigned int, the SBML Version to assign to this FbcAnd. + * + * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this + * FbcAnd. + * + * @copydetails doc_note_setting_lv_pkg + */ + FbcAnd(unsigned int level = FbcExtension::getDefaultLevel(), + unsigned int version = FbcExtension::getDefaultVersion(), + unsigned int pkgVersion = FbcExtension::getDefaultPackageVersion()); + + + /** + * Creates a new FbcAnd using the given FbcPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param fbcns the FbcPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + FbcAnd(FbcPkgNamespaces *fbcns); + + + /** + * Copy constructor for FbcAnd. + * + * @param orig the FbcAnd instance to copy. + */ + FbcAnd(const FbcAnd& orig); + + + /** + * Assignment operator for FbcAnd. + * + * @param rhs the FbcAnd object whose values are to be used as the basis of + * the assignment. + */ + FbcAnd& operator=(const FbcAnd& rhs); + + + /** + * Creates and returns a deep copy of this FbcAnd object. + * + * @return a (deep) copy of this FbcAnd object. + */ + virtual FbcAnd* clone() const; + + + /** + * Destructor for FbcAnd. + */ + virtual ~FbcAnd(); + + + /** + * Returns the ListOfAssociations from this FbcAnd. + * + * @return the ListOfAssociations from this FbcAnd. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAssociation(const Association* object) + * @see createAssociation() + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + const ListOfAssociations* getListOfAssociations() const; + + + /** + * Returns the ListOfAssociations from this FbcAnd. + * + * @return the ListOfAssociations from this FbcAnd. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAssociation(const Association* object) + * @see createAssociation() + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + ListOfAssociations* getListOfAssociations(); + + + /** + * Get an Association from the FbcAnd. + * + * @param n an unsigned int representing the index of the Association to + * retrieve. + * + * @return the nth Association in the ListOfAssociations within this FbcAnd + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAssociation(const Association* object) + * @see createAssociation() + * @see getAssociation(const std::string& sid) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + Association* getAssociation(unsigned int n); + + + /** + * Get an Association from the FbcAnd. + * + * @param n an unsigned int representing the index of the Association to + * retrieve. + * + * @return the nth Association in the ListOfAssociations within this FbcAnd + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAssociation(const Association* object) + * @see createAssociation() + * @see getAssociation(const std::string& sid) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + const Association* getAssociation(unsigned int n) const; + + + /** + * Adds a copy of the given Association to this FbcAnd. + * + * @param a the Association object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createAssociation() + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + int addAssociation(const Association* a); + + + /** + * Get the number of Association objects in this FbcAnd. + * + * @return the number of Association objects in this FbcAnd. + * + * @see addAssociation(const Association* object) + * @see createAssociation() + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + unsigned int getNumAssociations() const; + + + /** + * Creates a new FbcAnd object, adds it to this FbcAnd object and returns the + * FbcAnd object created. + * + * @return a new FbcAnd object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAssociation(const Association* object) + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + FbcAnd* createAnd(); + + + /** + * Creates a new FbcOr object, adds it to this FbcAnd object and returns the + * FbcOr object created. + * + * @return a new FbcOr object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAssociation(const Association* object) + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + FbcOr* createOr(); + + + /** + * Creates a new GeneProductRef object, adds it to this FbcAnd object and + * returns the GeneProductRef object created. + * + * @return a new GeneProductRef object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAssociation(const Association* object) + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + * @see removeAssociation(unsigned int n) + */ + GeneProductRef* createGeneProductRef(); + + + /** + * Removes the nth Association from this FbcAnd and returns a pointer to it. + * + * @param n an unsigned int representing the index of the Association to + * remove. + * + * @return a pointer to the nth Association in this FbcAnd. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addAssociation(const Association* object) + * @see createAssociation() + * @see getAssociation(const std::string& sid) + * @see getAssociation(unsigned int n) + * @see getNumAssociations() + * @see removeAssociation(const std::string& sid) + */ + Association* removeAssociation(unsigned int n); + + + /** + * Returns the XML element name of this FbcAnd object. + * + * For FbcAnd, the XML element name is always @c "and". + * + * @return the name of this element, i.e. @c "and". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this FbcAnd object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_FBC_AND, SBMLFbcTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this FbcAnd + * object have been set. + * + * @return @c true to indicate that all the required attributes of this + * FbcAnd have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this FbcAnd + * object have been set. + * + * @return @c true to indicate that all the required elements of this FbcAnd + * have been set, otherwise @c false is returned. + * + * + * @note The required elements for the FbcAnd object are: + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this FbcAnd's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this FbcAnd's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this FbcAnd. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this FbcAnd. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this FbcAnd. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * FbcAnd. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this FbcAnd. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this FbcAnd. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new FbcAnd_t using the given SBML Level, Version and + * “fbc” package version. + * + * @param level an unsigned int, the SBML Level to assign to this FbcAnd_t. + * + * @param version an unsigned int, the SBML Version to assign to this FbcAnd_t. + * + * @param pkgVersion an unsigned int, the SBML Fbc Version to assign to this + * FbcAnd_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +FbcAnd_t * +FbcAnd_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this FbcAnd_t object. + * + * @param fa the FbcAnd_t structure. + * + * @return a (deep) copy of this FbcAnd_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +FbcAnd_t* +FbcAnd_clone(const FbcAnd_t* fa); + + +/** + * Frees this FbcAnd_t object. + * + * @param fa the FbcAnd_t structure. + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +void +FbcAnd_free(FbcAnd_t* fa); + + +/** + * Returns a ListOf_t * containing Association_t objects from this FbcAnd_t. + * + * @param fa the FbcAnd_t structure whose ListOfAssociations is sought. + * + * @return the ListOfAssociations from this FbcAnd_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see FbcAnd_addAssociation() + * @see FbcAnd_createAssociation() + * @see FbcAnd_getAssociationById() + * @see FbcAnd_getAssociation() + * @see FbcAnd_getNumAssociations() + * @see FbcAnd_removeAssociationById() + * @see FbcAnd_removeAssociation() + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +ListOf_t* +FbcAnd_getListOfAssociations(FbcAnd_t* fa); + + +/** + * Get an Association_t from the FbcAnd_t. + * + * @param fa the FbcAnd_t structure to search. + * + * @param n an unsigned int representing the index of the Association_t to + * retrieve. + * + * @return the nth Association_t in the ListOfAssociations within this FbcAnd + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +Association_t* +FbcAnd_getAssociation(FbcAnd_t* fa, unsigned int n); + + +/** + * Adds a copy of the given Association_t to this FbcAnd_t. + * + * @param fa the FbcAnd_t structure to which the Association_t should be added. + * + * @param a the Association_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +int +FbcAnd_addAssociation(FbcAnd_t* fa, const Association_t* a); + + +/** + * Get the number of Association_t objects in this FbcAnd_t. + * + * @param fa the FbcAnd_t structure to query. + * + * @return the number of Association_t objects in this FbcAnd_t. + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +unsigned int +FbcAnd_getNumAssociations(FbcAnd_t* fa); + + +/** + * Creates a new FbcAnd_t object, adds it to this FbcAnd_t object and returns + * the FbcAnd_t object created. + * + * @param fa the FbcAnd_t structure to which the FbcAnd_t should be added. + * + * @return a new FbcAnd_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +FbcAnd_t* +FbcAnd_createAnd(FbcAnd_t* fa); + + +/** + * Creates a new FbcOr_t object, adds it to this FbcAnd_t object and returns + * the FbcOr_t object created. + * + * @param fa the FbcAnd_t structure to which the FbcOr_t should be added. + * + * @return a new FbcOr_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +FbcOr_t* +FbcAnd_createOr(FbcAnd_t* fa); + + +/** + * Creates a new GeneProductRef_t object, adds it to this FbcAnd_t object and + * returns the GeneProductRef_t object created. + * + * @param fa the FbcAnd_t structure to which the GeneProductRef_t should be + * added. + * + * @return a new GeneProductRef_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +GeneProductRef_t* +FbcAnd_createGeneProductRef(FbcAnd_t* fa); + + +/** + * Removes the nth Association_t from this FbcAnd_t and returns a pointer to + * it. + * + * @param fa the FbcAnd_t structure to search. + * + * @param n an unsigned int representing the index of the Association_t to + * remove. + * + * @return a pointer to the nth Association_t in this FbcAnd_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +Association_t* +FbcAnd_removeAssociation(FbcAnd_t* fa, unsigned int n); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * FbcAnd_t object have been set. + * + * @param fa the FbcAnd_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * FbcAnd_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +int +FbcAnd_hasRequiredAttributes(const FbcAnd_t * fa); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * FbcAnd_t object have been set. + * + * @param fa the FbcAnd_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * FbcAnd_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the FbcAnd_t object are: + * + * @memberof FbcAnd_t + */ +LIBSBML_EXTERN +int +FbcAnd_hasRequiredElements(const FbcAnd_t * fa); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !FbcAnd_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Fred.cpp b/generator/tests/test_cpp_code/test-code/Fred.cpp index 4d71156d..9c5472a8 100644 --- a/generator/tests/test_cpp_code/test-code/Fred.cpp +++ b/generator/tests/test_cpp_code/test-code/Fred.cpp @@ -1,2451 +1,2451 @@ -/** - * @file Fred.cpp - * @brief Implementation of the Fred class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Fred using the given SBML Level, Version and “x” - * package version. - */ -Fred::Fred(unsigned int level, unsigned int version, unsigned int pkgVersion) - : SBase(level, version) - , mBol (false) - , mIsSetBol (false) - , mNum (SBML_INT_MAX) - , mIsSetNum (false) - , mStr ("") - , mMyEnum (X_KIND_INVALID) - , mOther (NULL) - , mOther1 (NULL) - , mMyOther (NULL) -{ - setSBMLNamespacesAndOwn(new XPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new Fred using the given XPkgNamespaces object. - */ -Fred::Fred(XPkgNamespaces *xns) - : SBase(xns) - , mBol (false) - , mIsSetBol (false) - , mNum (SBML_INT_MAX) - , mIsSetNum (false) - , mStr ("") - , mMyEnum (X_KIND_INVALID) - , mOther (NULL) - , mOther1 (NULL) - , mMyOther (NULL) -{ - setElementNamespace(xns->getURI()); - connectToChild(); - loadPlugins(xns); -} - - -/* - * Copy constructor for Fred. - */ -Fred::Fred(const Fred& orig) - : SBase( orig ) - , mBol ( orig.mBol ) - , mIsSetBol ( orig.mIsSetBol ) - , mNum ( orig.mNum ) - , mIsSetNum ( orig.mIsSetNum ) - , mStr ( orig.mStr ) - , mMyEnum ( orig.mMyEnum ) - , mOther ( NULL ) - , mOther1 ( NULL ) - , mMyOther ( NULL ) -{ - if (orig.mOther != NULL) - { - mOther = orig.mOther->clone(); - } - - if (orig.mOther1 != NULL) - { - mOther1 = orig.mOther1->clone(); - } - - if (orig.mMyOther != NULL) - { - mMyOther = orig.mMyOther->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for Fred. - */ -Fred& -Fred::operator=(const Fred& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mBol = rhs.mBol; - mIsSetBol = rhs.mIsSetBol; - mNum = rhs.mNum; - mIsSetNum = rhs.mIsSetNum; - mStr = rhs.mStr; - mMyEnum = rhs.mMyEnum; - delete mOther; - if (rhs.mOther != NULL) - { - mOther = rhs.mOther->clone(); - } - else - { - mOther = NULL; - } - - delete mOther1; - if (rhs.mOther1 != NULL) - { - mOther1 = rhs.mOther1->clone(); - } - else - { - mOther1 = NULL; - } - - delete mMyOther; - if (rhs.mMyOther != NULL) - { - mMyOther = rhs.mMyOther->clone(); - } - else - { - mMyOther = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Fred object. - */ -Fred* -Fred::clone() const -{ - return new Fred(*this); -} - - -/* - * Destructor for Fred. - */ -Fred::~Fred() -{ - delete mOther; - mOther = NULL; - delete mOther1; - mOther1 = NULL; - delete mMyOther; - mMyOther = NULL; -} - - -/* - * Returns the value of the "identifier" attribute of this Fred. - */ -const std::string& -Fred::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "myBoolean" attribute of this Fred. - */ -bool -Fred::getBol() const -{ - return mBol; -} - - -/* - * Returns the value of the "myNumber" attribute of this Fred. - */ -int -Fred::getNum() const -{ - return mNum; -} - - -/* - * Returns the value of the "myString" attribute of this Fred. - */ -const std::string& -Fred::getStr() const -{ - return mStr; -} - - -/* - * Returns the value of the "myEnum" attribute of this Fred. - */ -Kind_t -Fred::getMyEnum() const -{ - return mMyEnum; -} - - -/* - * Returns the value of the "myEnum" attribute of this Fred. - */ -std::string -Fred::getMyEnumAsString() const -{ - std::string code_str = Kind_toString(mMyEnum); - return code_str; -} - - -/* - * Predicate returning @c true if this Fred's "identifier" attribute is set. - */ -bool -Fred::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this Fred's "myBoolean" attribute is set. - */ -bool -Fred::isSetBol() const -{ - return mIsSetBol; -} - - -/* - * Predicate returning @c true if this Fred's "myNumber" attribute is set. - */ -bool -Fred::isSetNum() const -{ - return mIsSetNum; -} - - -/* - * Predicate returning @c true if this Fred's "myString" attribute is set. - */ -bool -Fred::isSetStr() const -{ - return (mStr.empty() == false); -} - - -/* - * Predicate returning @c true if this Fred's "myEnum" attribute is set. - */ -bool -Fred::isSetMyEnum() const -{ - return (mMyEnum != X_KIND_INVALID); -} - - -/* - * Sets the value of the "identifier" attribute of this Fred. - */ -int -Fred::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "myBoolean" attribute of this Fred. - */ -int -Fred::setBol(bool bol) -{ - mBol = bol; - mIsSetBol = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "myNumber" attribute of this Fred. - */ -int -Fred::setNum(int num) -{ - mNum = num; - mIsSetNum = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "myString" attribute of this Fred. - */ -int -Fred::setStr(const std::string& str) -{ - mStr = str; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "myEnum" attribute of this Fred. - */ -int -Fred::setMyEnum(const Kind_t kind) -{ - if (Kind_isValid(kind) == 0) - { - mMyEnum = X_KIND_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mMyEnum = kind; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "myEnum" attribute of this Fred. - */ -int -Fred::setMyEnum(const std::string& kind) -{ - mMyEnum = Kind_fromString(kind.c_str()); - - if (mMyEnum == X_KIND_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "identifier" attribute of this Fred. - */ -int -Fred::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "myBoolean" attribute of this Fred. - */ -int -Fred::unsetBol() -{ - mBol = false; - mIsSetBol = false; - - if (isSetBol() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "myNumber" attribute of this Fred. - */ -int -Fred::unsetNum() -{ - mNum = SBML_INT_MAX; - mIsSetNum = false; - - if (isSetNum() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "myString" attribute of this Fred. - */ -int -Fred::unsetStr() -{ - mStr.erase(); - - if (mStr.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "myEnum" attribute of this Fred. - */ -int -Fred::unsetMyEnum() -{ - mMyEnum = X_KIND_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the value of the "other" element of this Fred. - */ -const Other* -Fred::getOther() const -{ - return mOther; -} - - -/* - * Returns the value of the "other" element of this Fred. - */ -Other* -Fred::getOther() -{ - return mOther; -} - - -/* - * Returns the value of the "other1" element of this Fred. - */ -const Other* -Fred::getOther1() const -{ - return mOther1; -} - - -/* - * Returns the value of the "other1" element of this Fred. - */ -Other* -Fred::getOther1() -{ - return mOther1; -} - - -/* - * Returns the value of the "myOther" element of this Fred. - */ -const Other* -Fred::getMyOther() const -{ - return mMyOther; -} - - -/* - * Returns the value of the "myOther" element of this Fred. - */ -Other* -Fred::getMyOther() -{ - return mMyOther; -} - - -/* - * Predicate returning @c true if this Fred's "other" element is set. - */ -bool -Fred::isSetOther() const -{ - return (mOther != NULL); -} - - -/* - * Predicate returning @c true if this Fred's "other1" element is set. - */ -bool -Fred::isSetOther1() const -{ - return (mOther1 != NULL); -} - - -/* - * Predicate returning @c true if this Fred's "myOther" element is set. - */ -bool -Fred::isSetMyOther() const -{ - return (mMyOther != NULL); -} - - -/* - * Sets the value of the "other" element of this Fred. - */ -int -Fred::setOther(const Other* other) -{ - if (mOther == other) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (other == NULL) - { - delete mOther; - mOther = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mOther; - mOther = (other != NULL) ? other->clone() : NULL; - if (mOther != NULL) - { - mOther->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "other1" element of this Fred. - */ -int -Fred::setOther1(const Other* other1) -{ - if (mOther1 == other1) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (other1 == NULL) - { - delete mOther1; - mOther1 = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mOther1; - mOther1 = (other1 != NULL) ? other1->clone() : NULL; - if (mOther1 != NULL) - { - mOther1->setElementName("other1"); - mOther1->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "myOther" element of this Fred. - */ -int -Fred::setMyOther(const Other* other2) -{ - if (mMyOther == other2) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (other2 == NULL) - { - delete mMyOther; - mMyOther = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mMyOther; - mMyOther = (other2 != NULL) ? other2->clone() : NULL; - if (mMyOther != NULL) - { - mMyOther->setElementName("myOther"); - mMyOther->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new Other object, adds it to this Fred object and returns the - * Other object created. - */ -Other* -Fred::createOther() -{ - if (mOther != NULL) - { - delete mOther; - } - - X_CREATE_NS(xns, getSBMLNamespaces()); - mOther = new Other(xns); - - delete xns; - - connectToChild(); - - return mOther; -} - - -/* - * Creates a new Other object, adds it to this Fred object and returns the - * Other object created. - */ -Other* -Fred::createOther1() -{ - if (mOther1 != NULL) - { - delete mOther1; - } - - X_CREATE_NS(xns, getSBMLNamespaces()); - mOther1 = new Other(xns); - - mOther1->setElementName("other1"); - - delete xns; - - connectToChild(); - - return mOther1; -} - - -/* - * Creates a new Other object, adds it to this Fred object and returns the - * Other object created. - */ -Other* -Fred::createMyOther() -{ - if (mMyOther != NULL) - { - delete mMyOther; - } - - X_CREATE_NS(xns, getSBMLNamespaces()); - mMyOther = new Other(xns); - - mMyOther->setElementName("myOther"); - - delete xns; - - connectToChild(); - - return mMyOther; -} - - -/* - * Unsets the value of the "other" element of this Fred. - */ -int -Fred::unsetOther() -{ - delete mOther; - mOther = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "other1" element of this Fred. - */ -int -Fred::unsetOther1() -{ - delete mOther1; - mOther1 = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "myOther" element of this Fred. - */ -int -Fred::unsetMyOther() -{ - delete mMyOther; - mMyOther = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this Fred object. - */ -const std::string& -Fred::getElementName() const -{ - static const string name = "fred"; - return name; -} - - -/* - * Returns the libSBML type code for this Fred object. - */ -int -Fred::getTypeCode() const -{ - return SBML_X_FRED; -} - - -/* - * Predicate returning @c true if all the required attributes for this Fred - * object have been set. - */ -bool -Fred::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - if (isSetNum() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Fred::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetOther() == true) - { - mOther->write(stream); - } - - if (isSetOther1() == true) - { - mOther1->write(stream); - } - - if (isSetMyOther() == true) - { - mMyOther->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Fred::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mOther != NULL) - { - mOther->accept(v); - } - - if (mOther1 != NULL) - { - mOther1->accept(v); - } - - if (mMyOther != NULL) - { - mMyOther->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Fred::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mOther != NULL) - { - mOther->setSBMLDocument(d); - } - - if (mOther1 != NULL) - { - mOther1->setSBMLDocument(d); - } - - if (mMyOther != NULL) - { - mMyOther->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Fred::connectToChild() -{ - SBase::connectToChild(); - - if (mOther != NULL) - { - mOther->connectToParent(this); - } - - if (mOther1 != NULL) - { - mOther1->connectToParent(this); - } - - if (mMyOther != NULL) - { - mMyOther->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Fred::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetOther()) - { - mOther->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - if (isSetOther1()) - { - mOther1->enablePackageInternal(pkgURI, pkgPrefix, flag); - } - - if (isSetMyOther()) - { - mMyOther->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -Fred::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mOther != NULL) - { - mOther->updateSBMLNamespace(package, level, version); - } - - if (mOther1 != NULL) - { - mOther1->updateSBMLNamespace(package, level, version); - } - - if (mMyOther != NULL) - { - mMyOther->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "myBoolean") - { - value = getBol(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "myNumber") - { - value = getNum(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::getAttribute(const std::string& attributeName, std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "identifier") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "myString") - { - value = getStr(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "myEnum") - { - value = getMyEnumAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Fred's attribute "attributeName" is set. - */ -bool -Fred::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "identifier") - { - value = isSetId(); - } - else if (attributeName == "myBoolean") - { - value = isSetBol(); - } - else if (attributeName == "myNumber") - { - value = isSetNum(); - } - else if (attributeName == "myString") - { - value = isSetStr(); - } - else if (attributeName == "myEnum") - { - value = isSetMyEnum(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "myBoolean") - { - return_value = setBol(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "myNumber") - { - return_value = setNum(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::setAttribute(const std::string& attributeName, const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "identifier") - { - return_value = setId(value); - } - else if (attributeName == "myString") - { - return_value = setStr(value); - } - else if (attributeName == "myEnum") - { - return_value = setMyEnum(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Fred. - */ -int -Fred::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "identifier") - { - value = unsetId(); - } - else if (attributeName == "myBoolean") - { - value = unsetBol(); - } - else if (attributeName == "myNumber") - { - value = unsetNum(); - } - else if (attributeName == "myString") - { - value = unsetStr(); - } - else if (attributeName == "myEnum") - { - value = unsetMyEnum(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this Fred. - */ -SBase* -Fred::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "other") - { - return createOther(); - } - else if (elementName == "other1") - { - return createOther1(); - } - else if (elementName == "other2") - { - return createMyOther(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this Fred. - */ -int -Fred::addChildObject(const std::string& elementName, const SBase* element) -{ - if (elementName == "other" && element->getTypeCode() == SBML_X_OTHER) - { - return setOther((const Other*)(element)); - } - else if (elementName == "other1" && element->getTypeCode() == SBML_X_OTHER) - { - return setOther1((const Other*)(element)); - } - else if (elementName == "other2" && element->getTypeCode() == SBML_X_OTHER) - { - return setMyOther((const Other*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Fred. - */ -SBase* -Fred::removeChildObject(const std::string& elementName, const std::string& id) -{ - if (elementName == "other") - { - Other * obj = mOther; - mOther = NULL; return obj; - } - else if (elementName == "other1") - { - Other * obj = mOther1; - mOther1 = NULL; return obj; - } - else if (elementName == "other2") - { - Other * obj = mMyOther; - mMyOther = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this Fred. - */ -unsigned int -Fred::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "other") - { - if (isSetOther()) - { - return 1; - } - } - else if (elementName == "other1") - { - if (isSetOther1()) - { - return 1; - } - } - else if (elementName == "other2") - { - if (isSetMyOther()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this Fred. - */ -SBase* -Fred::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "other") - { - return getOther(); - } - else if (elementName == "other1") - { - return getOther1(); - } - else if (elementName == "other2") - { - return getMyOther(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -Fred::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mOther != NULL) - { - if (mOther->getId() == id) - { - return mOther; - } - - obj = mOther->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mOther1 != NULL) - { - if (mOther1->getId() == id) - { - return mOther1; - } - - obj = mOther1->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - if (mMyOther != NULL) - { - if (mMyOther->getId() == id) - { - return mMyOther; - } - - obj = mMyOther->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -Fred::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mOther != NULL) - { - if (mOther->getMetaId() == metaid) - { - return mOther; - } - - obj = mOther->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mOther1 != NULL) - { - if (mOther1->getMetaId() == metaid) - { - return mOther1; - } - - obj = mOther1->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - if (mMyOther != NULL) - { - if (mMyOther->getMetaId() == metaid) - { - return mMyOther; - } - - obj = mMyOther->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -Fred::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mOther, filter); - ADD_FILTERED_POINTER(ret, sublist, mOther1, filter); - ADD_FILTERED_POINTER(ret, sublist, mMyOther, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -Fred::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - X_CREATE_NS(xns, getSBMLNamespaces()); - - if (name == "other") - { - if (getErrorLog() && isSetOther()) - { - getErrorLog()->logPackageError("x", XFredAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mOther; - mOther = new Other(xns); - obj = mOther; - } - else if (name == "other1") - { - if (getErrorLog() && isSetOther1()) - { - getErrorLog()->logPackageError("x", XFredAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mOther1; - mOther1 = new Other(xns); - mOther1->setElementName(name); - obj = mOther1; - } - else if (name == "myOther") - { - if (getErrorLog() && isSetMyOther()) - { - getErrorLog()->logPackageError("x", XFredAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - delete mMyOther; - mMyOther = new Other(xns); - mMyOther->setElementName(name); - obj = mMyOther; - } - - delete xns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Fred::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("identifier"); - - attributes.add("myBoolean"); - - attributes.add("myNumber"); - - attributes.add("myString"); - - attributes.add("myEnum"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Fred::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("x", XFredAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("x", XFredAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } - - // - // identifier SId (use = "required" ) - // - - assigned = attributes.readInto("identifier", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("x", XIdSyntaxRule, pkgVersion, level, version, "The " - "id on the <" + getElementName() + "> is '" + mId + "', which does not " - "conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "X attribute 'identifier' is missing from the " - " element."; - log->logPackageError("x", XFredAllowedAttributes, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } - - // - // myBoolean bool (use = "optional" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetBol = attributes.readInto("myBoolean", mBol); - - if (mIsSetBol == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("x", XFredBolMustBeBoolean, pkgVersion, level, - version); - } - } - - // - // myNumber int (use = "required" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetNum = attributes.readInto("myNumber", mNum); - - if ( mIsSetNum == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "X attribute 'myNumber' from the element " - "must be an integer."; - log->logPackageError("x", XFredNumMustBeInteger, pkgVersion, level, - version, message, getLine(), getColumn()); - } - else - { - std::string message = "X attribute 'myNumber' is missing from the " - "element."; - log->logPackageError("x", XFredAllowedAttributes, pkgVersion, level, - version, message, getLine(), getColumn()); - } - } - - // - // myString string (use = "optional" ) - // - - assigned = attributes.readInto("myString", mStr); - - if (assigned == true) - { - if (mStr.empty() == true) - { - logEmptyString(mStr, level, version, ""); - } - } - - // - // myEnum enum (use = "optional" ) - // - - std::string kind; - assigned = attributes.readInto("myEnum", kind); - - if (assigned == true) - { - if (kind.empty() == true) - { - logEmptyString(kind, level, version, ""); - } - else - { - mMyEnum = Kind_fromString(kind.c_str()); - - if (log && Kind_isValid(mMyEnum) == 0) - { - std::string msg = "The myEnum on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + kind + "', which is not a valid option."; - - log->logPackageError("x", XFredKindMustBeKindEnum, pkgVersion, level, - version, msg, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Fred::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("identifier", getPrefix(), mId); - } - - if (isSetBol() == true) - { - stream.writeAttribute("myBoolean", getPrefix(), mBol); - } - - if (isSetNum() == true) - { - stream.writeAttribute("myNumber", getPrefix(), mNum); - } - - if (isSetStr() == true) - { - stream.writeAttribute("myString", getPrefix(), mStr); - } - - if (isSetMyEnum() == true) - { - stream.writeAttribute("myEnum", getPrefix(), Kind_toString(mMyEnum)); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Fred_t using the given SBML Level, Version and “x” - * package version. - */ -LIBSBML_EXTERN -Fred_t * -Fred_create(unsigned int level, unsigned int version, unsigned int pkgVersion) -{ - return new Fred(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Fred_t object. - */ -LIBSBML_EXTERN -Fred_t* -Fred_clone(const Fred_t* f) -{ - if (f != NULL) - { - return static_cast(f->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Fred_t object. - */ -LIBSBML_EXTERN -void -Fred_free(Fred_t* f) -{ - if (f != NULL) - { - delete f; - } -} - - -/* - * Returns the value of the "identifier" attribute of this Fred_t. - */ -LIBSBML_EXTERN -char * -Fred_getId(const Fred_t * f) -{ - if (f == NULL) - { - return NULL; - } - - return f->getId().empty() ? NULL : safe_strdup(f->getId().c_str()); -} - - -/* - * Returns the value of the "myBoolean" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_getBol(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->getBol()) : 0; -} - - -/* - * Returns the value of the "myNumber" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_getNum(const Fred_t * f) -{ - return (f != NULL) ? f->getNum() : SBML_INT_MAX; -} - - -/* - * Returns the value of the "myString" attribute of this Fred_t. - */ -LIBSBML_EXTERN -char * -Fred_getStr(const Fred_t * f) -{ - if (f == NULL) - { - return NULL; - } - - return f->getStr().empty() ? NULL : safe_strdup(f->getStr().c_str()); -} - - -/* - * Returns the value of the "myEnum" attribute of this Fred_t. - */ -LIBSBML_EXTERN -Kind_t -Fred_getMyEnum(const Fred_t * f) -{ - if (f == NULL) - { - return X_KIND_INVALID; - } - - return f->getMyEnum(); -} - - -/* - * Returns the value of the "myEnum" attribute of this Fred_t. - */ -LIBSBML_EXTERN -char * -Fred_getMyEnumAsString(const Fred_t * f) -{ - return (char*)(Kind_toString(f->getMyEnum())); -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "identifier" attribute is - * set. - */ -LIBSBML_EXTERN -int -Fred_isSetId(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "myBoolean" attribute is - * set. - */ -LIBSBML_EXTERN -int -Fred_isSetBol(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetBol()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "myNumber" attribute is - * set. - */ -LIBSBML_EXTERN -int -Fred_isSetNum(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetNum()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "myString" attribute is - * set. - */ -LIBSBML_EXTERN -int -Fred_isSetStr(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetStr()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "myEnum" attribute is set. - */ -LIBSBML_EXTERN -int -Fred_isSetMyEnum(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetMyEnum()) : 0; -} - - -/* - * Sets the value of the "identifier" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setId(Fred_t * f, const char * id) -{ - return (f != NULL) ? f->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "myBoolean" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setBol(Fred_t * f, int bol) -{ - return (f != NULL) ? f->setBol(bol) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "myNumber" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setNum(Fred_t * f, int num) -{ - return (f != NULL) ? f->setNum(num) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "myString" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setStr(Fred_t * f, const char * str) -{ - return (f != NULL) ? f->setStr(str) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "myEnum" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setMyEnum(Fred_t * f, Kind_t kind) -{ - return (f != NULL) ? f->setMyEnum(kind) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "myEnum" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setMyEnumAsString(Fred_t * f, const char * kind) -{ - return (f != NULL) ? f->setMyEnum(kind): LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "identifier" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetId(Fred_t * f) -{ - return (f != NULL) ? f->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "myBoolean" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetBol(Fred_t * f) -{ - return (f != NULL) ? f->unsetBol() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "myNumber" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetNum(Fred_t * f) -{ - return (f != NULL) ? f->unsetNum() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "myString" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetStr(Fred_t * f) -{ - return (f != NULL) ? f->unsetStr() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "myEnum" attribute of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetMyEnum(Fred_t * f) -{ - return (f != NULL) ? f->unsetMyEnum() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "other" element of this Fred_t. - */ -LIBSBML_EXTERN -const Other_t* -Fred_getOther(const Fred_t * f) -{ - if (f == NULL) - { - return NULL; - } - - return (Other_t*)(f->getOther()); -} - - -/* - * Returns the value of the "other1" element of this Fred_t. - */ -LIBSBML_EXTERN -const Other_t* -Fred_getOther1(const Fred_t * f) -{ - if (f == NULL) - { - return NULL; - } - - return (Other_t*)(f->getOther1()); -} - - -/* - * Returns the value of the "myOther" element of this Fred_t. - */ -LIBSBML_EXTERN -const Other_t* -Fred_getMyOther(const Fred_t * f) -{ - if (f == NULL) - { - return NULL; - } - - return (Other_t*)(f->getMyOther()); -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "other" element is set. - */ -LIBSBML_EXTERN -int -Fred_isSetOther(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetOther()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "other1" element is set. - */ -LIBSBML_EXTERN -int -Fred_isSetOther1(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetOther1()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Fred_t's "myOther" element is set. - */ -LIBSBML_EXTERN -int -Fred_isSetMyOther(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->isSetMyOther()) : 0; -} - - -/* - * Sets the value of the "other" element of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setOther(Fred_t * f, const Other_t* other) -{ - return (f != NULL) ? f->setOther(other) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "other1" element of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setOther1(Fred_t * f, const Other_t* other1) -{ - return (f != NULL) ? f->setOther1(other1) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "myOther" element of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_setMyOther(Fred_t * f, const Other_t* other2) -{ - return (f != NULL) ? f->setMyOther(other2) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new Other_t object, adds it to this Fred_t object and returns the - * Other_t object created. - */ -LIBSBML_EXTERN -Other_t* -Fred_createOther(Fred_t* f) -{ - if (f == NULL) - { - return NULL; - } - - return (Other_t*)(f->createOther()); -} - - -/* - * Creates a new Other_t object, adds it to this Fred_t object and returns the - * Other_t object created. - */ -LIBSBML_EXTERN -Other_t* -Fred_createOther1(Fred_t* f) -{ - if (f == NULL) - { - return NULL; - } - - return (Other_t*)(f->createOther1()); -} - - -/* - * Creates a new Other_t object, adds it to this Fred_t object and returns the - * Other_t object created. - */ -LIBSBML_EXTERN -Other_t* -Fred_createMyOther(Fred_t* f) -{ - if (f == NULL) - { - return NULL; - } - - return (Other_t*)(f->createMyOther()); -} - - -/* - * Unsets the value of the "other" element of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetOther(Fred_t * f) -{ - return (f != NULL) ? f->unsetOther() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "other1" element of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetOther1(Fred_t * f) -{ - return (f != NULL) ? f->unsetOther1() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "myOther" element of this Fred_t. - */ -LIBSBML_EXTERN -int -Fred_unsetMyOther(Fred_t * f) -{ - return (f != NULL) ? f->unsetMyOther() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Fred_t object have been set. - */ -LIBSBML_EXTERN -int -Fred_hasRequiredAttributes(const Fred_t * f) -{ - return (f != NULL) ? static_cast(f->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Fred.cpp + * @brief Implementation of the Fred class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Fred using the given SBML Level, Version and “x” + * package version. + */ +Fred::Fred(unsigned int level, unsigned int version, unsigned int pkgVersion) + : SBase(level, version) + , mBol (false) + , mIsSetBol (false) + , mNum (SBML_INT_MAX) + , mIsSetNum (false) + , mStr ("") + , mMyEnum (X_KIND_INVALID) + , mOther (NULL) + , mOther1 (NULL) + , mMyOther (NULL) +{ + setSBMLNamespacesAndOwn(new XPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new Fred using the given XPkgNamespaces object. + */ +Fred::Fred(XPkgNamespaces *xns) + : SBase(xns) + , mBol (false) + , mIsSetBol (false) + , mNum (SBML_INT_MAX) + , mIsSetNum (false) + , mStr ("") + , mMyEnum (X_KIND_INVALID) + , mOther (NULL) + , mOther1 (NULL) + , mMyOther (NULL) +{ + setElementNamespace(xns->getURI()); + connectToChild(); + loadPlugins(xns); +} + + +/* + * Copy constructor for Fred. + */ +Fred::Fred(const Fred& orig) + : SBase( orig ) + , mBol ( orig.mBol ) + , mIsSetBol ( orig.mIsSetBol ) + , mNum ( orig.mNum ) + , mIsSetNum ( orig.mIsSetNum ) + , mStr ( orig.mStr ) + , mMyEnum ( orig.mMyEnum ) + , mOther ( NULL ) + , mOther1 ( NULL ) + , mMyOther ( NULL ) +{ + if (orig.mOther != NULL) + { + mOther = orig.mOther->clone(); + } + + if (orig.mOther1 != NULL) + { + mOther1 = orig.mOther1->clone(); + } + + if (orig.mMyOther != NULL) + { + mMyOther = orig.mMyOther->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for Fred. + */ +Fred& +Fred::operator=(const Fred& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mBol = rhs.mBol; + mIsSetBol = rhs.mIsSetBol; + mNum = rhs.mNum; + mIsSetNum = rhs.mIsSetNum; + mStr = rhs.mStr; + mMyEnum = rhs.mMyEnum; + delete mOther; + if (rhs.mOther != NULL) + { + mOther = rhs.mOther->clone(); + } + else + { + mOther = NULL; + } + + delete mOther1; + if (rhs.mOther1 != NULL) + { + mOther1 = rhs.mOther1->clone(); + } + else + { + mOther1 = NULL; + } + + delete mMyOther; + if (rhs.mMyOther != NULL) + { + mMyOther = rhs.mMyOther->clone(); + } + else + { + mMyOther = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Fred object. + */ +Fred* +Fred::clone() const +{ + return new Fred(*this); +} + + +/* + * Destructor for Fred. + */ +Fred::~Fred() +{ + delete mOther; + mOther = NULL; + delete mOther1; + mOther1 = NULL; + delete mMyOther; + mMyOther = NULL; +} + + +/* + * Returns the value of the "identifier" attribute of this Fred. + */ +const std::string& +Fred::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "myBoolean" attribute of this Fred. + */ +bool +Fred::getBol() const +{ + return mBol; +} + + +/* + * Returns the value of the "myNumber" attribute of this Fred. + */ +int +Fred::getNum() const +{ + return mNum; +} + + +/* + * Returns the value of the "myString" attribute of this Fred. + */ +const std::string& +Fred::getStr() const +{ + return mStr; +} + + +/* + * Returns the value of the "myEnum" attribute of this Fred. + */ +Kind_t +Fred::getMyEnum() const +{ + return mMyEnum; +} + + +/* + * Returns the value of the "myEnum" attribute of this Fred. + */ +std::string +Fred::getMyEnumAsString() const +{ + std::string code_str = Kind_toString(mMyEnum); + return code_str; +} + + +/* + * Predicate returning @c true if this Fred's "identifier" attribute is set. + */ +bool +Fred::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this Fred's "myBoolean" attribute is set. + */ +bool +Fred::isSetBol() const +{ + return mIsSetBol; +} + + +/* + * Predicate returning @c true if this Fred's "myNumber" attribute is set. + */ +bool +Fred::isSetNum() const +{ + return mIsSetNum; +} + + +/* + * Predicate returning @c true if this Fred's "myString" attribute is set. + */ +bool +Fred::isSetStr() const +{ + return (mStr.empty() == false); +} + + +/* + * Predicate returning @c true if this Fred's "myEnum" attribute is set. + */ +bool +Fred::isSetMyEnum() const +{ + return (mMyEnum != X_KIND_INVALID); +} + + +/* + * Sets the value of the "identifier" attribute of this Fred. + */ +int +Fred::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "myBoolean" attribute of this Fred. + */ +int +Fred::setBol(bool bol) +{ + mBol = bol; + mIsSetBol = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "myNumber" attribute of this Fred. + */ +int +Fred::setNum(int num) +{ + mNum = num; + mIsSetNum = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "myString" attribute of this Fred. + */ +int +Fred::setStr(const std::string& str) +{ + mStr = str; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "myEnum" attribute of this Fred. + */ +int +Fred::setMyEnum(const Kind_t kind) +{ + if (Kind_isValid(kind) == 0) + { + mMyEnum = X_KIND_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mMyEnum = kind; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "myEnum" attribute of this Fred. + */ +int +Fred::setMyEnum(const std::string& kind) +{ + mMyEnum = Kind_fromString(kind.c_str()); + + if (mMyEnum == X_KIND_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "identifier" attribute of this Fred. + */ +int +Fred::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "myBoolean" attribute of this Fred. + */ +int +Fred::unsetBol() +{ + mBol = false; + mIsSetBol = false; + + if (isSetBol() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "myNumber" attribute of this Fred. + */ +int +Fred::unsetNum() +{ + mNum = SBML_INT_MAX; + mIsSetNum = false; + + if (isSetNum() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "myString" attribute of this Fred. + */ +int +Fred::unsetStr() +{ + mStr.erase(); + + if (mStr.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "myEnum" attribute of this Fred. + */ +int +Fred::unsetMyEnum() +{ + mMyEnum = X_KIND_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the value of the "other" element of this Fred. + */ +const Other* +Fred::getOther() const +{ + return mOther; +} + + +/* + * Returns the value of the "other" element of this Fred. + */ +Other* +Fred::getOther() +{ + return mOther; +} + + +/* + * Returns the value of the "other1" element of this Fred. + */ +const Other* +Fred::getOther1() const +{ + return mOther1; +} + + +/* + * Returns the value of the "other1" element of this Fred. + */ +Other* +Fred::getOther1() +{ + return mOther1; +} + + +/* + * Returns the value of the "myOther" element of this Fred. + */ +const Other* +Fred::getMyOther() const +{ + return mMyOther; +} + + +/* + * Returns the value of the "myOther" element of this Fred. + */ +Other* +Fred::getMyOther() +{ + return mMyOther; +} + + +/* + * Predicate returning @c true if this Fred's "other" element is set. + */ +bool +Fred::isSetOther() const +{ + return (mOther != NULL); +} + + +/* + * Predicate returning @c true if this Fred's "other1" element is set. + */ +bool +Fred::isSetOther1() const +{ + return (mOther1 != NULL); +} + + +/* + * Predicate returning @c true if this Fred's "myOther" element is set. + */ +bool +Fred::isSetMyOther() const +{ + return (mMyOther != NULL); +} + + +/* + * Sets the value of the "other" element of this Fred. + */ +int +Fred::setOther(const Other* other) +{ + if (mOther == other) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (other == NULL) + { + delete mOther; + mOther = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mOther; + mOther = (other != NULL) ? other->clone() : NULL; + if (mOther != NULL) + { + mOther->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "other1" element of this Fred. + */ +int +Fred::setOther1(const Other* other1) +{ + if (mOther1 == other1) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (other1 == NULL) + { + delete mOther1; + mOther1 = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mOther1; + mOther1 = (other1 != NULL) ? other1->clone() : NULL; + if (mOther1 != NULL) + { + mOther1->setElementName("other1"); + mOther1->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "myOther" element of this Fred. + */ +int +Fred::setMyOther(const Other* other2) +{ + if (mMyOther == other2) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (other2 == NULL) + { + delete mMyOther; + mMyOther = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mMyOther; + mMyOther = (other2 != NULL) ? other2->clone() : NULL; + if (mMyOther != NULL) + { + mMyOther->setElementName("myOther"); + mMyOther->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new Other object, adds it to this Fred object and returns the + * Other object created. + */ +Other* +Fred::createOther() +{ + if (mOther != NULL) + { + delete mOther; + } + + X_CREATE_NS(xns, getSBMLNamespaces()); + mOther = new Other(xns); + + delete xns; + + connectToChild(); + + return mOther; +} + + +/* + * Creates a new Other object, adds it to this Fred object and returns the + * Other object created. + */ +Other* +Fred::createOther1() +{ + if (mOther1 != NULL) + { + delete mOther1; + } + + X_CREATE_NS(xns, getSBMLNamespaces()); + mOther1 = new Other(xns); + + mOther1->setElementName("other1"); + + delete xns; + + connectToChild(); + + return mOther1; +} + + +/* + * Creates a new Other object, adds it to this Fred object and returns the + * Other object created. + */ +Other* +Fred::createMyOther() +{ + if (mMyOther != NULL) + { + delete mMyOther; + } + + X_CREATE_NS(xns, getSBMLNamespaces()); + mMyOther = new Other(xns); + + mMyOther->setElementName("myOther"); + + delete xns; + + connectToChild(); + + return mMyOther; +} + + +/* + * Unsets the value of the "other" element of this Fred. + */ +int +Fred::unsetOther() +{ + delete mOther; + mOther = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "other1" element of this Fred. + */ +int +Fred::unsetOther1() +{ + delete mOther1; + mOther1 = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "myOther" element of this Fred. + */ +int +Fred::unsetMyOther() +{ + delete mMyOther; + mMyOther = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this Fred object. + */ +const std::string& +Fred::getElementName() const +{ + static const string name = "fred"; + return name; +} + + +/* + * Returns the libSBML type code for this Fred object. + */ +int +Fred::getTypeCode() const +{ + return SBML_X_FRED; +} + + +/* + * Predicate returning @c true if all the required attributes for this Fred + * object have been set. + */ +bool +Fred::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + if (isSetNum() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Fred::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetOther() == true) + { + mOther->write(stream); + } + + if (isSetOther1() == true) + { + mOther1->write(stream); + } + + if (isSetMyOther() == true) + { + mMyOther->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Fred::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mOther != NULL) + { + mOther->accept(v); + } + + if (mOther1 != NULL) + { + mOther1->accept(v); + } + + if (mMyOther != NULL) + { + mMyOther->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Fred::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mOther != NULL) + { + mOther->setSBMLDocument(d); + } + + if (mOther1 != NULL) + { + mOther1->setSBMLDocument(d); + } + + if (mMyOther != NULL) + { + mMyOther->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Fred::connectToChild() +{ + SBase::connectToChild(); + + if (mOther != NULL) + { + mOther->connectToParent(this); + } + + if (mOther1 != NULL) + { + mOther1->connectToParent(this); + } + + if (mMyOther != NULL) + { + mMyOther->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Fred::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetOther()) + { + mOther->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + if (isSetOther1()) + { + mOther1->enablePackageInternal(pkgURI, pkgPrefix, flag); + } + + if (isSetMyOther()) + { + mMyOther->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +Fred::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mOther != NULL) + { + mOther->updateSBMLNamespace(package, level, version); + } + + if (mOther1 != NULL) + { + mOther1->updateSBMLNamespace(package, level, version); + } + + if (mMyOther != NULL) + { + mMyOther->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "myBoolean") + { + value = getBol(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "myNumber") + { + value = getNum(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::getAttribute(const std::string& attributeName, std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "identifier") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "myString") + { + value = getStr(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "myEnum") + { + value = getMyEnumAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Fred's attribute "attributeName" is set. + */ +bool +Fred::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "identifier") + { + value = isSetId(); + } + else if (attributeName == "myBoolean") + { + value = isSetBol(); + } + else if (attributeName == "myNumber") + { + value = isSetNum(); + } + else if (attributeName == "myString") + { + value = isSetStr(); + } + else if (attributeName == "myEnum") + { + value = isSetMyEnum(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "myBoolean") + { + return_value = setBol(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "myNumber") + { + return_value = setNum(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::setAttribute(const std::string& attributeName, const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "identifier") + { + return_value = setId(value); + } + else if (attributeName == "myString") + { + return_value = setStr(value); + } + else if (attributeName == "myEnum") + { + return_value = setMyEnum(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Fred. + */ +int +Fred::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "identifier") + { + value = unsetId(); + } + else if (attributeName == "myBoolean") + { + value = unsetBol(); + } + else if (attributeName == "myNumber") + { + value = unsetNum(); + } + else if (attributeName == "myString") + { + value = unsetStr(); + } + else if (attributeName == "myEnum") + { + value = unsetMyEnum(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this Fred. + */ +SBase* +Fred::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "other") + { + return createOther(); + } + else if (elementName == "other1") + { + return createOther1(); + } + else if (elementName == "other2") + { + return createMyOther(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this Fred. + */ +int +Fred::addChildObject(const std::string& elementName, const SBase* element) +{ + if (elementName == "other" && element->getTypeCode() == SBML_X_OTHER) + { + return setOther((const Other*)(element)); + } + else if (elementName == "other1" && element->getTypeCode() == SBML_X_OTHER) + { + return setOther1((const Other*)(element)); + } + else if (elementName == "other2" && element->getTypeCode() == SBML_X_OTHER) + { + return setMyOther((const Other*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * Fred. + */ +SBase* +Fred::removeChildObject(const std::string& elementName, const std::string& id) +{ + if (elementName == "other") + { + Other * obj = mOther; + mOther = NULL; return obj; + } + else if (elementName == "other1") + { + Other * obj = mOther1; + mOther1 = NULL; return obj; + } + else if (elementName == "other2") + { + Other * obj = mMyOther; + mMyOther = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this Fred. + */ +unsigned int +Fred::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "other") + { + if (isSetOther()) + { + return 1; + } + } + else if (elementName == "other1") + { + if (isSetOther1()) + { + return 1; + } + } + else if (elementName == "other2") + { + if (isSetMyOther()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this Fred. + */ +SBase* +Fred::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "other") + { + return getOther(); + } + else if (elementName == "other1") + { + return getOther1(); + } + else if (elementName == "other2") + { + return getMyOther(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +Fred::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mOther != NULL) + { + if (mOther->getId() == id) + { + return mOther; + } + + obj = mOther->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mOther1 != NULL) + { + if (mOther1->getId() == id) + { + return mOther1; + } + + obj = mOther1->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + if (mMyOther != NULL) + { + if (mMyOther->getId() == id) + { + return mMyOther; + } + + obj = mMyOther->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +Fred::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mOther != NULL) + { + if (mOther->getMetaId() == metaid) + { + return mOther; + } + + obj = mOther->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mOther1 != NULL) + { + if (mOther1->getMetaId() == metaid) + { + return mOther1; + } + + obj = mOther1->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + if (mMyOther != NULL) + { + if (mMyOther->getMetaId() == metaid) + { + return mMyOther; + } + + obj = mMyOther->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +Fred::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mOther, filter); + ADD_FILTERED_POINTER(ret, sublist, mOther1, filter); + ADD_FILTERED_POINTER(ret, sublist, mMyOther, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +Fred::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + X_CREATE_NS(xns, getSBMLNamespaces()); + + if (name == "other") + { + if (getErrorLog() && isSetOther()) + { + getErrorLog()->logPackageError("x", XFredAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mOther; + mOther = new Other(xns); + obj = mOther; + } + else if (name == "other1") + { + if (getErrorLog() && isSetOther1()) + { + getErrorLog()->logPackageError("x", XFredAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mOther1; + mOther1 = new Other(xns); + mOther1->setElementName(name); + obj = mOther1; + } + else if (name == "myOther") + { + if (getErrorLog() && isSetMyOther()) + { + getErrorLog()->logPackageError("x", XFredAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + delete mMyOther; + mMyOther = new Other(xns); + mMyOther->setElementName(name); + obj = mMyOther; + } + + delete xns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Fred::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("identifier"); + + attributes.add("myBoolean"); + + attributes.add("myNumber"); + + attributes.add("myString"); + + attributes.add("myEnum"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Fred::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("x", XFredAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("x", XFredAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } + + // + // identifier SId (use = "required" ) + // + + assigned = attributes.readInto("identifier", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("x", XIdSyntaxRule, pkgVersion, level, version, "The " + "id on the <" + getElementName() + "> is '" + mId + "', which does not " + "conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "X attribute 'identifier' is missing from the " + " element."; + log->logPackageError("x", XFredAllowedAttributes, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } + + // + // myBoolean bool (use = "optional" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetBol = attributes.readInto("myBoolean", mBol); + + if (mIsSetBol == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("x", XFredBolMustBeBoolean, pkgVersion, level, + version); + } + } + + // + // myNumber int (use = "required" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetNum = attributes.readInto("myNumber", mNum); + + if ( mIsSetNum == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "X attribute 'myNumber' from the element " + "must be an integer."; + log->logPackageError("x", XFredNumMustBeInteger, pkgVersion, level, + version, message, getLine(), getColumn()); + } + else + { + std::string message = "X attribute 'myNumber' is missing from the " + "element."; + log->logPackageError("x", XFredAllowedAttributes, pkgVersion, level, + version, message, getLine(), getColumn()); + } + } + + // + // myString string (use = "optional" ) + // + + assigned = attributes.readInto("myString", mStr); + + if (assigned == true) + { + if (mStr.empty() == true) + { + logEmptyString(mStr, level, version, ""); + } + } + + // + // myEnum enum (use = "optional" ) + // + + std::string kind; + assigned = attributes.readInto("myEnum", kind); + + if (assigned == true) + { + if (kind.empty() == true) + { + logEmptyString(kind, level, version, ""); + } + else + { + mMyEnum = Kind_fromString(kind.c_str()); + + if (log && Kind_isValid(mMyEnum) == 0) + { + std::string msg = "The myEnum on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + kind + "', which is not a valid option."; + + log->logPackageError("x", XFredKindMustBeKindEnum, pkgVersion, level, + version, msg, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Fred::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("identifier", getPrefix(), mId); + } + + if (isSetBol() == true) + { + stream.writeAttribute("myBoolean", getPrefix(), mBol); + } + + if (isSetNum() == true) + { + stream.writeAttribute("myNumber", getPrefix(), mNum); + } + + if (isSetStr() == true) + { + stream.writeAttribute("myString", getPrefix(), mStr); + } + + if (isSetMyEnum() == true) + { + stream.writeAttribute("myEnum", getPrefix(), Kind_toString(mMyEnum)); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Fred_t using the given SBML Level, Version and “x” + * package version. + */ +LIBSBML_EXTERN +Fred_t * +Fred_create(unsigned int level, unsigned int version, unsigned int pkgVersion) +{ + return new Fred(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Fred_t object. + */ +LIBSBML_EXTERN +Fred_t* +Fred_clone(const Fred_t* f) +{ + if (f != NULL) + { + return static_cast(f->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Fred_t object. + */ +LIBSBML_EXTERN +void +Fred_free(Fred_t* f) +{ + if (f != NULL) + { + delete f; + } +} + + +/* + * Returns the value of the "identifier" attribute of this Fred_t. + */ +LIBSBML_EXTERN +char * +Fred_getId(const Fred_t * f) +{ + if (f == NULL) + { + return NULL; + } + + return f->getId().empty() ? NULL : safe_strdup(f->getId().c_str()); +} + + +/* + * Returns the value of the "myBoolean" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_getBol(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->getBol()) : 0; +} + + +/* + * Returns the value of the "myNumber" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_getNum(const Fred_t * f) +{ + return (f != NULL) ? f->getNum() : SBML_INT_MAX; +} + + +/* + * Returns the value of the "myString" attribute of this Fred_t. + */ +LIBSBML_EXTERN +char * +Fred_getStr(const Fred_t * f) +{ + if (f == NULL) + { + return NULL; + } + + return f->getStr().empty() ? NULL : safe_strdup(f->getStr().c_str()); +} + + +/* + * Returns the value of the "myEnum" attribute of this Fred_t. + */ +LIBSBML_EXTERN +Kind_t +Fred_getMyEnum(const Fred_t * f) +{ + if (f == NULL) + { + return X_KIND_INVALID; + } + + return f->getMyEnum(); +} + + +/* + * Returns the value of the "myEnum" attribute of this Fred_t. + */ +LIBSBML_EXTERN +char * +Fred_getMyEnumAsString(const Fred_t * f) +{ + return (char*)(Kind_toString(f->getMyEnum())); +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "identifier" attribute is + * set. + */ +LIBSBML_EXTERN +int +Fred_isSetId(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "myBoolean" attribute is + * set. + */ +LIBSBML_EXTERN +int +Fred_isSetBol(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetBol()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "myNumber" attribute is + * set. + */ +LIBSBML_EXTERN +int +Fred_isSetNum(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetNum()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "myString" attribute is + * set. + */ +LIBSBML_EXTERN +int +Fred_isSetStr(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetStr()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "myEnum" attribute is set. + */ +LIBSBML_EXTERN +int +Fred_isSetMyEnum(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetMyEnum()) : 0; +} + + +/* + * Sets the value of the "identifier" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setId(Fred_t * f, const char * id) +{ + return (f != NULL) ? f->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "myBoolean" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setBol(Fred_t * f, int bol) +{ + return (f != NULL) ? f->setBol(bol) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "myNumber" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setNum(Fred_t * f, int num) +{ + return (f != NULL) ? f->setNum(num) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "myString" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setStr(Fred_t * f, const char * str) +{ + return (f != NULL) ? f->setStr(str) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "myEnum" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setMyEnum(Fred_t * f, Kind_t kind) +{ + return (f != NULL) ? f->setMyEnum(kind) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "myEnum" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setMyEnumAsString(Fred_t * f, const char * kind) +{ + return (f != NULL) ? f->setMyEnum(kind): LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "identifier" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetId(Fred_t * f) +{ + return (f != NULL) ? f->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "myBoolean" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetBol(Fred_t * f) +{ + return (f != NULL) ? f->unsetBol() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "myNumber" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetNum(Fred_t * f) +{ + return (f != NULL) ? f->unsetNum() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "myString" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetStr(Fred_t * f) +{ + return (f != NULL) ? f->unsetStr() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "myEnum" attribute of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetMyEnum(Fred_t * f) +{ + return (f != NULL) ? f->unsetMyEnum() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "other" element of this Fred_t. + */ +LIBSBML_EXTERN +const Other_t* +Fred_getOther(const Fred_t * f) +{ + if (f == NULL) + { + return NULL; + } + + return (Other_t*)(f->getOther()); +} + + +/* + * Returns the value of the "other1" element of this Fred_t. + */ +LIBSBML_EXTERN +const Other_t* +Fred_getOther1(const Fred_t * f) +{ + if (f == NULL) + { + return NULL; + } + + return (Other_t*)(f->getOther1()); +} + + +/* + * Returns the value of the "myOther" element of this Fred_t. + */ +LIBSBML_EXTERN +const Other_t* +Fred_getMyOther(const Fred_t * f) +{ + if (f == NULL) + { + return NULL; + } + + return (Other_t*)(f->getMyOther()); +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "other" element is set. + */ +LIBSBML_EXTERN +int +Fred_isSetOther(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetOther()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "other1" element is set. + */ +LIBSBML_EXTERN +int +Fred_isSetOther1(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetOther1()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Fred_t's "myOther" element is set. + */ +LIBSBML_EXTERN +int +Fred_isSetMyOther(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->isSetMyOther()) : 0; +} + + +/* + * Sets the value of the "other" element of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setOther(Fred_t * f, const Other_t* other) +{ + return (f != NULL) ? f->setOther(other) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "other1" element of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setOther1(Fred_t * f, const Other_t* other1) +{ + return (f != NULL) ? f->setOther1(other1) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "myOther" element of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_setMyOther(Fred_t * f, const Other_t* other2) +{ + return (f != NULL) ? f->setMyOther(other2) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new Other_t object, adds it to this Fred_t object and returns the + * Other_t object created. + */ +LIBSBML_EXTERN +Other_t* +Fred_createOther(Fred_t* f) +{ + if (f == NULL) + { + return NULL; + } + + return (Other_t*)(f->createOther()); +} + + +/* + * Creates a new Other_t object, adds it to this Fred_t object and returns the + * Other_t object created. + */ +LIBSBML_EXTERN +Other_t* +Fred_createOther1(Fred_t* f) +{ + if (f == NULL) + { + return NULL; + } + + return (Other_t*)(f->createOther1()); +} + + +/* + * Creates a new Other_t object, adds it to this Fred_t object and returns the + * Other_t object created. + */ +LIBSBML_EXTERN +Other_t* +Fred_createMyOther(Fred_t* f) +{ + if (f == NULL) + { + return NULL; + } + + return (Other_t*)(f->createMyOther()); +} + + +/* + * Unsets the value of the "other" element of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetOther(Fred_t * f) +{ + return (f != NULL) ? f->unsetOther() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "other1" element of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetOther1(Fred_t * f) +{ + return (f != NULL) ? f->unsetOther1() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "myOther" element of this Fred_t. + */ +LIBSBML_EXTERN +int +Fred_unsetMyOther(Fred_t * f) +{ + return (f != NULL) ? f->unsetMyOther() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Fred_t object have been set. + */ +LIBSBML_EXTERN +int +Fred_hasRequiredAttributes(const Fred_t * f) +{ + return (f != NULL) ? static_cast(f->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Fred.h b/generator/tests/test_cpp_code/test-code/Fred.h index dcb92570..55d216d6 100644 --- a/generator/tests/test_cpp_code/test-code/Fred.h +++ b/generator/tests/test_cpp_code/test-code/Fred.h @@ -1,1860 +1,1860 @@ -/** - * @file Fred.h - * @brief Definition of the Fred class. - * @author SBMLTeam - * - * - * - * @class Fred - * @sbmlbrief{x} TODO:Definition of the Fred class. - */ - -/** - * - * - * - * @class doc_fred_kind - * - * @par - * The attribute "kind" on a Fred object is used to TODO:add explanation - * - * In the SBML - * Level 3 Version 1 X specification, the following are the - * allowable values for "kind": - *
    - *
  • @c "first", TODO:add description - * - *
- */ - - -#ifndef Fred_H__ -#define Fred_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Fred : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - bool mBol; - bool mIsSetBol; - int mNum; - bool mIsSetNum; - std::string mStr; - Kind_t mMyEnum; - Other* mOther; - Other* mOther1; - Other* mMyOther; - - /** @endcond */ - -public: - - /** - * Creates a new Fred using the given SBML Level, Version and “x” - * package version. - * - * @param level an unsigned int, the SBML Level to assign to this Fred. - * - * @param version an unsigned int, the SBML Version to assign to this Fred. - * - * @param pkgVersion an unsigned int, the SBML X Version to assign to this - * Fred. - * - * @copydetails doc_note_setting_lv_pkg - */ - Fred(unsigned int level = XExtension::getDefaultLevel(), - unsigned int version = XExtension::getDefaultVersion(), - unsigned int pkgVersion = XExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Fred using the given XPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param xns the XPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Fred(XPkgNamespaces *xns); - - - /** - * Copy constructor for Fred. - * - * @param orig the Fred instance to copy. - */ - Fred(const Fred& orig); - - - /** - * Assignment operator for Fred. - * - * @param rhs the Fred object whose values are to be used as the basis of the - * assignment. - */ - Fred& operator=(const Fred& rhs); - - - /** - * Creates and returns a deep copy of this Fred object. - * - * @return a (deep) copy of this Fred object. - */ - virtual Fred* clone() const; - - - /** - * Destructor for Fred. - */ - virtual ~Fred(); - - - /** - * Returns the value of the "identifier" attribute of this Fred. - * - * @return the value of the "identifier" attribute of this Fred as a string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "myBoolean" attribute of this Fred. - * - * @return the value of the "myBoolean" attribute of this Fred as a boolean. - */ - bool getBol() const; - - - /** - * Returns the value of the "myNumber" attribute of this Fred. - * - * @return the value of the "myNumber" attribute of this Fred as a integer. - */ - int getNum() const; - - - /** - * Returns the value of the "myString" attribute of this Fred. - * - * @return the value of the "myString" attribute of this Fred as a string. - */ - const std::string& getStr() const; - - - /** - * Returns the value of the "myEnum" attribute of this Fred. - * - * @return the value of the "myEnum" attribute of this Fred as a Kind_t. - * - * @copydetails doc_fred_myEnum - * @if clike The value is drawn from the enumeration @ref Kind_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{X_KIND_FIRST, Kind_t} - * @li @sbmlconstant{X_KIND_INVALID, Kind_t} - */ - Kind_t getMyEnum() const; - - - /** - * Returns the value of the "myEnum" attribute of this Fred. - * - * @return the value of the "myEnum" attribute of this Fred as a string. - * - * @copydetails doc_fred_myEnum - * The possible values returned by this method are: - * @li @c "first" - * @li @c "invalid Kind value" - */ - std::string getMyEnumAsString() const; - - - /** - * Predicate returning @c true if this Fred's "identifier" attribute is set. - * - * @return @c true if this Fred's "identifier" attribute has been set, - * otherwise @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this Fred's "myBoolean" attribute is set. - * - * @return @c true if this Fred's "myBoolean" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetBol() const; - - - /** - * Predicate returning @c true if this Fred's "myNumber" attribute is set. - * - * @return @c true if this Fred's "myNumber" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetNum() const; - - - /** - * Predicate returning @c true if this Fred's "myString" attribute is set. - * - * @return @c true if this Fred's "myString" attribute has been set, - * otherwise @c false is returned. - */ - bool isSetStr() const; - - - /** - * Predicate returning @c true if this Fred's "myEnum" attribute is set. - * - * @return @c true if this Fred's "myEnum" attribute has been set, otherwise - * @c false is returned. - * - * @copydetails doc_fred_myEnum - */ - bool isSetMyEnum() const; - - - /** - * Sets the value of the "identifier" attribute of this Fred. - * - * @param id std::string& value of the "identifier" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "myBoolean" attribute of this Fred. - * - * @param bol bool value of the "myBoolean" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setBol(bool bol); - - - /** - * Sets the value of the "myNumber" attribute of this Fred. - * - * @param num int value of the "myNumber" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setNum(int num); - - - /** - * Sets the value of the "myString" attribute of this Fred. - * - * @param str std::string& value of the "myString" attribute to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p str = @c NULL or an empty string is - * equivalent to calling unsetStr(). - */ - int setStr(const std::string& str); - - - /** - * Sets the value of the "myEnum" attribute of this Fred. - * - * @param kind @if clike Kind_t@else int@endif value of the "myEnum" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_fred_myEnum - */ - int setMyEnum(const Kind_t kind); - - - /** - * Sets the value of the "myEnum" attribute of this Fred. - * - * @param kind std::string& of the "myEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_fred_myEnum - */ - int setMyEnum(const std::string& kind); - - - /** - * Unsets the value of the "identifier" attribute of this Fred. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "myBoolean" attribute of this Fred. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetBol(); - - - /** - * Unsets the value of the "myNumber" attribute of this Fred. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetNum(); - - - /** - * Unsets the value of the "myString" attribute of this Fred. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetStr(); - - - /** - * Unsets the value of the "myEnum" attribute of this Fred. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_fred_myEnum - */ - int unsetMyEnum(); - - - /** - * Returns the value of the "other" element of this Fred. - * - * @return the value of the "other" element of this Fred as a Other*. - */ - const Other* getOther() const; - - - /** - * Returns the value of the "other" element of this Fred. - * - * @return the value of the "other" element of this Fred as a Other*. - */ - Other* getOther(); - - - /** - * Returns the value of the "other1" element of this Fred. - * - * @return the value of the "other1" element of this Fred as a Other*. - */ - const Other* getOther1() const; - - - /** - * Returns the value of the "other1" element of this Fred. - * - * @return the value of the "other1" element of this Fred as a Other*. - */ - Other* getOther1(); - - - /** - * Returns the value of the "myOther" element of this Fred. - * - * @return the value of the "myOther" element of this Fred as a Other*. - */ - const Other* getMyOther() const; - - - /** - * Returns the value of the "myOther" element of this Fred. - * - * @return the value of the "myOther" element of this Fred as a Other*. - */ - Other* getMyOther(); - - - /** - * Predicate returning @c true if this Fred's "other" element is set. - * - * @return @c true if this Fred's "other" element has been set, otherwise - * @c false is returned. - */ - bool isSetOther() const; - - - /** - * Predicate returning @c true if this Fred's "other1" element is set. - * - * @return @c true if this Fred's "other1" element has been set, otherwise - * @c false is returned. - */ - bool isSetOther1() const; - - - /** - * Predicate returning @c true if this Fred's "myOther" element is set. - * - * @return @c true if this Fred's "myOther" element has been set, otherwise - * @c false is returned. - */ - bool isSetMyOther() const; - - - /** - * Sets the value of the "other" element of this Fred. - * - * @param other Other* value of the "other" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setOther(const Other* other); - - - /** - * Sets the value of the "other1" element of this Fred. - * - * @param other1 Other* value of the "other1" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setOther1(const Other* other1); - - - /** - * Sets the value of the "myOther" element of this Fred. - * - * @param other2 Other* value of the "myOther" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setMyOther(const Other* other2); - - - /** - * Creates a new Other object, adds it to this Fred object and returns the - * Other object created. - * - * @return a new Other object instance. - */ - Other* createOther(); - - - /** - * Creates a new Other object, adds it to this Fred object and returns the - * Other object created. - * - * @return a new Other object instance. - */ - Other* createOther1(); - - - /** - * Creates a new Other object, adds it to this Fred object and returns the - * Other object created. - * - * @return a new Other object instance. - */ - Other* createMyOther(); - - - /** - * Unsets the value of the "other" element of this Fred. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetOther(); - - - /** - * Unsets the value of the "other1" element of this Fred. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetOther1(); - - - /** - * Unsets the value of the "myOther" element of this Fred. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetMyOther(); - - - /** - * Returns the XML element name of this Fred object. - * - * For Fred, the XML element name is always @c "fred". - * - * @return the name of this element, i.e. @c "fred". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Fred object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_X_FRED, SBMLXTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this Fred - * object have been set. - * - * @return @c true to indicate that all the required attributes of this Fred - * have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the Fred object are: - * @li "identifier" - * @li "myNumber" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Fred's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Fred's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Fred. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this Fred. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this Fred. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * Fred. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this Fred. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this Fred. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Fred_t using the given SBML Level, Version and “x” - * package version. - * - * @param level an unsigned int, the SBML Level to assign to this Fred_t. - * - * @param version an unsigned int, the SBML Version to assign to this Fred_t. - * - * @param pkgVersion an unsigned int, the SBML X Version to assign to this - * Fred_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -Fred_t * -Fred_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Fred_t object. - * - * @param f the Fred_t structure. - * - * @return a (deep) copy of this Fred_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -Fred_t* -Fred_clone(const Fred_t* f); - - -/** - * Frees this Fred_t object. - * - * @param f the Fred_t structure. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -void -Fred_free(Fred_t* f); - - -/** - * Returns the value of the "identifier" attribute of this Fred_t. - * - * @param f the Fred_t structure whose identifier is sought. - * - * @return the value of the "identifier" attribute of this Fred_t as a pointer - * to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -char * -Fred_getId(const Fred_t * f); - - -/** - * Returns the value of the "myBoolean" attribute of this Fred_t. - * - * @param f the Fred_t structure whose myBoolean is sought. - * - * @return the value of the "myBoolean" attribute of this Fred_t as a boolean. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_getBol(const Fred_t * f); - - -/** - * Returns the value of the "myNumber" attribute of this Fred_t. - * - * @param f the Fred_t structure whose myNumber is sought. - * - * @return the value of the "myNumber" attribute of this Fred_t as a integer. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_getNum(const Fred_t * f); - - -/** - * Returns the value of the "myString" attribute of this Fred_t. - * - * @param f the Fred_t structure whose myString is sought. - * - * @return the value of the "myString" attribute of this Fred_t as a pointer to - * a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -char * -Fred_getStr(const Fred_t * f); - - -/** - * Returns the value of the "myEnum" attribute of this Fred_t. - * - * @param f the Fred_t structure whose myEnum is sought. - * - * @return the value of the "myEnum" attribute of this Fred_t as a Kind_t. - * - * @copydetails doc_fred_myEnum - * @if clike The value is drawn from the enumeration @ref Kind_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{X_KIND_FIRST, Kind_t} - * @li @sbmlconstant{X_KIND_INVALID, Kind_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -Kind_t -Fred_getMyEnum(const Fred_t * f); - - -/** - * Returns the value of the "myEnum" attribute of this Fred_t. - * - * @param f the Fred_t structure whose myEnum is sought. - * - * @return the value of the "myEnum" attribute of this Fred_t as a const char - * *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_fred_myEnum - * The possible values returned by this method are: - * @li @c "first" - * @li @c "invalid Kind value" - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -char * -Fred_getMyEnumAsString(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "identifier" attribute is - * set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "identifier" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetId(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "myBoolean" attribute is - * set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "myBoolean" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetBol(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "myNumber" attribute is - * set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "myNumber" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetNum(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "myString" attribute is - * set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "myString" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetStr(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "myEnum" attribute is set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "myEnum" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @copydetails doc_fred_myEnum - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetMyEnum(const Fred_t * f); - - -/** - * Sets the value of the "identifier" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param id const char * value of the "identifier" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling Fred_unsetId(). - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setId(Fred_t * f, const char * id); - - -/** - * Sets the value of the "myBoolean" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param bol int value of the "myBoolean" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setBol(Fred_t * f, int bol); - - -/** - * Sets the value of the "myNumber" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param num int value of the "myNumber" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setNum(Fred_t * f, int num); - - -/** - * Sets the value of the "myString" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param str const char * value of the "myString" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p str = @c NULL or an empty string is equivalent - * to calling Fred_unsetStr(). - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setStr(Fred_t * f, const char * str); - - -/** - * Sets the value of the "myEnum" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param kind Kind_t value of the "myEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_fred_myEnum - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setMyEnum(Fred_t * f, Kind_t kind); - - -/** - * Sets the value of the "myEnum" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param kind const char * of the "myEnum" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_fred_myEnum - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setMyEnumAsString(Fred_t * f, const char * kind); - - -/** - * Unsets the value of the "identifier" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetId(Fred_t * f); - - -/** - * Unsets the value of the "myBoolean" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetBol(Fred_t * f); - - -/** - * Unsets the value of the "myNumber" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetNum(Fred_t * f); - - -/** - * Unsets the value of the "myString" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetStr(Fred_t * f); - - -/** - * Unsets the value of the "myEnum" attribute of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_fred_myEnum - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetMyEnum(Fred_t * f); - - -/** - * Returns the value of the "other" element of this Fred_t. - * - * @param f the Fred_t structure whose other is sought. - * - * @return the value of the "other" element of this Fred_t as a Other*. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -const Other_t* -Fred_getOther(const Fred_t * f); - - -/** - * Returns the value of the "other1" element of this Fred_t. - * - * @param f the Fred_t structure whose other1 is sought. - * - * @return the value of the "other1" element of this Fred_t as a Other*. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -const Other_t* -Fred_getOther1(const Fred_t * f); - - -/** - * Returns the value of the "myOther" element of this Fred_t. - * - * @param f the Fred_t structure whose myOther is sought. - * - * @return the value of the "myOther" element of this Fred_t as a Other*. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -const Other_t* -Fred_getMyOther(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "other" element is set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "other" element has been set, otherwise - * @c 0 (false) is returned. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetOther(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "other1" element is set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "other1" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetOther1(const Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if this Fred_t's "myOther" element is set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) if this Fred_t's "myOther" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_isSetMyOther(const Fred_t * f); - - -/** - * Sets the value of the "other" element of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param other Other_t* value of the "other" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setOther(Fred_t * f, const Other_t* other); - - -/** - * Sets the value of the "other1" element of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param other1 Other_t* value of the "other1" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setOther1(Fred_t * f, const Other_t* other1); - - -/** - * Sets the value of the "myOther" element of this Fred_t. - * - * @param f the Fred_t structure. - * - * @param other2 Other_t* value of the "myOther" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_setMyOther(Fred_t * f, const Other_t* other2); - - -/** - * Creates a new Other_t object, adds it to this Fred_t object and returns the - * Other_t object created. - * - * @param f the Fred_t structure to which the Other_t should be added. - * - * @return a new Other_t object instance. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -Other_t* -Fred_createOther(Fred_t* f); - - -/** - * Creates a new Other_t object, adds it to this Fred_t object and returns the - * Other_t object created. - * - * @param f the Fred_t structure to which the Other_t should be added. - * - * @return a new Other_t object instance. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -Other_t* -Fred_createOther1(Fred_t* f); - - -/** - * Creates a new Other_t object, adds it to this Fred_t object and returns the - * Other_t object created. - * - * @param f the Fred_t structure to which the Other_t should be added. - * - * @return a new Other_t object instance. - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -Other_t* -Fred_createMyOther(Fred_t* f); - - -/** - * Unsets the value of the "other" element of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetOther(Fred_t * f); - - -/** - * Unsets the value of the "other1" element of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetOther1(Fred_t * f); - - -/** - * Unsets the value of the "myOther" element of this Fred_t. - * - * @param f the Fred_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_unsetMyOther(Fred_t * f); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Fred_t object have been set. - * - * @param f the Fred_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Fred_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the Fred_t object are: - * @li "identifier" - * @li "myNumber" - * - * @memberof Fred_t - */ -LIBSBML_EXTERN -int -Fred_hasRequiredAttributes(const Fred_t * f); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Fred_H__ */ - - +/** + * @file Fred.h + * @brief Definition of the Fred class. + * @author SBMLTeam + * + * + * + * @class Fred + * @sbmlbrief{x} TODO:Definition of the Fred class. + */ + +/** + * + * + * + * @class doc_fred_kind + * + * @par + * The attribute "kind" on a Fred object is used to TODO:add explanation + * + * In the SBML + * Level 3 Version 1 X specification, the following are the + * allowable values for "kind": + *
    + *
  • @c "first", TODO:add description + * + *
+ */ + + +#ifndef Fred_H__ +#define Fred_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Fred : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + bool mBol; + bool mIsSetBol; + int mNum; + bool mIsSetNum; + std::string mStr; + Kind_t mMyEnum; + Other* mOther; + Other* mOther1; + Other* mMyOther; + + /** @endcond */ + +public: + + /** + * Creates a new Fred using the given SBML Level, Version and “x” + * package version. + * + * @param level an unsigned int, the SBML Level to assign to this Fred. + * + * @param version an unsigned int, the SBML Version to assign to this Fred. + * + * @param pkgVersion an unsigned int, the SBML X Version to assign to this + * Fred. + * + * @copydetails doc_note_setting_lv_pkg + */ + Fred(unsigned int level = XExtension::getDefaultLevel(), + unsigned int version = XExtension::getDefaultVersion(), + unsigned int pkgVersion = XExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Fred using the given XPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param xns the XPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Fred(XPkgNamespaces *xns); + + + /** + * Copy constructor for Fred. + * + * @param orig the Fred instance to copy. + */ + Fred(const Fred& orig); + + + /** + * Assignment operator for Fred. + * + * @param rhs the Fred object whose values are to be used as the basis of the + * assignment. + */ + Fred& operator=(const Fred& rhs); + + + /** + * Creates and returns a deep copy of this Fred object. + * + * @return a (deep) copy of this Fred object. + */ + virtual Fred* clone() const; + + + /** + * Destructor for Fred. + */ + virtual ~Fred(); + + + /** + * Returns the value of the "identifier" attribute of this Fred. + * + * @return the value of the "identifier" attribute of this Fred as a string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "myBoolean" attribute of this Fred. + * + * @return the value of the "myBoolean" attribute of this Fred as a boolean. + */ + bool getBol() const; + + + /** + * Returns the value of the "myNumber" attribute of this Fred. + * + * @return the value of the "myNumber" attribute of this Fred as a integer. + */ + int getNum() const; + + + /** + * Returns the value of the "myString" attribute of this Fred. + * + * @return the value of the "myString" attribute of this Fred as a string. + */ + const std::string& getStr() const; + + + /** + * Returns the value of the "myEnum" attribute of this Fred. + * + * @return the value of the "myEnum" attribute of this Fred as a Kind_t. + * + * @copydetails doc_fred_myEnum + * @if clike The value is drawn from the enumeration @ref Kind_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{X_KIND_FIRST, Kind_t} + * @li @sbmlconstant{X_KIND_INVALID, Kind_t} + */ + Kind_t getMyEnum() const; + + + /** + * Returns the value of the "myEnum" attribute of this Fred. + * + * @return the value of the "myEnum" attribute of this Fred as a string. + * + * @copydetails doc_fred_myEnum + * The possible values returned by this method are: + * @li @c "first" + * @li @c "invalid Kind value" + */ + std::string getMyEnumAsString() const; + + + /** + * Predicate returning @c true if this Fred's "identifier" attribute is set. + * + * @return @c true if this Fred's "identifier" attribute has been set, + * otherwise @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this Fred's "myBoolean" attribute is set. + * + * @return @c true if this Fred's "myBoolean" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetBol() const; + + + /** + * Predicate returning @c true if this Fred's "myNumber" attribute is set. + * + * @return @c true if this Fred's "myNumber" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetNum() const; + + + /** + * Predicate returning @c true if this Fred's "myString" attribute is set. + * + * @return @c true if this Fred's "myString" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetStr() const; + + + /** + * Predicate returning @c true if this Fred's "myEnum" attribute is set. + * + * @return @c true if this Fred's "myEnum" attribute has been set, otherwise + * @c false is returned. + * + * @copydetails doc_fred_myEnum + */ + bool isSetMyEnum() const; + + + /** + * Sets the value of the "identifier" attribute of this Fred. + * + * @param id std::string& value of the "identifier" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "myBoolean" attribute of this Fred. + * + * @param bol bool value of the "myBoolean" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setBol(bool bol); + + + /** + * Sets the value of the "myNumber" attribute of this Fred. + * + * @param num int value of the "myNumber" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setNum(int num); + + + /** + * Sets the value of the "myString" attribute of this Fred. + * + * @param str std::string& value of the "myString" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p str = @c NULL or an empty string is + * equivalent to calling unsetStr(). + */ + int setStr(const std::string& str); + + + /** + * Sets the value of the "myEnum" attribute of this Fred. + * + * @param kind @if clike Kind_t@else int@endif value of the "myEnum" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_fred_myEnum + */ + int setMyEnum(const Kind_t kind); + + + /** + * Sets the value of the "myEnum" attribute of this Fred. + * + * @param kind std::string& of the "myEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_fred_myEnum + */ + int setMyEnum(const std::string& kind); + + + /** + * Unsets the value of the "identifier" attribute of this Fred. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "myBoolean" attribute of this Fred. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetBol(); + + + /** + * Unsets the value of the "myNumber" attribute of this Fred. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetNum(); + + + /** + * Unsets the value of the "myString" attribute of this Fred. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetStr(); + + + /** + * Unsets the value of the "myEnum" attribute of this Fred. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_fred_myEnum + */ + int unsetMyEnum(); + + + /** + * Returns the value of the "other" element of this Fred. + * + * @return the value of the "other" element of this Fred as a Other*. + */ + const Other* getOther() const; + + + /** + * Returns the value of the "other" element of this Fred. + * + * @return the value of the "other" element of this Fred as a Other*. + */ + Other* getOther(); + + + /** + * Returns the value of the "other1" element of this Fred. + * + * @return the value of the "other1" element of this Fred as a Other*. + */ + const Other* getOther1() const; + + + /** + * Returns the value of the "other1" element of this Fred. + * + * @return the value of the "other1" element of this Fred as a Other*. + */ + Other* getOther1(); + + + /** + * Returns the value of the "myOther" element of this Fred. + * + * @return the value of the "myOther" element of this Fred as a Other*. + */ + const Other* getMyOther() const; + + + /** + * Returns the value of the "myOther" element of this Fred. + * + * @return the value of the "myOther" element of this Fred as a Other*. + */ + Other* getMyOther(); + + + /** + * Predicate returning @c true if this Fred's "other" element is set. + * + * @return @c true if this Fred's "other" element has been set, otherwise + * @c false is returned. + */ + bool isSetOther() const; + + + /** + * Predicate returning @c true if this Fred's "other1" element is set. + * + * @return @c true if this Fred's "other1" element has been set, otherwise + * @c false is returned. + */ + bool isSetOther1() const; + + + /** + * Predicate returning @c true if this Fred's "myOther" element is set. + * + * @return @c true if this Fred's "myOther" element has been set, otherwise + * @c false is returned. + */ + bool isSetMyOther() const; + + + /** + * Sets the value of the "other" element of this Fred. + * + * @param other Other* value of the "other" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setOther(const Other* other); + + + /** + * Sets the value of the "other1" element of this Fred. + * + * @param other1 Other* value of the "other1" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setOther1(const Other* other1); + + + /** + * Sets the value of the "myOther" element of this Fred. + * + * @param other2 Other* value of the "myOther" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setMyOther(const Other* other2); + + + /** + * Creates a new Other object, adds it to this Fred object and returns the + * Other object created. + * + * @return a new Other object instance. + */ + Other* createOther(); + + + /** + * Creates a new Other object, adds it to this Fred object and returns the + * Other object created. + * + * @return a new Other object instance. + */ + Other* createOther1(); + + + /** + * Creates a new Other object, adds it to this Fred object and returns the + * Other object created. + * + * @return a new Other object instance. + */ + Other* createMyOther(); + + + /** + * Unsets the value of the "other" element of this Fred. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetOther(); + + + /** + * Unsets the value of the "other1" element of this Fred. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetOther1(); + + + /** + * Unsets the value of the "myOther" element of this Fred. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetMyOther(); + + + /** + * Returns the XML element name of this Fred object. + * + * For Fred, the XML element name is always @c "fred". + * + * @return the name of this element, i.e. @c "fred". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Fred object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_X_FRED, SBMLXTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this Fred + * object have been set. + * + * @return @c true to indicate that all the required attributes of this Fred + * have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the Fred object are: + * @li "identifier" + * @li "myNumber" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Fred's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Fred's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Fred. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this Fred. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this Fred. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * Fred. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this Fred. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this Fred. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Fred_t using the given SBML Level, Version and “x” + * package version. + * + * @param level an unsigned int, the SBML Level to assign to this Fred_t. + * + * @param version an unsigned int, the SBML Version to assign to this Fred_t. + * + * @param pkgVersion an unsigned int, the SBML X Version to assign to this + * Fred_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +Fred_t * +Fred_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Fred_t object. + * + * @param f the Fred_t structure. + * + * @return a (deep) copy of this Fred_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +Fred_t* +Fred_clone(const Fred_t* f); + + +/** + * Frees this Fred_t object. + * + * @param f the Fred_t structure. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +void +Fred_free(Fred_t* f); + + +/** + * Returns the value of the "identifier" attribute of this Fred_t. + * + * @param f the Fred_t structure whose identifier is sought. + * + * @return the value of the "identifier" attribute of this Fred_t as a pointer + * to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +char * +Fred_getId(const Fred_t * f); + + +/** + * Returns the value of the "myBoolean" attribute of this Fred_t. + * + * @param f the Fred_t structure whose myBoolean is sought. + * + * @return the value of the "myBoolean" attribute of this Fred_t as a boolean. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_getBol(const Fred_t * f); + + +/** + * Returns the value of the "myNumber" attribute of this Fred_t. + * + * @param f the Fred_t structure whose myNumber is sought. + * + * @return the value of the "myNumber" attribute of this Fred_t as a integer. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_getNum(const Fred_t * f); + + +/** + * Returns the value of the "myString" attribute of this Fred_t. + * + * @param f the Fred_t structure whose myString is sought. + * + * @return the value of the "myString" attribute of this Fred_t as a pointer to + * a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +char * +Fred_getStr(const Fred_t * f); + + +/** + * Returns the value of the "myEnum" attribute of this Fred_t. + * + * @param f the Fred_t structure whose myEnum is sought. + * + * @return the value of the "myEnum" attribute of this Fred_t as a Kind_t. + * + * @copydetails doc_fred_myEnum + * @if clike The value is drawn from the enumeration @ref Kind_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{X_KIND_FIRST, Kind_t} + * @li @sbmlconstant{X_KIND_INVALID, Kind_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +Kind_t +Fred_getMyEnum(const Fred_t * f); + + +/** + * Returns the value of the "myEnum" attribute of this Fred_t. + * + * @param f the Fred_t structure whose myEnum is sought. + * + * @return the value of the "myEnum" attribute of this Fred_t as a const char + * *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_fred_myEnum + * The possible values returned by this method are: + * @li @c "first" + * @li @c "invalid Kind value" + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +char * +Fred_getMyEnumAsString(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "identifier" attribute is + * set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "identifier" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetId(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "myBoolean" attribute is + * set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "myBoolean" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetBol(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "myNumber" attribute is + * set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "myNumber" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetNum(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "myString" attribute is + * set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "myString" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetStr(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "myEnum" attribute is set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "myEnum" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @copydetails doc_fred_myEnum + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetMyEnum(const Fred_t * f); + + +/** + * Sets the value of the "identifier" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param id const char * value of the "identifier" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling Fred_unsetId(). + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setId(Fred_t * f, const char * id); + + +/** + * Sets the value of the "myBoolean" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param bol int value of the "myBoolean" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setBol(Fred_t * f, int bol); + + +/** + * Sets the value of the "myNumber" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param num int value of the "myNumber" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setNum(Fred_t * f, int num); + + +/** + * Sets the value of the "myString" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param str const char * value of the "myString" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p str = @c NULL or an empty string is equivalent + * to calling Fred_unsetStr(). + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setStr(Fred_t * f, const char * str); + + +/** + * Sets the value of the "myEnum" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param kind Kind_t value of the "myEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_fred_myEnum + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setMyEnum(Fred_t * f, Kind_t kind); + + +/** + * Sets the value of the "myEnum" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param kind const char * of the "myEnum" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_fred_myEnum + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setMyEnumAsString(Fred_t * f, const char * kind); + + +/** + * Unsets the value of the "identifier" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetId(Fred_t * f); + + +/** + * Unsets the value of the "myBoolean" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetBol(Fred_t * f); + + +/** + * Unsets the value of the "myNumber" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetNum(Fred_t * f); + + +/** + * Unsets the value of the "myString" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetStr(Fred_t * f); + + +/** + * Unsets the value of the "myEnum" attribute of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_fred_myEnum + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetMyEnum(Fred_t * f); + + +/** + * Returns the value of the "other" element of this Fred_t. + * + * @param f the Fred_t structure whose other is sought. + * + * @return the value of the "other" element of this Fred_t as a Other*. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +const Other_t* +Fred_getOther(const Fred_t * f); + + +/** + * Returns the value of the "other1" element of this Fred_t. + * + * @param f the Fred_t structure whose other1 is sought. + * + * @return the value of the "other1" element of this Fred_t as a Other*. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +const Other_t* +Fred_getOther1(const Fred_t * f); + + +/** + * Returns the value of the "myOther" element of this Fred_t. + * + * @param f the Fred_t structure whose myOther is sought. + * + * @return the value of the "myOther" element of this Fred_t as a Other*. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +const Other_t* +Fred_getMyOther(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "other" element is set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "other" element has been set, otherwise + * @c 0 (false) is returned. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetOther(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "other1" element is set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "other1" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetOther1(const Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if this Fred_t's "myOther" element is set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) if this Fred_t's "myOther" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_isSetMyOther(const Fred_t * f); + + +/** + * Sets the value of the "other" element of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param other Other_t* value of the "other" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setOther(Fred_t * f, const Other_t* other); + + +/** + * Sets the value of the "other1" element of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param other1 Other_t* value of the "other1" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setOther1(Fred_t * f, const Other_t* other1); + + +/** + * Sets the value of the "myOther" element of this Fred_t. + * + * @param f the Fred_t structure. + * + * @param other2 Other_t* value of the "myOther" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_setMyOther(Fred_t * f, const Other_t* other2); + + +/** + * Creates a new Other_t object, adds it to this Fred_t object and returns the + * Other_t object created. + * + * @param f the Fred_t structure to which the Other_t should be added. + * + * @return a new Other_t object instance. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +Other_t* +Fred_createOther(Fred_t* f); + + +/** + * Creates a new Other_t object, adds it to this Fred_t object and returns the + * Other_t object created. + * + * @param f the Fred_t structure to which the Other_t should be added. + * + * @return a new Other_t object instance. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +Other_t* +Fred_createOther1(Fred_t* f); + + +/** + * Creates a new Other_t object, adds it to this Fred_t object and returns the + * Other_t object created. + * + * @param f the Fred_t structure to which the Other_t should be added. + * + * @return a new Other_t object instance. + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +Other_t* +Fred_createMyOther(Fred_t* f); + + +/** + * Unsets the value of the "other" element of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetOther(Fred_t * f); + + +/** + * Unsets the value of the "other1" element of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetOther1(Fred_t * f); + + +/** + * Unsets the value of the "myOther" element of this Fred_t. + * + * @param f the Fred_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_unsetMyOther(Fred_t * f); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Fred_t object have been set. + * + * @param f the Fred_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Fred_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the Fred_t object are: + * @li "identifier" + * @li "myNumber" + * + * @memberof Fred_t + */ +LIBSBML_EXTERN +int +Fred_hasRequiredAttributes(const Fred_t * f); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Fred_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/FunctionTerm.cpp b/generator/tests/test_cpp_code/test-code/FunctionTerm.cpp index 6d4d5d76..74122b48 100644 --- a/generator/tests/test_cpp_code/test-code/FunctionTerm.cpp +++ b/generator/tests/test_cpp_code/test-code/FunctionTerm.cpp @@ -1,1041 +1,1041 @@ -/** - * @file FunctionTerm.cpp - * @brief Implementation of the FunctionTerm class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new FunctionTerm using the given SBML Level, Version and - * “qual” package version. - */ -FunctionTerm::FunctionTerm(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mResultLevel (SBML_INT_MAX) - , mIsSetResultLevel (false) - , mMath (NULL) -{ - setSBMLNamespacesAndOwn(new QualPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new FunctionTerm using the given QualPkgNamespaces object. - */ -FunctionTerm::FunctionTerm(QualPkgNamespaces *qualns) - : SBase(qualns) - , mResultLevel (SBML_INT_MAX) - , mIsSetResultLevel (false) - , mMath (NULL) -{ - setElementNamespace(qualns->getURI()); - connectToChild(); - loadPlugins(qualns); -} - - -/* - * Copy constructor for FunctionTerm. - */ -FunctionTerm::FunctionTerm(const FunctionTerm& orig) - : SBase( orig ) - , mResultLevel ( orig.mResultLevel ) - , mIsSetResultLevel ( orig.mIsSetResultLevel ) - , mMath ( NULL ) -{ - if (orig.mMath != NULL) - { - mMath = orig.mMath->deepCopy(); - } - - connectToChild(); -} - - -/* - * Assignment operator for FunctionTerm. - */ -FunctionTerm& -FunctionTerm::operator=(const FunctionTerm& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mResultLevel = rhs.mResultLevel; - mIsSetResultLevel = rhs.mIsSetResultLevel; - delete mMath; - if (rhs.mMath != NULL) - { - mMath = rhs.mMath->deepCopy(); - } - else - { - mMath = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this FunctionTerm object. - */ -FunctionTerm* -FunctionTerm::clone() const -{ - return new FunctionTerm(*this); -} - - -/* - * Destructor for FunctionTerm. - */ -FunctionTerm::~FunctionTerm() -{ - delete mMath; - mMath = NULL; -} - - -/* - * Returns the value of the "resultLevel" attribute of this FunctionTerm. - */ -unsigned int -FunctionTerm::getResultLevel() const -{ - return mResultLevel; -} - - -/* - * Predicate returning @c true if this FunctionTerm's "resultLevel" attribute - * is set. - */ -bool -FunctionTerm::isSetResultLevel() const -{ - return mIsSetResultLevel; -} - - -/* - * Sets the value of the "resultLevel" attribute of this FunctionTerm. - */ -int -FunctionTerm::setResultLevel(unsigned int resultLevel) -{ - mResultLevel = resultLevel; - mIsSetResultLevel = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "resultLevel" attribute of this FunctionTerm. - */ -int -FunctionTerm::unsetResultLevel() -{ - mResultLevel = SBML_INT_MAX; - mIsSetResultLevel = false; - - if (isSetResultLevel() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "math" element of this FunctionTerm. - */ -const ASTNode* -FunctionTerm::getMath() const -{ - return mMath; -} - - -/* - * Returns the value of the "math" element of this FunctionTerm. - */ -ASTNode* -FunctionTerm::getMath() -{ - return mMath; -} - - -/* - * Predicate returning @c true if this FunctionTerm's "math" element is set. - */ -bool -FunctionTerm::isSetMath() const -{ - return (mMath != NULL); -} - - -/* - * Sets the value of the "math" element of this FunctionTerm. - */ -int -FunctionTerm::setMath(const ASTNode* math) -{ - if (mMath == math) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (math == NULL) - { - delete mMath; - mMath = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else if (!(math->isWellFormedASTNode())) - { - return LIBSBML_INVALID_OBJECT; - } - else - { - delete mMath; - mMath = (math != NULL) ? math->deepCopy() : NULL; - if (mMath != NULL) - { - mMath->setParentSBMLObject(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Unsets the value of the "math" element of this FunctionTerm. - */ -int -FunctionTerm::unsetMath() -{ - delete mMath; - mMath = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * @copydoc doc_renamesidref_common - */ -void -FunctionTerm::renameSIdRefs(const std::string& oldid, - const std::string& newid) -{ - if (isSetMath()) - { - mMath->renameSIdRefs(oldid, newid); - } -} - - -/* - * Returns the XML element name of this FunctionTerm object. - */ -const std::string& -FunctionTerm::getElementName() const -{ - static const string name = "functionTerm"; - return name; -} - - -/* - * Returns the libSBML type code for this FunctionTerm object. - */ -int -FunctionTerm::getTypeCode() const -{ - return SBML_QUAL_FUNCTION_TERM; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * FunctionTerm object have been set. - */ -bool -FunctionTerm::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetResultLevel() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * FunctionTerm object have been set. - */ -bool -FunctionTerm::hasRequiredElements() const -{ - bool allPresent = true; - - if (isSetMath() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -FunctionTerm::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetMath() == true) - { - writeMathML(getMath(), stream, getSBMLNamespaces()); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -FunctionTerm::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -FunctionTerm::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -FunctionTerm::connectToChild() -{ - SBase::connectToChild(); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -FunctionTerm::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -FunctionTerm::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "resultLevel") - { - value = getResultLevel(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this FunctionTerm's attribute "attributeName" - * is set. - */ -bool -FunctionTerm::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "resultLevel") - { - value = isSetResultLevel(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "resultLevel") - { - return_value = setResultLevel(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this FunctionTerm. - */ -int -FunctionTerm::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "resultLevel") - { - value = unsetResultLevel(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -FunctionTerm::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("resultLevel"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -FunctionTerm::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("qual", - QualTransitionLOFunctionTermsAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("qual", - QualTransitionLOFunctionTermsAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("qual", QualFunctionTermAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("qual", QualFunctionTermAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // resultLevel uint (use = "required" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetResultLevel = attributes.readInto("resultLevel", mResultLevel); - - if ( mIsSetResultLevel == false && log) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - std::string message = "Qual attribute 'resultLevel' from the " - " element must be an integer."; - log->logPackageError("qual", - QualFunctionTermResultLevelMustBeNonNegativeInteger, pkgVersion, level, - version, message, getLine(), getColumn()); - } - else - { - std::string message = "Qual attribute 'resultLevel' is missing from the " - " element."; - log->logPackageError("qual", QualFunctionTermAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads other XML such as math/notes etc. - */ -bool -FunctionTerm::readOtherXML(XMLInputStream& stream) -{ - bool read = false; - const string& name = stream.peek().getName(); - - if (name == "math") - { - const XMLToken elem = stream.peek(); - const std::string prefix = checkMathMLNamespace(elem); - if (stream.getSBMLNamespaces() == NULL) - { - stream.setSBMLNamespaces(new SBMLNamespaces(getLevel(), getVersion())); - } - - delete mMath; - mMath = readMathML(stream, prefix); - read = true; - } - - if (SBase::readOtherXML(stream)) - { - read = true; - } - - return read; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -FunctionTerm::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetResultLevel() == true) - { - stream.writeAttribute("resultLevel", getPrefix(), mResultLevel); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new FunctionTerm_t using the given SBML Level, Version and - * “qual” package version. - */ -LIBSBML_EXTERN -FunctionTerm_t * -FunctionTerm_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new FunctionTerm(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this FunctionTerm_t object. - */ -LIBSBML_EXTERN -FunctionTerm_t* -FunctionTerm_clone(const FunctionTerm_t* ft) -{ - if (ft != NULL) - { - return static_cast(ft->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this FunctionTerm_t object. - */ -LIBSBML_EXTERN -void -FunctionTerm_free(FunctionTerm_t* ft) -{ - if (ft != NULL) - { - delete ft; - } -} - - -/* - * Returns the value of the "resultLevel" attribute of this FunctionTerm_t. - */ -LIBSBML_EXTERN -unsigned int -FunctionTerm_getResultLevel(const FunctionTerm_t * ft) -{ - return (ft != NULL) ? ft->getResultLevel() : SBML_INT_MAX; -} - - -/* - * Predicate returning @c 1 (true) if this FunctionTerm_t's "resultLevel" - * attribute is set. - */ -LIBSBML_EXTERN -int -FunctionTerm_isSetResultLevel(const FunctionTerm_t * ft) -{ - return (ft != NULL) ? static_cast(ft->isSetResultLevel()) : 0; -} - - -/* - * Sets the value of the "resultLevel" attribute of this FunctionTerm_t. - */ -LIBSBML_EXTERN -int -FunctionTerm_setResultLevel(FunctionTerm_t * ft, unsigned int resultLevel) -{ - return (ft != NULL) ? ft->setResultLevel(resultLevel) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "resultLevel" attribute of this FunctionTerm_t. - */ -LIBSBML_EXTERN -int -FunctionTerm_unsetResultLevel(FunctionTerm_t * ft) -{ - return (ft != NULL) ? ft->unsetResultLevel() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "math" element of this FunctionTerm_t. - */ -LIBSBML_EXTERN -const ASTNode_t* -FunctionTerm_getMath(const FunctionTerm_t * ft) -{ - if (ft == NULL) - { - return NULL; - } - - return (ASTNode_t*)(ft->getMath()); -} - - -/* - * Predicate returning @c 1 (true) if this FunctionTerm_t's "math" element is - * set. - */ -LIBSBML_EXTERN -int -FunctionTerm_isSetMath(const FunctionTerm_t * ft) -{ - return (ft != NULL) ? static_cast(ft->isSetMath()) : 0; -} - - -/* - * Sets the value of the "math" element of this FunctionTerm_t. - */ -LIBSBML_EXTERN -int -FunctionTerm_setMath(FunctionTerm_t * ft, const ASTNode_t* math) -{ - return (ft != NULL) ? ft->setMath(math) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "math" element of this FunctionTerm_t. - */ -LIBSBML_EXTERN -int -FunctionTerm_unsetMath(FunctionTerm_t * ft) -{ - return (ft != NULL) ? ft->unsetMath() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * FunctionTerm_t object have been set. - */ -LIBSBML_EXTERN -int -FunctionTerm_hasRequiredAttributes(const FunctionTerm_t * ft) -{ - return (ft != NULL) ? static_cast(ft->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * FunctionTerm_t object have been set. - */ -LIBSBML_EXTERN -int -FunctionTerm_hasRequiredElements(const FunctionTerm_t * ft) -{ - return (ft != NULL) ? static_cast(ft->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file FunctionTerm.cpp + * @brief Implementation of the FunctionTerm class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new FunctionTerm using the given SBML Level, Version and + * “qual” package version. + */ +FunctionTerm::FunctionTerm(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mResultLevel (SBML_INT_MAX) + , mIsSetResultLevel (false) + , mMath (NULL) +{ + setSBMLNamespacesAndOwn(new QualPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new FunctionTerm using the given QualPkgNamespaces object. + */ +FunctionTerm::FunctionTerm(QualPkgNamespaces *qualns) + : SBase(qualns) + , mResultLevel (SBML_INT_MAX) + , mIsSetResultLevel (false) + , mMath (NULL) +{ + setElementNamespace(qualns->getURI()); + connectToChild(); + loadPlugins(qualns); +} + + +/* + * Copy constructor for FunctionTerm. + */ +FunctionTerm::FunctionTerm(const FunctionTerm& orig) + : SBase( orig ) + , mResultLevel ( orig.mResultLevel ) + , mIsSetResultLevel ( orig.mIsSetResultLevel ) + , mMath ( NULL ) +{ + if (orig.mMath != NULL) + { + mMath = orig.mMath->deepCopy(); + } + + connectToChild(); +} + + +/* + * Assignment operator for FunctionTerm. + */ +FunctionTerm& +FunctionTerm::operator=(const FunctionTerm& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mResultLevel = rhs.mResultLevel; + mIsSetResultLevel = rhs.mIsSetResultLevel; + delete mMath; + if (rhs.mMath != NULL) + { + mMath = rhs.mMath->deepCopy(); + } + else + { + mMath = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this FunctionTerm object. + */ +FunctionTerm* +FunctionTerm::clone() const +{ + return new FunctionTerm(*this); +} + + +/* + * Destructor for FunctionTerm. + */ +FunctionTerm::~FunctionTerm() +{ + delete mMath; + mMath = NULL; +} + + +/* + * Returns the value of the "resultLevel" attribute of this FunctionTerm. + */ +unsigned int +FunctionTerm::getResultLevel() const +{ + return mResultLevel; +} + + +/* + * Predicate returning @c true if this FunctionTerm's "resultLevel" attribute + * is set. + */ +bool +FunctionTerm::isSetResultLevel() const +{ + return mIsSetResultLevel; +} + + +/* + * Sets the value of the "resultLevel" attribute of this FunctionTerm. + */ +int +FunctionTerm::setResultLevel(unsigned int resultLevel) +{ + mResultLevel = resultLevel; + mIsSetResultLevel = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "resultLevel" attribute of this FunctionTerm. + */ +int +FunctionTerm::unsetResultLevel() +{ + mResultLevel = SBML_INT_MAX; + mIsSetResultLevel = false; + + if (isSetResultLevel() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "math" element of this FunctionTerm. + */ +const ASTNode* +FunctionTerm::getMath() const +{ + return mMath; +} + + +/* + * Returns the value of the "math" element of this FunctionTerm. + */ +ASTNode* +FunctionTerm::getMath() +{ + return mMath; +} + + +/* + * Predicate returning @c true if this FunctionTerm's "math" element is set. + */ +bool +FunctionTerm::isSetMath() const +{ + return (mMath != NULL); +} + + +/* + * Sets the value of the "math" element of this FunctionTerm. + */ +int +FunctionTerm::setMath(const ASTNode* math) +{ + if (mMath == math) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (math == NULL) + { + delete mMath; + mMath = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else if (!(math->isWellFormedASTNode())) + { + return LIBSBML_INVALID_OBJECT; + } + else + { + delete mMath; + mMath = (math != NULL) ? math->deepCopy() : NULL; + if (mMath != NULL) + { + mMath->setParentSBMLObject(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Unsets the value of the "math" element of this FunctionTerm. + */ +int +FunctionTerm::unsetMath() +{ + delete mMath; + mMath = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * @copydoc doc_renamesidref_common + */ +void +FunctionTerm::renameSIdRefs(const std::string& oldid, + const std::string& newid) +{ + if (isSetMath()) + { + mMath->renameSIdRefs(oldid, newid); + } +} + + +/* + * Returns the XML element name of this FunctionTerm object. + */ +const std::string& +FunctionTerm::getElementName() const +{ + static const string name = "functionTerm"; + return name; +} + + +/* + * Returns the libSBML type code for this FunctionTerm object. + */ +int +FunctionTerm::getTypeCode() const +{ + return SBML_QUAL_FUNCTION_TERM; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * FunctionTerm object have been set. + */ +bool +FunctionTerm::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetResultLevel() == false) + { + allPresent = false; + } + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * FunctionTerm object have been set. + */ +bool +FunctionTerm::hasRequiredElements() const +{ + bool allPresent = true; + + if (isSetMath() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +FunctionTerm::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetMath() == true) + { + writeMathML(getMath(), stream, getSBMLNamespaces()); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +FunctionTerm::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +FunctionTerm::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +FunctionTerm::connectToChild() +{ + SBase::connectToChild(); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +FunctionTerm::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +FunctionTerm::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "resultLevel") + { + value = getResultLevel(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this FunctionTerm's attribute "attributeName" + * is set. + */ +bool +FunctionTerm::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "resultLevel") + { + value = isSetResultLevel(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "resultLevel") + { + return_value = setResultLevel(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this FunctionTerm. + */ +int +FunctionTerm::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "resultLevel") + { + value = unsetResultLevel(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +FunctionTerm::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("resultLevel"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +FunctionTerm::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("qual", + QualTransitionLOFunctionTermsAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("qual", + QualTransitionLOFunctionTermsAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("qual", QualFunctionTermAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("qual", QualFunctionTermAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // resultLevel uint (use = "required" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetResultLevel = attributes.readInto("resultLevel", mResultLevel); + + if ( mIsSetResultLevel == false && log) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + std::string message = "Qual attribute 'resultLevel' from the " + " element must be an integer."; + log->logPackageError("qual", + QualFunctionTermResultLevelMustBeNonNegativeInteger, pkgVersion, level, + version, message, getLine(), getColumn()); + } + else + { + std::string message = "Qual attribute 'resultLevel' is missing from the " + " element."; + log->logPackageError("qual", QualFunctionTermAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads other XML such as math/notes etc. + */ +bool +FunctionTerm::readOtherXML(XMLInputStream& stream) +{ + bool read = false; + const string& name = stream.peek().getName(); + + if (name == "math") + { + const XMLToken elem = stream.peek(); + const std::string prefix = checkMathMLNamespace(elem); + if (stream.getSBMLNamespaces() == NULL) + { + stream.setSBMLNamespaces(new SBMLNamespaces(getLevel(), getVersion())); + } + + delete mMath; + mMath = readMathML(stream, prefix); + read = true; + } + + if (SBase::readOtherXML(stream)) + { + read = true; + } + + return read; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +FunctionTerm::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetResultLevel() == true) + { + stream.writeAttribute("resultLevel", getPrefix(), mResultLevel); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new FunctionTerm_t using the given SBML Level, Version and + * “qual” package version. + */ +LIBSBML_EXTERN +FunctionTerm_t * +FunctionTerm_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new FunctionTerm(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this FunctionTerm_t object. + */ +LIBSBML_EXTERN +FunctionTerm_t* +FunctionTerm_clone(const FunctionTerm_t* ft) +{ + if (ft != NULL) + { + return static_cast(ft->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this FunctionTerm_t object. + */ +LIBSBML_EXTERN +void +FunctionTerm_free(FunctionTerm_t* ft) +{ + if (ft != NULL) + { + delete ft; + } +} + + +/* + * Returns the value of the "resultLevel" attribute of this FunctionTerm_t. + */ +LIBSBML_EXTERN +unsigned int +FunctionTerm_getResultLevel(const FunctionTerm_t * ft) +{ + return (ft != NULL) ? ft->getResultLevel() : SBML_INT_MAX; +} + + +/* + * Predicate returning @c 1 (true) if this FunctionTerm_t's "resultLevel" + * attribute is set. + */ +LIBSBML_EXTERN +int +FunctionTerm_isSetResultLevel(const FunctionTerm_t * ft) +{ + return (ft != NULL) ? static_cast(ft->isSetResultLevel()) : 0; +} + + +/* + * Sets the value of the "resultLevel" attribute of this FunctionTerm_t. + */ +LIBSBML_EXTERN +int +FunctionTerm_setResultLevel(FunctionTerm_t * ft, unsigned int resultLevel) +{ + return (ft != NULL) ? ft->setResultLevel(resultLevel) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "resultLevel" attribute of this FunctionTerm_t. + */ +LIBSBML_EXTERN +int +FunctionTerm_unsetResultLevel(FunctionTerm_t * ft) +{ + return (ft != NULL) ? ft->unsetResultLevel() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "math" element of this FunctionTerm_t. + */ +LIBSBML_EXTERN +const ASTNode_t* +FunctionTerm_getMath(const FunctionTerm_t * ft) +{ + if (ft == NULL) + { + return NULL; + } + + return (ASTNode_t*)(ft->getMath()); +} + + +/* + * Predicate returning @c 1 (true) if this FunctionTerm_t's "math" element is + * set. + */ +LIBSBML_EXTERN +int +FunctionTerm_isSetMath(const FunctionTerm_t * ft) +{ + return (ft != NULL) ? static_cast(ft->isSetMath()) : 0; +} + + +/* + * Sets the value of the "math" element of this FunctionTerm_t. + */ +LIBSBML_EXTERN +int +FunctionTerm_setMath(FunctionTerm_t * ft, const ASTNode_t* math) +{ + return (ft != NULL) ? ft->setMath(math) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "math" element of this FunctionTerm_t. + */ +LIBSBML_EXTERN +int +FunctionTerm_unsetMath(FunctionTerm_t * ft) +{ + return (ft != NULL) ? ft->unsetMath() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * FunctionTerm_t object have been set. + */ +LIBSBML_EXTERN +int +FunctionTerm_hasRequiredAttributes(const FunctionTerm_t * ft) +{ + return (ft != NULL) ? static_cast(ft->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * FunctionTerm_t object have been set. + */ +LIBSBML_EXTERN +int +FunctionTerm_hasRequiredElements(const FunctionTerm_t * ft) +{ + return (ft != NULL) ? static_cast(ft->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/FunctionTerm.h b/generator/tests/test_cpp_code/test-code/FunctionTerm.h index c4cfe3b1..c99f8128 100644 --- a/generator/tests/test_cpp_code/test-code/FunctionTerm.h +++ b/generator/tests/test_cpp_code/test-code/FunctionTerm.h @@ -1,929 +1,929 @@ -/** - * @file FunctionTerm.h - * @brief Definition of the FunctionTerm class. - * @author SBMLTeam - * - * - * - * @class FunctionTerm - * @sbmlbrief{qual} TODO:Definition of the FunctionTerm class. - */ - - -#ifndef FunctionTerm_H__ -#define FunctionTerm_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN FunctionTerm : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - unsigned int mResultLevel; - bool mIsSetResultLevel; - ASTNode* mMath; - - /** @endcond */ - -public: - - /** - * Creates a new FunctionTerm using the given SBML Level, Version and - * “qual” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * FunctionTerm. - * - * @param version an unsigned int, the SBML Version to assign to this - * FunctionTerm. - * - * @param pkgVersion an unsigned int, the SBML Qual Version to assign to this - * FunctionTerm. - * - * @copydetails doc_note_setting_lv_pkg - */ - FunctionTerm(unsigned int level = QualExtension::getDefaultLevel(), - unsigned int version = QualExtension::getDefaultVersion(), - unsigned int pkgVersion = - QualExtension::getDefaultPackageVersion()); - - - /** - * Creates a new FunctionTerm using the given QualPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param qualns the QualPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - FunctionTerm(QualPkgNamespaces *qualns); - - - /** - * Copy constructor for FunctionTerm. - * - * @param orig the FunctionTerm instance to copy. - */ - FunctionTerm(const FunctionTerm& orig); - - - /** - * Assignment operator for FunctionTerm. - * - * @param rhs the FunctionTerm object whose values are to be used as the - * basis of the assignment. - */ - FunctionTerm& operator=(const FunctionTerm& rhs); - - - /** - * Creates and returns a deep copy of this FunctionTerm object. - * - * @return a (deep) copy of this FunctionTerm object. - */ - virtual FunctionTerm* clone() const; - - - /** - * Destructor for FunctionTerm. - */ - virtual ~FunctionTerm(); - - - /** - * Returns the value of the "resultLevel" attribute of this FunctionTerm. - * - * @return the value of the "resultLevel" attribute of this FunctionTerm as a - * unsigned integer. - */ - unsigned int getResultLevel() const; - - - /** - * Predicate returning @c true if this FunctionTerm's "resultLevel" attribute - * is set. - * - * @return @c true if this FunctionTerm's "resultLevel" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetResultLevel() const; - - - /** - * Sets the value of the "resultLevel" attribute of this FunctionTerm. - * - * @param resultLevel unsigned int value of the "resultLevel" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setResultLevel(unsigned int resultLevel); - - - /** - * Unsets the value of the "resultLevel" attribute of this FunctionTerm. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetResultLevel(); - - - /** - * Returns the value of the "math" element of this FunctionTerm. - * - * @return the value of the "math" element of this FunctionTerm as a - * ASTNode*. - */ - const ASTNode* getMath() const; - - - /** - * Returns the value of the "math" element of this FunctionTerm. - * - * @return the value of the "math" element of this FunctionTerm as a - * ASTNode*. - */ - ASTNode* getMath(); - - - /** - * Predicate returning @c true if this FunctionTerm's "math" element is set. - * - * @return @c true if this FunctionTerm's "math" element has been set, - * otherwise @c false is returned. - */ - bool isSetMath() const; - - - /** - * Sets the value of the "math" element of this FunctionTerm. - * - * @param math ASTNode* value of the "math" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setMath(const ASTNode* math); - - - /** - * Unsets the value of the "math" element of this FunctionTerm. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetMath(); - - - /** - * @copydoc doc_renamesidref_common - */ - virtual void renameSIdRefs(const std::string& oldid, - const std::string& newid); - - - /** - * Returns the XML element name of this FunctionTerm object. - * - * For FunctionTerm, the XML element name is always @c "functionTerm". - * - * @return the name of this element, i.e. @c "functionTerm". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this FunctionTerm object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_QUAL_FUNCTION_TERM, SBMLQualTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * FunctionTerm object have been set. - * - * @return @c true to indicate that all the required attributes of this - * FunctionTerm have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the FunctionTerm object are: - * @li "resultLevel" - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * FunctionTerm object have been set. - * - * @return @c true to indicate that all the required elements of this - * FunctionTerm have been set, otherwise @c false is returned. - * - * - * @note The required elements for the FunctionTerm object are: - * @li "math" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this FunctionTerm's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this FunctionTerm's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this FunctionTerm. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads other XML such as math/notes etc. - */ - virtual bool readOtherXML(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new FunctionTerm_t using the given SBML Level, Version and - * “qual” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * FunctionTerm_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * FunctionTerm_t. - * - * @param pkgVersion an unsigned int, the SBML Qual Version to assign to this - * FunctionTerm_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -FunctionTerm_t * -FunctionTerm_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this FunctionTerm_t object. - * - * @param ft the FunctionTerm_t structure. - * - * @return a (deep) copy of this FunctionTerm_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -FunctionTerm_t* -FunctionTerm_clone(const FunctionTerm_t* ft); - - -/** - * Frees this FunctionTerm_t object. - * - * @param ft the FunctionTerm_t structure. - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -void -FunctionTerm_free(FunctionTerm_t* ft); - - -/** - * Returns the value of the "resultLevel" attribute of this FunctionTerm_t. - * - * @param ft the FunctionTerm_t structure whose resultLevel is sought. - * - * @return the value of the "resultLevel" attribute of this FunctionTerm_t as a - * unsigned integer. - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -unsigned int -FunctionTerm_getResultLevel(const FunctionTerm_t * ft); - - -/** - * Predicate returning @c 1 (true) if this FunctionTerm_t's "resultLevel" - * attribute is set. - * - * @param ft the FunctionTerm_t structure. - * - * @return @c 1 (true) if this FunctionTerm_t's "resultLevel" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_isSetResultLevel(const FunctionTerm_t * ft); - - -/** - * Sets the value of the "resultLevel" attribute of this FunctionTerm_t. - * - * @param ft the FunctionTerm_t structure. - * - * @param resultLevel unsigned int value of the "resultLevel" attribute to be - * set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_setResultLevel(FunctionTerm_t * ft, unsigned int resultLevel); - - -/** - * Unsets the value of the "resultLevel" attribute of this FunctionTerm_t. - * - * @param ft the FunctionTerm_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_unsetResultLevel(FunctionTerm_t * ft); - - -/** - * Returns the value of the "math" element of this FunctionTerm_t. - * - * @param ft the FunctionTerm_t structure whose math is sought. - * - * @return the value of the "math" element of this FunctionTerm_t as a pointer - * to an ASTNode_t object. - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -const ASTNode_t* -FunctionTerm_getMath(const FunctionTerm_t * ft); - - -/** - * Predicate returning @c 1 (true) if this FunctionTerm_t's "math" element is - * set. - * - * @param ft the FunctionTerm_t structure. - * - * @return @c 1 (true) if this FunctionTerm_t's "math" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_isSetMath(const FunctionTerm_t * ft); - - -/** - * Sets the value of the "math" element of this FunctionTerm_t. - * - * @param ft the FunctionTerm_t structure. - * - * @param math ASTNode_t * pointer to the "math" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_setMath(FunctionTerm_t * ft, const ASTNode_t* math); - - -/** - * Unsets the value of the "math" element of this FunctionTerm_t. - * - * @param ft the FunctionTerm_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_unsetMath(FunctionTerm_t * ft); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * FunctionTerm_t object have been set. - * - * @param ft the FunctionTerm_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * FunctionTerm_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the FunctionTerm_t object are: - * @li "resultLevel" - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_hasRequiredAttributes(const FunctionTerm_t * ft); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * FunctionTerm_t object have been set. - * - * @param ft the FunctionTerm_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * FunctionTerm_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the FunctionTerm_t object are: - * @li "math" - * - * @memberof FunctionTerm_t - */ -LIBSBML_EXTERN -int -FunctionTerm_hasRequiredElements(const FunctionTerm_t * ft); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !FunctionTerm_H__ */ - - +/** + * @file FunctionTerm.h + * @brief Definition of the FunctionTerm class. + * @author SBMLTeam + * + * + * + * @class FunctionTerm + * @sbmlbrief{qual} TODO:Definition of the FunctionTerm class. + */ + + +#ifndef FunctionTerm_H__ +#define FunctionTerm_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN FunctionTerm : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + unsigned int mResultLevel; + bool mIsSetResultLevel; + ASTNode* mMath; + + /** @endcond */ + +public: + + /** + * Creates a new FunctionTerm using the given SBML Level, Version and + * “qual” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * FunctionTerm. + * + * @param version an unsigned int, the SBML Version to assign to this + * FunctionTerm. + * + * @param pkgVersion an unsigned int, the SBML Qual Version to assign to this + * FunctionTerm. + * + * @copydetails doc_note_setting_lv_pkg + */ + FunctionTerm(unsigned int level = QualExtension::getDefaultLevel(), + unsigned int version = QualExtension::getDefaultVersion(), + unsigned int pkgVersion = + QualExtension::getDefaultPackageVersion()); + + + /** + * Creates a new FunctionTerm using the given QualPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param qualns the QualPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + FunctionTerm(QualPkgNamespaces *qualns); + + + /** + * Copy constructor for FunctionTerm. + * + * @param orig the FunctionTerm instance to copy. + */ + FunctionTerm(const FunctionTerm& orig); + + + /** + * Assignment operator for FunctionTerm. + * + * @param rhs the FunctionTerm object whose values are to be used as the + * basis of the assignment. + */ + FunctionTerm& operator=(const FunctionTerm& rhs); + + + /** + * Creates and returns a deep copy of this FunctionTerm object. + * + * @return a (deep) copy of this FunctionTerm object. + */ + virtual FunctionTerm* clone() const; + + + /** + * Destructor for FunctionTerm. + */ + virtual ~FunctionTerm(); + + + /** + * Returns the value of the "resultLevel" attribute of this FunctionTerm. + * + * @return the value of the "resultLevel" attribute of this FunctionTerm as a + * unsigned integer. + */ + unsigned int getResultLevel() const; + + + /** + * Predicate returning @c true if this FunctionTerm's "resultLevel" attribute + * is set. + * + * @return @c true if this FunctionTerm's "resultLevel" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetResultLevel() const; + + + /** + * Sets the value of the "resultLevel" attribute of this FunctionTerm. + * + * @param resultLevel unsigned int value of the "resultLevel" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setResultLevel(unsigned int resultLevel); + + + /** + * Unsets the value of the "resultLevel" attribute of this FunctionTerm. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetResultLevel(); + + + /** + * Returns the value of the "math" element of this FunctionTerm. + * + * @return the value of the "math" element of this FunctionTerm as a + * ASTNode*. + */ + const ASTNode* getMath() const; + + + /** + * Returns the value of the "math" element of this FunctionTerm. + * + * @return the value of the "math" element of this FunctionTerm as a + * ASTNode*. + */ + ASTNode* getMath(); + + + /** + * Predicate returning @c true if this FunctionTerm's "math" element is set. + * + * @return @c true if this FunctionTerm's "math" element has been set, + * otherwise @c false is returned. + */ + bool isSetMath() const; + + + /** + * Sets the value of the "math" element of this FunctionTerm. + * + * @param math ASTNode* value of the "math" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setMath(const ASTNode* math); + + + /** + * Unsets the value of the "math" element of this FunctionTerm. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetMath(); + + + /** + * @copydoc doc_renamesidref_common + */ + virtual void renameSIdRefs(const std::string& oldid, + const std::string& newid); + + + /** + * Returns the XML element name of this FunctionTerm object. + * + * For FunctionTerm, the XML element name is always @c "functionTerm". + * + * @return the name of this element, i.e. @c "functionTerm". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this FunctionTerm object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_QUAL_FUNCTION_TERM, SBMLQualTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * FunctionTerm object have been set. + * + * @return @c true to indicate that all the required attributes of this + * FunctionTerm have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the FunctionTerm object are: + * @li "resultLevel" + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * FunctionTerm object have been set. + * + * @return @c true to indicate that all the required elements of this + * FunctionTerm have been set, otherwise @c false is returned. + * + * + * @note The required elements for the FunctionTerm object are: + * @li "math" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this FunctionTerm's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this FunctionTerm's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this FunctionTerm. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads other XML such as math/notes etc. + */ + virtual bool readOtherXML(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new FunctionTerm_t using the given SBML Level, Version and + * “qual” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * FunctionTerm_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * FunctionTerm_t. + * + * @param pkgVersion an unsigned int, the SBML Qual Version to assign to this + * FunctionTerm_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +FunctionTerm_t * +FunctionTerm_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this FunctionTerm_t object. + * + * @param ft the FunctionTerm_t structure. + * + * @return a (deep) copy of this FunctionTerm_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +FunctionTerm_t* +FunctionTerm_clone(const FunctionTerm_t* ft); + + +/** + * Frees this FunctionTerm_t object. + * + * @param ft the FunctionTerm_t structure. + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +void +FunctionTerm_free(FunctionTerm_t* ft); + + +/** + * Returns the value of the "resultLevel" attribute of this FunctionTerm_t. + * + * @param ft the FunctionTerm_t structure whose resultLevel is sought. + * + * @return the value of the "resultLevel" attribute of this FunctionTerm_t as a + * unsigned integer. + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +unsigned int +FunctionTerm_getResultLevel(const FunctionTerm_t * ft); + + +/** + * Predicate returning @c 1 (true) if this FunctionTerm_t's "resultLevel" + * attribute is set. + * + * @param ft the FunctionTerm_t structure. + * + * @return @c 1 (true) if this FunctionTerm_t's "resultLevel" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_isSetResultLevel(const FunctionTerm_t * ft); + + +/** + * Sets the value of the "resultLevel" attribute of this FunctionTerm_t. + * + * @param ft the FunctionTerm_t structure. + * + * @param resultLevel unsigned int value of the "resultLevel" attribute to be + * set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_setResultLevel(FunctionTerm_t * ft, unsigned int resultLevel); + + +/** + * Unsets the value of the "resultLevel" attribute of this FunctionTerm_t. + * + * @param ft the FunctionTerm_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_unsetResultLevel(FunctionTerm_t * ft); + + +/** + * Returns the value of the "math" element of this FunctionTerm_t. + * + * @param ft the FunctionTerm_t structure whose math is sought. + * + * @return the value of the "math" element of this FunctionTerm_t as a pointer + * to an ASTNode_t object. + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +const ASTNode_t* +FunctionTerm_getMath(const FunctionTerm_t * ft); + + +/** + * Predicate returning @c 1 (true) if this FunctionTerm_t's "math" element is + * set. + * + * @param ft the FunctionTerm_t structure. + * + * @return @c 1 (true) if this FunctionTerm_t's "math" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_isSetMath(const FunctionTerm_t * ft); + + +/** + * Sets the value of the "math" element of this FunctionTerm_t. + * + * @param ft the FunctionTerm_t structure. + * + * @param math ASTNode_t * pointer to the "math" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_setMath(FunctionTerm_t * ft, const ASTNode_t* math); + + +/** + * Unsets the value of the "math" element of this FunctionTerm_t. + * + * @param ft the FunctionTerm_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_unsetMath(FunctionTerm_t * ft); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * FunctionTerm_t object have been set. + * + * @param ft the FunctionTerm_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * FunctionTerm_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the FunctionTerm_t object are: + * @li "resultLevel" + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_hasRequiredAttributes(const FunctionTerm_t * ft); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * FunctionTerm_t object have been set. + * + * @param ft the FunctionTerm_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * FunctionTerm_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the FunctionTerm_t object are: + * @li "math" + * + * @memberof FunctionTerm_t + */ +LIBSBML_EXTERN +int +FunctionTerm_hasRequiredElements(const FunctionTerm_t * ft); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !FunctionTerm_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Geometry.cpp b/generator/tests/test_cpp_code/test-code/Geometry.cpp index 3c6165fb..f2e18410 100644 --- a/generator/tests/test_cpp_code/test-code/Geometry.cpp +++ b/generator/tests/test_cpp_code/test-code/Geometry.cpp @@ -1,3406 +1,3406 @@ -/** - * @file Geometry.cpp - * @brief Implementation of the Geometry class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Geometry using the given SBML Level, Version and - * “spatial” package version. - */ -Geometry::Geometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mCoordinateSystem (SPATIAL_GEOMETRYKIND_INVALID) - , mCoordinateComponents (level, version, pkgVersion) - , mDomainTypes (level, version, pkgVersion) - , mDomains (level, version, pkgVersion) - , mAdjacentDomains (level, version, pkgVersion) - , mGeometryDefinitions (level, version, pkgVersion) - , mSampledFields (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new Geometry using the given SpatialPkgNamespaces object. - */ -Geometry::Geometry(SpatialPkgNamespaces *spatialns) - : SBase(spatialns) - , mCoordinateSystem (SPATIAL_GEOMETRYKIND_INVALID) - , mCoordinateComponents (spatialns) - , mDomainTypes (spatialns) - , mDomains (spatialns) - , mAdjacentDomains (spatialns) - , mGeometryDefinitions (spatialns) - , mSampledFields (spatialns) -{ - setElementNamespace(spatialns->getURI()); - connectToChild(); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for Geometry. - */ -Geometry::Geometry(const Geometry& orig) - : SBase( orig ) - , mCoordinateSystem ( orig.mCoordinateSystem ) - , mCoordinateComponents ( orig.mCoordinateComponents ) - , mDomainTypes ( orig.mDomainTypes ) - , mDomains ( orig.mDomains ) - , mAdjacentDomains ( orig.mAdjacentDomains ) - , mGeometryDefinitions ( orig.mGeometryDefinitions ) - , mSampledFields ( orig.mSampledFields ) -{ - connectToChild(); -} - - -/* - * Assignment operator for Geometry. - */ -Geometry& -Geometry::operator=(const Geometry& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mCoordinateSystem = rhs.mCoordinateSystem; - mCoordinateComponents = rhs.mCoordinateComponents; - mDomainTypes = rhs.mDomainTypes; - mDomains = rhs.mDomains; - mAdjacentDomains = rhs.mAdjacentDomains; - mGeometryDefinitions = rhs.mGeometryDefinitions; - mSampledFields = rhs.mSampledFields; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Geometry object. - */ -Geometry* -Geometry::clone() const -{ - return new Geometry(*this); -} - - -/* - * Destructor for Geometry. - */ -Geometry::~Geometry() -{ -} - - -/* - * Returns the value of the "id" attribute of this Geometry. - */ -const std::string& -Geometry::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "coordinateSystem" attribute of this Geometry. - */ -GeometryKind_t -Geometry::getCoordinateSystem() const -{ - return mCoordinateSystem; -} - - -/* - * Returns the value of the "coordinateSystem" attribute of this Geometry. - */ -std::string -Geometry::getCoordinateSystemAsString() const -{ - std::string code_str = GeometryKind_toString(mCoordinateSystem); - return code_str; -} - - -/* - * Predicate returning @c true if this Geometry's "id" attribute is set. - */ -bool -Geometry::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this Geometry's "coordinateSystem" attribute - * is set. - */ -bool -Geometry::isSetCoordinateSystem() const -{ - return (mCoordinateSystem != SPATIAL_GEOMETRYKIND_INVALID); -} - - -/* - * Sets the value of the "id" attribute of this Geometry. - */ -int -Geometry::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "coordinateSystem" attribute of this Geometry. - */ -int -Geometry::setCoordinateSystem(const GeometryKind_t coordinateSystem) -{ - if (GeometryKind_isValid(coordinateSystem) == 0) - { - mCoordinateSystem = SPATIAL_GEOMETRYKIND_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mCoordinateSystem = coordinateSystem; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "coordinateSystem" attribute of this Geometry. - */ -int -Geometry::setCoordinateSystem(const std::string& coordinateSystem) -{ - mCoordinateSystem = GeometryKind_fromString(coordinateSystem.c_str()); - - if (mCoordinateSystem == SPATIAL_GEOMETRYKIND_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this Geometry. - */ -int -Geometry::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "coordinateSystem" attribute of this Geometry. - */ -int -Geometry::unsetCoordinateSystem() -{ - mCoordinateSystem = SPATIAL_GEOMETRYKIND_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the ListOfCoordinateComponents from this Geometry. - */ -const ListOfCoordinateComponents* -Geometry::getListOfCoordinateComponents() const -{ - return &mCoordinateComponents; -} - - -/* - * Returns the ListOfCoordinateComponents from this Geometry. - */ -ListOfCoordinateComponents* -Geometry::getListOfCoordinateComponents() -{ - return &mCoordinateComponents; -} - - -/* - * Get a CoordinateComponent from the Geometry. - */ -CoordinateComponent* -Geometry::getCoordinateComponent(unsigned int n) -{ - return mCoordinateComponents.get(n); -} - - -/* - * Get a CoordinateComponent from the Geometry. - */ -const CoordinateComponent* -Geometry::getCoordinateComponent(unsigned int n) const -{ - return mCoordinateComponents.get(n); -} - - -/* - * Get a CoordinateComponent from the Geometry based on its identifier. - */ -CoordinateComponent* -Geometry::getCoordinateComponent(const std::string& sid) -{ - return mCoordinateComponents.get(sid); -} - - -/* - * Get a CoordinateComponent from the Geometry based on its identifier. - */ -const CoordinateComponent* -Geometry::getCoordinateComponent(const std::string& sid) const -{ - return mCoordinateComponents.get(sid); -} - - -/* - * Adds a copy of the given CoordinateComponent to this Geometry. - */ -int -Geometry::addCoordinateComponent(const CoordinateComponent* cc) -{ - if (cc == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (cc->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (cc->hasRequiredElements() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != cc->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != cc->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(cc)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (cc->isSetId() && (mCoordinateComponents.get(cc->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mCoordinateComponents.append(cc); - } -} - - -/* - * Get the number of CoordinateComponent objects in this Geometry. - */ -unsigned int -Geometry::getNumCoordinateComponents() const -{ - return mCoordinateComponents.size(); -} - - -/* - * Creates a new CoordinateComponent object, adds it to this Geometry object - * and returns the CoordinateComponent object created. - */ -CoordinateComponent* -Geometry::createCoordinateComponent() -{ - CoordinateComponent* cc = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - cc = new CoordinateComponent(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (cc != NULL) - { - mCoordinateComponents.appendAndOwn(cc); - } - - return cc; -} - - -/* - * Removes the nth CoordinateComponent from this Geometry and returns a pointer - * to it. - */ -CoordinateComponent* -Geometry::removeCoordinateComponent(unsigned int n) -{ - return mCoordinateComponents.remove(n); -} - - -/* - * Removes the CoordinateComponent from this Geometry based on its identifier - * and returns a pointer to it. - */ -CoordinateComponent* -Geometry::removeCoordinateComponent(const std::string& sid) -{ - return mCoordinateComponents.remove(sid); -} - - -/* - * Returns the ListOfDomainTypes from this Geometry. - */ -const ListOfDomainTypes* -Geometry::getListOfDomainTypes() const -{ - return &mDomainTypes; -} - - -/* - * Returns the ListOfDomainTypes from this Geometry. - */ -ListOfDomainTypes* -Geometry::getListOfDomainTypes() -{ - return &mDomainTypes; -} - - -/* - * Get a DomainType from the Geometry. - */ -DomainType* -Geometry::getDomainType(unsigned int n) -{ - return mDomainTypes.get(n); -} - - -/* - * Get a DomainType from the Geometry. - */ -const DomainType* -Geometry::getDomainType(unsigned int n) const -{ - return mDomainTypes.get(n); -} - - -/* - * Get a DomainType from the Geometry based on its identifier. - */ -DomainType* -Geometry::getDomainType(const std::string& sid) -{ - return mDomainTypes.get(sid); -} - - -/* - * Get a DomainType from the Geometry based on its identifier. - */ -const DomainType* -Geometry::getDomainType(const std::string& sid) const -{ - return mDomainTypes.get(sid); -} - - -/* - * Adds a copy of the given DomainType to this Geometry. - */ -int -Geometry::addDomainType(const DomainType* dt) -{ - if (dt == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (dt->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != dt->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != dt->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(dt)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (dt->isSetId() && (mDomainTypes.get(dt->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mDomainTypes.append(dt); - } -} - - -/* - * Get the number of DomainType objects in this Geometry. - */ -unsigned int -Geometry::getNumDomainTypes() const -{ - return mDomainTypes.size(); -} - - -/* - * Creates a new DomainType object, adds it to this Geometry object and returns - * the DomainType object created. - */ -DomainType* -Geometry::createDomainType() -{ - DomainType* dt = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - dt = new DomainType(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (dt != NULL) - { - mDomainTypes.appendAndOwn(dt); - } - - return dt; -} - - -/* - * Removes the nth DomainType from this Geometry and returns a pointer to it. - */ -DomainType* -Geometry::removeDomainType(unsigned int n) -{ - return mDomainTypes.remove(n); -} - - -/* - * Removes the DomainType from this Geometry based on its identifier and - * returns a pointer to it. - */ -DomainType* -Geometry::removeDomainType(const std::string& sid) -{ - return mDomainTypes.remove(sid); -} - - -/* - * Returns the ListOfDomains from this Geometry. - */ -const ListOfDomains* -Geometry::getListOfDomains() const -{ - return &mDomains; -} - - -/* - * Returns the ListOfDomains from this Geometry. - */ -ListOfDomains* -Geometry::getListOfDomains() -{ - return &mDomains; -} - - -/* - * Get a Domain from the Geometry. - */ -Domain* -Geometry::getDomain(unsigned int n) -{ - return mDomains.get(n); -} - - -/* - * Get a Domain from the Geometry. - */ -const Domain* -Geometry::getDomain(unsigned int n) const -{ - return mDomains.get(n); -} - - -/* - * Get a Domain from the Geometry based on its identifier. - */ -Domain* -Geometry::getDomain(const std::string& sid) -{ - return mDomains.get(sid); -} - - -/* - * Get a Domain from the Geometry based on its identifier. - */ -const Domain* -Geometry::getDomain(const std::string& sid) const -{ - return mDomains.get(sid); -} - - -/* - * Get a Domain from the Geometry based on the DomainType to which it refers. - */ -const Domain* -Geometry::getDomainByDomainType(const std::string& sid) const -{ - return mDomains.getByDomainType(sid); -} - - -/* - * Get a Domain from the Geometry based on the DomainType to which it refers. - */ -Domain* -Geometry::getDomainByDomainType(const std::string& sid) -{ - return mDomains.getByDomainType(sid); -} - - -/* - * Adds a copy of the given Domain to this Geometry. - */ -int -Geometry::addDomain(const Domain* d) -{ - if (d == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (d->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (d->hasRequiredElements() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != d->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != d->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(d)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (d->isSetId() && (mDomains.get(d->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mDomains.append(d); - } -} - - -/* - * Get the number of Domain objects in this Geometry. - */ -unsigned int -Geometry::getNumDomains() const -{ - return mDomains.size(); -} - - -/* - * Creates a new Domain object, adds it to this Geometry object and returns the - * Domain object created. - */ -Domain* -Geometry::createDomain() -{ - Domain* d = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - d = new Domain(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (d != NULL) - { - mDomains.appendAndOwn(d); - } - - return d; -} - - -/* - * Removes the nth Domain from this Geometry and returns a pointer to it. - */ -Domain* -Geometry::removeDomain(unsigned int n) -{ - return mDomains.remove(n); -} - - -/* - * Removes the Domain from this Geometry based on its identifier and returns a - * pointer to it. - */ -Domain* -Geometry::removeDomain(const std::string& sid) -{ - return mDomains.remove(sid); -} - - -/* - * Returns the ListOfAdjacentDomains from this Geometry. - */ -const ListOfAdjacentDomains* -Geometry::getListOfAdjacentDomains() const -{ - return &mAdjacentDomains; -} - - -/* - * Returns the ListOfAdjacentDomains from this Geometry. - */ -ListOfAdjacentDomains* -Geometry::getListOfAdjacentDomains() -{ - return &mAdjacentDomains; -} - - -/* - * Get an AdjacentDomains from the Geometry. - */ -AdjacentDomains* -Geometry::getAdjacentDomains(unsigned int n) -{ - return mAdjacentDomains.get(n); -} - - -/* - * Get an AdjacentDomains from the Geometry. - */ -const AdjacentDomains* -Geometry::getAdjacentDomains(unsigned int n) const -{ - return mAdjacentDomains.get(n); -} - - -/* - * Get an AdjacentDomains from the Geometry based on its identifier. - */ -AdjacentDomains* -Geometry::getAdjacentDomains(const std::string& sid) -{ - return mAdjacentDomains.get(sid); -} - - -/* - * Get an AdjacentDomains from the Geometry based on its identifier. - */ -const AdjacentDomains* -Geometry::getAdjacentDomains(const std::string& sid) const -{ - return mAdjacentDomains.get(sid); -} - - -/* - * Get an AdjacentDomains from the Geometry based on the Domain1 to which it - * refers. - */ -const AdjacentDomains* -Geometry::getAdjacentDomainsByDomain1(const std::string& sid) const -{ - return mAdjacentDomains.getByDomain1(sid); -} - - -/* - * Get an AdjacentDomains from the Geometry based on the Domain1 to which it - * refers. - */ -AdjacentDomains* -Geometry::getAdjacentDomainsByDomain1(const std::string& sid) -{ - return mAdjacentDomains.getByDomain1(sid); -} - - -/* - * Get an AdjacentDomains from the Geometry based on the Domain2 to which it - * refers. - */ -const AdjacentDomains* -Geometry::getAdjacentDomainsByDomain2(const std::string& sid) const -{ - return mAdjacentDomains.getByDomain2(sid); -} - - -/* - * Get an AdjacentDomains from the Geometry based on the Domain2 to which it - * refers. - */ -AdjacentDomains* -Geometry::getAdjacentDomainsByDomain2(const std::string& sid) -{ - return mAdjacentDomains.getByDomain2(sid); -} - - -/* - * Adds a copy of the given AdjacentDomains to this Geometry. - */ -int -Geometry::addAdjacentDomains(const AdjacentDomains* ad) -{ - if (ad == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (ad->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != ad->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != ad->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(ad)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (ad->isSetId() && (mAdjacentDomains.get(ad->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mAdjacentDomains.append(ad); - } -} - - -/* - * Get the number of AdjacentDomains objects in this Geometry. - */ -unsigned int -Geometry::getNumAdjacentDomains() const -{ - return mAdjacentDomains.size(); -} - - -/* - * Creates a new AdjacentDomains object, adds it to this Geometry object and - * returns the AdjacentDomains object created. - */ -AdjacentDomains* -Geometry::createAdjacentDomains() -{ - AdjacentDomains* ad = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - ad = new AdjacentDomains(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (ad != NULL) - { - mAdjacentDomains.appendAndOwn(ad); - } - - return ad; -} - - -/* - * Removes the nth AdjacentDomains from this Geometry and returns a pointer to - * it. - */ -AdjacentDomains* -Geometry::removeAdjacentDomains(unsigned int n) -{ - return mAdjacentDomains.remove(n); -} - - -/* - * Removes the AdjacentDomains from this Geometry based on its identifier and - * returns a pointer to it. - */ -AdjacentDomains* -Geometry::removeAdjacentDomains(const std::string& sid) -{ - return mAdjacentDomains.remove(sid); -} - - -/* - * Returns the ListOfGeometryDefinitions from this Geometry. - */ -const ListOfGeometryDefinitions* -Geometry::getListOfGeometryDefinitions() const -{ - return &mGeometryDefinitions; -} - - -/* - * Returns the ListOfGeometryDefinitions from this Geometry. - */ -ListOfGeometryDefinitions* -Geometry::getListOfGeometryDefinitions() -{ - return &mGeometryDefinitions; -} - - -/* - * Get a GeometryDefinition from the Geometry. - */ -GeometryDefinition* -Geometry::getGeometryDefinition(unsigned int n) -{ - return mGeometryDefinitions.get(n); -} - - -/* - * Get a GeometryDefinition from the Geometry. - */ -const GeometryDefinition* -Geometry::getGeometryDefinition(unsigned int n) const -{ - return mGeometryDefinitions.get(n); -} - - -/* - * Get a GeometryDefinition from the Geometry based on its identifier. - */ -GeometryDefinition* -Geometry::getGeometryDefinition(const std::string& sid) -{ - return mGeometryDefinitions.get(sid); -} - - -/* - * Get a GeometryDefinition from the Geometry based on its identifier. - */ -const GeometryDefinition* -Geometry::getGeometryDefinition(const std::string& sid) const -{ - return mGeometryDefinitions.get(sid); -} - - -/* - * Adds a copy of the given GeometryDefinition to this Geometry. - */ -int -Geometry::addGeometryDefinition(const GeometryDefinition* gd) -{ - if (gd == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (gd->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != gd->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != gd->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(gd)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (gd->isSetId() && (mGeometryDefinitions.get(gd->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mGeometryDefinitions.append(gd); - } -} - - -/* - * Get the number of GeometryDefinition objects in this Geometry. - */ -unsigned int -Geometry::getNumGeometryDefinitions() const -{ - return mGeometryDefinitions.size(); -} - - -/* - * Creates a new AnalyticGeometry object, adds it to this Geometry object and - * returns the AnalyticGeometry object created. - */ -AnalyticGeometry* -Geometry::createAnalyticGeometry() -{ - AnalyticGeometry* ag = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - ag = new AnalyticGeometry(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (ag != NULL) - { - mGeometryDefinitions.appendAndOwn(ag); - } - - return ag; -} - - -/* - * Creates a new SampledFieldGeometry object, adds it to this Geometry object - * and returns the SampledFieldGeometry object created. - */ -SampledFieldGeometry* -Geometry::createSampledFieldGeometry() -{ - SampledFieldGeometry* sfg = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - sfg = new SampledFieldGeometry(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (sfg != NULL) - { - mGeometryDefinitions.appendAndOwn(sfg); - } - - return sfg; -} - - -/* - * Creates a new CSGeometry object, adds it to this Geometry object and returns - * the CSGeometry object created. - */ -CSGeometry* -Geometry::createCSGeometry() -{ - CSGeometry* csg = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - csg = new CSGeometry(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (csg != NULL) - { - mGeometryDefinitions.appendAndOwn(csg); - } - - return csg; -} - - -/* - * Creates a new ParametricGeometry object, adds it to this Geometry object and - * returns the ParametricGeometry object created. - */ -ParametricGeometry* -Geometry::createParametricGeometry() -{ - ParametricGeometry* pg = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - pg = new ParametricGeometry(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (pg != NULL) - { - mGeometryDefinitions.appendAndOwn(pg); - } - - return pg; -} - - -/* - * Creates a new MixedGeometry object, adds it to this Geometry object and - * returns the MixedGeometry object created. - */ -MixedGeometry* -Geometry::createMixedGeometry() -{ - MixedGeometry* mg = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - mg = new MixedGeometry(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (mg != NULL) - { - mGeometryDefinitions.appendAndOwn(mg); - } - - return mg; -} - - -/* - * Removes the nth GeometryDefinition from this Geometry and returns a pointer - * to it. - */ -GeometryDefinition* -Geometry::removeGeometryDefinition(unsigned int n) -{ - return mGeometryDefinitions.remove(n); -} - - -/* - * Removes the GeometryDefinition from this Geometry based on its identifier - * and returns a pointer to it. - */ -GeometryDefinition* -Geometry::removeGeometryDefinition(const std::string& sid) -{ - return mGeometryDefinitions.remove(sid); -} - - -/* - * Returns the ListOfSampledFields from this Geometry. - */ -const ListOfSampledFields* -Geometry::getListOfSampledFields() const -{ - return &mSampledFields; -} - - -/* - * Returns the ListOfSampledFields from this Geometry. - */ -ListOfSampledFields* -Geometry::getListOfSampledFields() -{ - return &mSampledFields; -} - - -/* - * Get a SampledField from the Geometry. - */ -SampledField* -Geometry::getSampledField(unsigned int n) -{ - return mSampledFields.get(n); -} - - -/* - * Get a SampledField from the Geometry. - */ -const SampledField* -Geometry::getSampledField(unsigned int n) const -{ - return mSampledFields.get(n); -} - - -/* - * Get a SampledField from the Geometry based on its identifier. - */ -SampledField* -Geometry::getSampledField(const std::string& sid) -{ - return mSampledFields.get(sid); -} - - -/* - * Get a SampledField from the Geometry based on its identifier. - */ -const SampledField* -Geometry::getSampledField(const std::string& sid) const -{ - return mSampledFields.get(sid); -} - - -/* - * Adds a copy of the given SampledField to this Geometry. - */ -int -Geometry::addSampledField(const SampledField* sf) -{ - if (sf == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (sf->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != sf->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != sf->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(sf)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (sf->isSetId() && (mSampledFields.get(sf->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mSampledFields.append(sf); - } -} - - -/* - * Get the number of SampledField objects in this Geometry. - */ -unsigned int -Geometry::getNumSampledFields() const -{ - return mSampledFields.size(); -} - - -/* - * Creates a new SampledField object, adds it to this Geometry object and - * returns the SampledField object created. - */ -SampledField* -Geometry::createSampledField() -{ - SampledField* sf = NULL; - - try - { - SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); - sf = new SampledField(spatialns); - delete spatialns; - } - catch (...) - { - } - - if (sf != NULL) - { - mSampledFields.appendAndOwn(sf); - } - - return sf; -} - - -/* - * Removes the nth SampledField from this Geometry and returns a pointer to it. - */ -SampledField* -Geometry::removeSampledField(unsigned int n) -{ - return mSampledFields.remove(n); -} - - -/* - * Removes the SampledField from this Geometry based on its identifier and - * returns a pointer to it. - */ -SampledField* -Geometry::removeSampledField(const std::string& sid) -{ - return mSampledFields.remove(sid); -} - - -/* - * Returns the XML element name of this Geometry object. - */ -const std::string& -Geometry::getElementName() const -{ - static const string name = "geometry"; - return name; -} - - -/* - * Returns the libSBML type code for this Geometry object. - */ -int -Geometry::getTypeCode() const -{ - return SBML_SPATIAL_GEOMETRY; -} - - -/* - * Predicate returning @c true if all the required attributes for this Geometry - * object have been set. - */ -bool -Geometry::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetCoordinateSystem() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Geometry::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (getNumCoordinateComponents() > 0) - { - mCoordinateComponents.write(stream); - } - - if (getNumDomainTypes() > 0) - { - mDomainTypes.write(stream); - } - - if (getNumDomains() > 0) - { - mDomains.write(stream); - } - - if (getNumAdjacentDomains() > 0) - { - mAdjacentDomains.write(stream); - } - - if (getNumGeometryDefinitions() > 0) - { - mGeometryDefinitions.write(stream); - } - - if (getNumSampledFields() > 0) - { - mSampledFields.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Geometry::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mCoordinateComponents.accept(v); - - mDomainTypes.accept(v); - - mDomains.accept(v); - - mAdjacentDomains.accept(v); - - mGeometryDefinitions.accept(v); - - mSampledFields.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Geometry::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - mCoordinateComponents.setSBMLDocument(d); - - mDomainTypes.setSBMLDocument(d); - - mDomains.setSBMLDocument(d); - - mAdjacentDomains.setSBMLDocument(d); - - mGeometryDefinitions.setSBMLDocument(d); - - mSampledFields.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Geometry::connectToChild() -{ - SBase::connectToChild(); - - mCoordinateComponents.connectToParent(this); - - mDomainTypes.connectToParent(this); - - mDomains.connectToParent(this); - - mAdjacentDomains.connectToParent(this); - - mGeometryDefinitions.connectToParent(this); - - mSampledFields.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Geometry::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mCoordinateComponents.enablePackageInternal(pkgURI, pkgPrefix, flag); - - mDomainTypes.enablePackageInternal(pkgURI, pkgPrefix, flag); - - mDomains.enablePackageInternal(pkgURI, pkgPrefix, flag); - - mAdjacentDomains.enablePackageInternal(pkgURI, pkgPrefix, flag); - - mGeometryDefinitions.enablePackageInternal(pkgURI, pkgPrefix, flag); - - mSampledFields.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -Geometry::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - mCoordinateComponents.updateSBMLNamespace(package, level, version); - - mDomainTypes.updateSBMLNamespace(package, level, version); - - mDomains.updateSBMLNamespace(package, level, version); - - mAdjacentDomains.updateSBMLNamespace(package, level, version); - - mGeometryDefinitions.updateSBMLNamespace(package, level, version); - - mSampledFields.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "coordinateSystem") - { - value = getCoordinateSystemAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Geometry's attribute "attributeName" is - * set. - */ -bool -Geometry::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "coordinateSystem") - { - value = isSetCoordinateSystem(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "coordinateSystem") - { - return_value = setCoordinateSystem(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Geometry. - */ -int -Geometry::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "coordinateSystem") - { - value = unsetCoordinateSystem(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this Geometry. - */ -SBase* -Geometry::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "coordinateComponent") - { - return createCoordinateComponent(); - } - else if (elementName == "domainType") - { - return createDomainType(); - } - else if (elementName == "domain") - { - return createDomain(); - } - else if (elementName == "adjacentDomain") - { - return createAdjacentDomains(); - } - else if (elementName == "analyticGeometry") - { - return createAnalyticGeometry(); - } - else if (elementName == "sampledFieldGeometry") - { - return createSampledFieldGeometry(); - } - else if (elementName == "csGeometry") - { - return createCSGeometry(); - } - else if (elementName == "parametricGeometry") - { - return createParametricGeometry(); - } - else if (elementName == "mixedGeometry") - { - return createMixedGeometry(); - } - else if (elementName == "sampledField") - { - return createSampledField(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this Geometry. - */ -int -Geometry::addChildObject(const std::string& elementName, const SBase* element) -{ - if (elementName == "coordinateComponent" && element->getTypeCode() == - SBML_SPATIAL_COORDINATECOMPONENT) - { - return addCoordinateComponent((const CoordinateComponent*)(element)); - } - else if (elementName == "domainType" && element->getTypeCode() == - SBML_SPATIAL_DOMAINTYPE) - { - return addDomainType((const DomainType*)(element)); - } - else if (elementName == "domain" && element->getTypeCode() == - SBML_SPATIAL_DOMAIN) - { - return addDomain((const Domain*)(element)); - } - else if (elementName == "adjacentDomain" && element->getTypeCode() == - SBML_SPATIAL_ADJACENTDOMAINS) - { - return addAdjacentDomains((const AdjacentDomains*)(element)); - } - else if (elementName == "analyticGeometry" && element->getTypeCode() == - SBML_SPATIAL_ANALYTICGEOMETRY) - { - return addGeometryDefinition((const GeometryDefinition*)(element)); - } - else if (elementName == "sampledFieldGeometry" && element->getTypeCode() == - SBML_SPATIAL_SAMPLEDFIELDGEOMETRY) - { - return addGeometryDefinition((const GeometryDefinition*)(element)); - } - else if (elementName == "csGeometry" && element->getTypeCode() == - SBML_SPATIAL_CSGEOMETRY) - { - return addGeometryDefinition((const GeometryDefinition*)(element)); - } - else if (elementName == "parametricGeometry" && element->getTypeCode() == - SBML_SPATIAL_PARAMETRICGEOMETRY) - { - return addGeometryDefinition((const GeometryDefinition*)(element)); - } - else if (elementName == "mixedGeometry" && element->getTypeCode() == - SBML_SPATIAL_MIXEDGEOMETRY) - { - return addGeometryDefinition((const GeometryDefinition*)(element)); - } - else if (elementName == "sampledField" && element->getTypeCode() == - SBML_SPATIAL_SAMPLEDFIELD) - { - return addSampledField((const SampledField*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Geometry. - */ -SBase* -Geometry::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "coordinateComponent") - { - return removeCoordinateComponent(id); - } - else if (elementName == "domainType") - { - return removeDomainType(id); - } - else if (elementName == "domain") - { - return removeDomain(id); - } - else if (elementName == "adjacentDomain") - { - return removeAdjacentDomains(id); - } - else if (elementName == "analyticGeometry") - { - return removeGeometryDefinition(id); - } - else if (elementName == "sampledFieldGeometry") - { - return removeGeometryDefinition(id); - } - else if (elementName == "csGeometry") - { - return removeGeometryDefinition(id); - } - else if (elementName == "parametricGeometry") - { - return removeGeometryDefinition(id); - } - else if (elementName == "mixedGeometry") - { - return removeGeometryDefinition(id); - } - else if (elementName == "sampledField") - { - return removeSampledField(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this Geometry. - */ -unsigned int -Geometry::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "coordinateComponent") - { - return getNumCoordinateComponents(); - } - else if (elementName == "domainType") - { - return getNumDomainTypes(); - } - else if (elementName == "domain") - { - return getNumDomains(); - } - else if (elementName == "adjacentDomain") - { - return getNumAdjacentDomains(); - } - else if (elementName == "geometryDefinition") - { - return getNumGeometryDefinitions(); - } - else if (elementName == "sampledField") - { - return getNumSampledFields(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this Geometry. - */ -SBase* -Geometry::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "coordinateComponent") - { - return getCoordinateComponent(index); - } - else if (elementName == "domainType") - { - return getDomainType(index); - } - else if (elementName == "domain") - { - return getDomain(index); - } - else if (elementName == "adjacentDomain") - { - return getAdjacentDomains(index); - } - else if (elementName == "geometryDefinition") - { - return getGeometryDefinition(index); - } - else if (elementName == "sampledField") - { - return getSampledField(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -Geometry::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - obj = mCoordinateComponents.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - obj = mDomainTypes.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - obj = mDomains.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - obj = mAdjacentDomains.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - obj = mGeometryDefinitions.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - obj = mSampledFields.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -Geometry::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mCoordinateComponents.getMetaId() == metaid) - { - return &mCoordinateComponents; - } - - if (mDomainTypes.getMetaId() == metaid) - { - return &mDomainTypes; - } - - if (mDomains.getMetaId() == metaid) - { - return &mDomains; - } - - if (mAdjacentDomains.getMetaId() == metaid) - { - return &mAdjacentDomains; - } - - if (mGeometryDefinitions.getMetaId() == metaid) - { - return &mGeometryDefinitions; - } - - if (mSampledFields.getMetaId() == metaid) - { - return &mSampledFields; - } - - obj = mCoordinateComponents.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - obj = mDomainTypes.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - obj = mDomains.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - obj = mAdjacentDomains.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - obj = mGeometryDefinitions.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - obj = mSampledFields.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -Geometry::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mCoordinateComponents, filter); - ADD_FILTERED_LIST(ret, sublist, mDomainTypes, filter); - ADD_FILTERED_LIST(ret, sublist, mDomains, filter); - ADD_FILTERED_LIST(ret, sublist, mAdjacentDomains, filter); - ADD_FILTERED_LIST(ret, sublist, mGeometryDefinitions, filter); - ADD_FILTERED_LIST(ret, sublist, mSampledFields, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -Geometry::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - if (name == "listOfCoordinateComponents") - { - if (getErrorLog() && mCoordinateComponents.size() != 0) - { - getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mCoordinateComponents; - } - else if (name == "listOfDomainTypes") - { - if (getErrorLog() && mDomainTypes.size() != 0) - { - getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mDomainTypes; - } - else if (name == "listOfDomains") - { - if (getErrorLog() && mDomains.size() != 0) - { - getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mDomains; - } - else if (name == "listOfAdjacentDomains") - { - if (getErrorLog() && mAdjacentDomains.size() != 0) - { - getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mAdjacentDomains; - } - else if (name == "listOfGeometryDefinitions") - { - if (getErrorLog() && mGeometryDefinitions.size() != 0) - { - getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mGeometryDefinitions; - } - else if (name == "listOfSampledFields") - { - if (getErrorLog() && mSampledFields.size() != 0) - { - getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mSampledFields; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Geometry::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("coordinateSystem"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Geometry::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", SpatialGeometryAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", SpatialGeometryAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "optional" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - - // - // coordinateSystem enum (use = "required" ) - // - - std::string coordinateSystem; - assigned = attributes.readInto("coordinateSystem", coordinateSystem); - - if (assigned == true) - { - if (coordinateSystem.empty() == true) - { - logEmptyString(coordinateSystem, level, version, ""); - } - else - { - mCoordinateSystem = GeometryKind_fromString(coordinateSystem.c_str()); - - if (log && GeometryKind_isValid(mCoordinateSystem) == 0) - { - std::string msg = "The coordinateSystem on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + coordinateSystem + "', which is not a valid option."; - - log->logPackageError("spatial", - SpatialGeometryCoordinateSystemMustBeGeometryKindEnum, pkgVersion, - level, version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'coordinateSystem' is missing."; - log->logPackageError("spatial", SpatialGeometryAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Geometry::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetCoordinateSystem() == true) - { - stream.writeAttribute("coordinateSystem", getPrefix(), - GeometryKind_toString(mCoordinateSystem)); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Geometry_t using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -Geometry_t * -Geometry_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new Geometry(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Geometry_t object. - */ -LIBSBML_EXTERN -Geometry_t* -Geometry_clone(const Geometry_t* g) -{ - if (g != NULL) - { - return static_cast(g->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Geometry_t object. - */ -LIBSBML_EXTERN -void -Geometry_free(Geometry_t* g) -{ - if (g != NULL) - { - delete g; - } -} - - -/* - * Returns the value of the "id" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -char * -Geometry_getId(const Geometry_t * g) -{ - if (g == NULL) - { - return NULL; - } - - return g->getId().empty() ? NULL : safe_strdup(g->getId().c_str()); -} - - -/* - * Returns the value of the "coordinateSystem" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -GeometryKind_t -Geometry_getCoordinateSystem(const Geometry_t * g) -{ - if (g == NULL) - { - return SPATIAL_GEOMETRYKIND_INVALID; - } - - return g->getCoordinateSystem(); -} - - -/* - * Returns the value of the "coordinateSystem" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -char * -Geometry_getCoordinateSystemAsString(const Geometry_t * g) -{ - return (char*)(GeometryKind_toString(g->getCoordinateSystem())); -} - - -/* - * Predicate returning @c 1 (true) if this Geometry_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -Geometry_isSetId(const Geometry_t * g) -{ - return (g != NULL) ? static_cast(g->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Geometry_t's "coordinateSystem" - * attribute is set. - */ -LIBSBML_EXTERN -int -Geometry_isSetCoordinateSystem(const Geometry_t * g) -{ - return (g != NULL) ? static_cast(g->isSetCoordinateSystem()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_setId(Geometry_t * g, const char * id) -{ - return (g != NULL) ? g->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "coordinateSystem" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_setCoordinateSystem(Geometry_t * g, GeometryKind_t coordinateSystem) -{ - return (g != NULL) ? g->setCoordinateSystem(coordinateSystem) : - LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "coordinateSystem" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_setCoordinateSystemAsString(Geometry_t * g, - const char * coordinateSystem) -{ - return (g != NULL) ? g->setCoordinateSystem(coordinateSystem): - LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_unsetId(Geometry_t * g) -{ - return (g != NULL) ? g->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "coordinateSystem" attribute of this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_unsetCoordinateSystem(Geometry_t * g) -{ - return (g != NULL) ? g->unsetCoordinateSystem() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing CoordinateComponent_t objects from this - * Geometry_t. - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfCoordinateComponents(Geometry_t* g) -{ - return (g != NULL) ? g->getListOfCoordinateComponents() : NULL; -} - - -/* - * Get a CoordinateComponent_t from the Geometry_t. - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_getCoordinateComponent(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->getCoordinateComponent(n) : NULL; -} - - -/* - * Get a CoordinateComponent_t from the Geometry_t based on its identifier. - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_getCoordinateComponentById(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getCoordinateComponent(sid) : NULL; -} - - -/* - * Adds a copy of the given CoordinateComponent_t to this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_addCoordinateComponent(Geometry_t* g, - const CoordinateComponent_t* cc) -{ - return (g != NULL) ? g->addCoordinateComponent(cc) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of CoordinateComponent_t objects in this Geometry_t. - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumCoordinateComponents(Geometry_t* g) -{ - return (g != NULL) ? g->getNumCoordinateComponents() : SBML_INT_MAX; -} - - -/* - * Creates a new CoordinateComponent_t object, adds it to this Geometry_t - * object and returns the CoordinateComponent_t object created. - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_createCoordinateComponent(Geometry_t* g) -{ - return (g != NULL) ? g->createCoordinateComponent() : NULL; -} - - -/* - * Removes the nth CoordinateComponent_t from this Geometry_t and returns a - * pointer to it. - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_removeCoordinateComponent(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->removeCoordinateComponent(n) : NULL; -} - - -/* - * Removes the CoordinateComponent_t from this Geometry_t based on its - * identifier and returns a pointer to it. - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_removeCoordinateComponentById(Geometry_t* g, const char* sid) -{ - return (g != NULL && sid != NULL) ? g->removeCoordinateComponent(sid) : NULL; -} - - -/* - * Returns a ListOf_t * containing DomainType_t objects from this Geometry_t. - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfDomainTypes(Geometry_t* g) -{ - return (g != NULL) ? g->getListOfDomainTypes() : NULL; -} - - -/* - * Get a DomainType_t from the Geometry_t. - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_getDomainType(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->getDomainType(n) : NULL; -} - - -/* - * Get a DomainType_t from the Geometry_t based on its identifier. - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_getDomainTypeById(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getDomainType(sid) : NULL; -} - - -/* - * Adds a copy of the given DomainType_t to this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_addDomainType(Geometry_t* g, const DomainType_t* dt) -{ - return (g != NULL) ? g->addDomainType(dt) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of DomainType_t objects in this Geometry_t. - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumDomainTypes(Geometry_t* g) -{ - return (g != NULL) ? g->getNumDomainTypes() : SBML_INT_MAX; -} - - -/* - * Creates a new DomainType_t object, adds it to this Geometry_t object and - * returns the DomainType_t object created. - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_createDomainType(Geometry_t* g) -{ - return (g != NULL) ? g->createDomainType() : NULL; -} - - -/* - * Removes the nth DomainType_t from this Geometry_t and returns a pointer to - * it. - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_removeDomainType(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->removeDomainType(n) : NULL; -} - - -/* - * Removes the DomainType_t from this Geometry_t based on its identifier and - * returns a pointer to it. - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_removeDomainTypeById(Geometry_t* g, const char* sid) -{ - return (g != NULL && sid != NULL) ? g->removeDomainType(sid) : NULL; -} - - -/* - * Returns a ListOf_t * containing Domain_t objects from this Geometry_t. - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfDomains(Geometry_t* g) -{ - return (g != NULL) ? g->getListOfDomains() : NULL; -} - - -/* - * Get a Domain_t from the Geometry_t. - */ -LIBSBML_EXTERN -Domain_t* -Geometry_getDomain(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->getDomain(n) : NULL; -} - - -/* - * Get a Domain_t from the Geometry_t based on its identifier. - */ -LIBSBML_EXTERN -Domain_t* -Geometry_getDomainById(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getDomain(sid) : NULL; -} - - -/* - * Get a Domain_t from the Geometry_t based on the DomainType to which it - * refers. - */ -LIBSBML_EXTERN -Domain_t* -Geometry_getDomainByDomainType(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getDomainByDomainType(sid) : NULL; -} - - -/* - * Adds a copy of the given Domain_t to this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_addDomain(Geometry_t* g, const Domain_t* d) -{ - return (g != NULL) ? g->addDomain(d) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of Domain_t objects in this Geometry_t. - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumDomains(Geometry_t* g) -{ - return (g != NULL) ? g->getNumDomains() : SBML_INT_MAX; -} - - -/* - * Creates a new Domain_t object, adds it to this Geometry_t object and returns - * the Domain_t object created. - */ -LIBSBML_EXTERN -Domain_t* -Geometry_createDomain(Geometry_t* g) -{ - return (g != NULL) ? g->createDomain() : NULL; -} - - -/* - * Removes the nth Domain_t from this Geometry_t and returns a pointer to it. - */ -LIBSBML_EXTERN -Domain_t* -Geometry_removeDomain(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->removeDomain(n) : NULL; -} - - -/* - * Removes the Domain_t from this Geometry_t based on its identifier and - * returns a pointer to it. - */ -LIBSBML_EXTERN -Domain_t* -Geometry_removeDomainById(Geometry_t* g, const char* sid) -{ - return (g != NULL && sid != NULL) ? g->removeDomain(sid) : NULL; -} - - -/* - * Returns a ListOf_t * containing AdjacentDomains_t objects from this - * Geometry_t. - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfAdjacentDomains(Geometry_t* g) -{ - return (g != NULL) ? g->getListOfAdjacentDomains() : NULL; -} - - -/* - * Get an AdjacentDomains_t from the Geometry_t. - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomains(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->getAdjacentDomains(n) : NULL; -} - - -/* - * Get an AdjacentDomains_t from the Geometry_t based on its identifier. - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomainsById(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getAdjacentDomains(sid) : NULL; -} - - -/* - * Get an AdjacentDomains_t from the Geometry_t based on the Domain1 to which - * it refers. - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomainsByDomain1(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getAdjacentDomainsByDomain1(sid) : - NULL; -} - - -/* - * Get an AdjacentDomains_t from the Geometry_t based on the Domain2 to which - * it refers. - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomainsByDomain2(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getAdjacentDomainsByDomain2(sid) : - NULL; -} - - -/* - * Adds a copy of the given AdjacentDomains_t to this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_addAdjacentDomains(Geometry_t* g, const AdjacentDomains_t* ad) -{ - return (g != NULL) ? g->addAdjacentDomains(ad) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of AdjacentDomains_t objects in this Geometry_t. - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumAdjacentDomains(Geometry_t* g) -{ - return (g != NULL) ? g->getNumAdjacentDomains() : SBML_INT_MAX; -} - - -/* - * Creates a new AdjacentDomains_t object, adds it to this Geometry_t object - * and returns the AdjacentDomains_t object created. - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_createAdjacentDomains(Geometry_t* g) -{ - return (g != NULL) ? g->createAdjacentDomains() : NULL; -} - - -/* - * Removes the nth AdjacentDomains_t from this Geometry_t and returns a pointer - * to it. - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_removeAdjacentDomains(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->removeAdjacentDomains(n) : NULL; -} - - -/* - * Removes the AdjacentDomains_t from this Geometry_t based on its identifier - * and returns a pointer to it. - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_removeAdjacentDomainsById(Geometry_t* g, const char* sid) -{ - return (g != NULL && sid != NULL) ? g->removeAdjacentDomains(sid) : NULL; -} - - -/* - * Returns a ListOf_t * containing GeometryDefinition_t objects from this - * Geometry_t. - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfGeometryDefinitions(Geometry_t* g) -{ - return (g != NULL) ? g->getListOfGeometryDefinitions() : NULL; -} - - -/* - * Get a GeometryDefinition_t from the Geometry_t. - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_getGeometryDefinition(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->getGeometryDefinition(n) : NULL; -} - - -/* - * Get a GeometryDefinition_t from the Geometry_t based on its identifier. - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_getGeometryDefinitionById(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getGeometryDefinition(sid) : NULL; -} - - -/* - * Adds a copy of the given GeometryDefinition_t to this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_addGeometryDefinition(Geometry_t* g, const GeometryDefinition_t* gd) -{ - return (g != NULL) ? g->addGeometryDefinition(gd) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of GeometryDefinition_t objects in this Geometry_t. - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumGeometryDefinitions(Geometry_t* g) -{ - return (g != NULL) ? g->getNumGeometryDefinitions() : SBML_INT_MAX; -} - - -/* - * Creates a new AnalyticGeometry_t object, adds it to this Geometry_t object - * and returns the AnalyticGeometry_t object created. - */ -LIBSBML_EXTERN -AnalyticGeometry_t* -Geometry_createAnalyticGeometry(Geometry_t* g) -{ - return (g != NULL) ? g->createAnalyticGeometry() : NULL; -} - - -/* - * Creates a new SampledFieldGeometry_t object, adds it to this Geometry_t - * object and returns the SampledFieldGeometry_t object created. - */ -LIBSBML_EXTERN -SampledFieldGeometry_t* -Geometry_createSampledFieldGeometry(Geometry_t* g) -{ - return (g != NULL) ? g->createSampledFieldGeometry() : NULL; -} - - -/* - * Creates a new CSGeometry_t object, adds it to this Geometry_t object and - * returns the CSGeometry_t object created. - */ -LIBSBML_EXTERN -CSGeometry_t* -Geometry_createCSGeometry(Geometry_t* g) -{ - return (g != NULL) ? g->createCSGeometry() : NULL; -} - - -/* - * Creates a new ParametricGeometry_t object, adds it to this Geometry_t object - * and returns the ParametricGeometry_t object created. - */ -LIBSBML_EXTERN -ParametricGeometry_t* -Geometry_createParametricGeometry(Geometry_t* g) -{ - return (g != NULL) ? g->createParametricGeometry() : NULL; -} - - -/* - * Creates a new MixedGeometry_t object, adds it to this Geometry_t object and - * returns the MixedGeometry_t object created. - */ -LIBSBML_EXTERN -MixedGeometry_t* -Geometry_createMixedGeometry(Geometry_t* g) -{ - return (g != NULL) ? g->createMixedGeometry() : NULL; -} - - -/* - * Removes the nth GeometryDefinition_t from this Geometry_t and returns a - * pointer to it. - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_removeGeometryDefinition(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->removeGeometryDefinition(n) : NULL; -} - - -/* - * Removes the GeometryDefinition_t from this Geometry_t based on its - * identifier and returns a pointer to it. - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_removeGeometryDefinitionById(Geometry_t* g, const char* sid) -{ - return (g != NULL && sid != NULL) ? g->removeGeometryDefinition(sid) : NULL; -} - - -/* - * Returns a ListOf_t * containing SampledField_t objects from this Geometry_t. - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfSampledFields(Geometry_t* g) -{ - return (g != NULL) ? g->getListOfSampledFields() : NULL; -} - - -/* - * Get a SampledField_t from the Geometry_t. - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_getSampledField(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->getSampledField(n) : NULL; -} - - -/* - * Get a SampledField_t from the Geometry_t based on its identifier. - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_getSampledFieldById(Geometry_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getSampledField(sid) : NULL; -} - - -/* - * Adds a copy of the given SampledField_t to this Geometry_t. - */ -LIBSBML_EXTERN -int -Geometry_addSampledField(Geometry_t* g, const SampledField_t* sf) -{ - return (g != NULL) ? g->addSampledField(sf) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of SampledField_t objects in this Geometry_t. - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumSampledFields(Geometry_t* g) -{ - return (g != NULL) ? g->getNumSampledFields() : SBML_INT_MAX; -} - - -/* - * Creates a new SampledField_t object, adds it to this Geometry_t object and - * returns the SampledField_t object created. - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_createSampledField(Geometry_t* g) -{ - return (g != NULL) ? g->createSampledField() : NULL; -} - - -/* - * Removes the nth SampledField_t from this Geometry_t and returns a pointer to - * it. - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_removeSampledField(Geometry_t* g, unsigned int n) -{ - return (g != NULL) ? g->removeSampledField(n) : NULL; -} - - -/* - * Removes the SampledField_t from this Geometry_t based on its identifier and - * returns a pointer to it. - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_removeSampledFieldById(Geometry_t* g, const char* sid) -{ - return (g != NULL && sid != NULL) ? g->removeSampledField(sid) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Geometry_t object have been set. - */ -LIBSBML_EXTERN -int -Geometry_hasRequiredAttributes(const Geometry_t * g) -{ - return (g != NULL) ? static_cast(g->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Geometry.cpp + * @brief Implementation of the Geometry class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Geometry using the given SBML Level, Version and + * “spatial” package version. + */ +Geometry::Geometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mCoordinateSystem (SPATIAL_GEOMETRYKIND_INVALID) + , mCoordinateComponents (level, version, pkgVersion) + , mDomainTypes (level, version, pkgVersion) + , mDomains (level, version, pkgVersion) + , mAdjacentDomains (level, version, pkgVersion) + , mGeometryDefinitions (level, version, pkgVersion) + , mSampledFields (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new Geometry using the given SpatialPkgNamespaces object. + */ +Geometry::Geometry(SpatialPkgNamespaces *spatialns) + : SBase(spatialns) + , mCoordinateSystem (SPATIAL_GEOMETRYKIND_INVALID) + , mCoordinateComponents (spatialns) + , mDomainTypes (spatialns) + , mDomains (spatialns) + , mAdjacentDomains (spatialns) + , mGeometryDefinitions (spatialns) + , mSampledFields (spatialns) +{ + setElementNamespace(spatialns->getURI()); + connectToChild(); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for Geometry. + */ +Geometry::Geometry(const Geometry& orig) + : SBase( orig ) + , mCoordinateSystem ( orig.mCoordinateSystem ) + , mCoordinateComponents ( orig.mCoordinateComponents ) + , mDomainTypes ( orig.mDomainTypes ) + , mDomains ( orig.mDomains ) + , mAdjacentDomains ( orig.mAdjacentDomains ) + , mGeometryDefinitions ( orig.mGeometryDefinitions ) + , mSampledFields ( orig.mSampledFields ) +{ + connectToChild(); +} + + +/* + * Assignment operator for Geometry. + */ +Geometry& +Geometry::operator=(const Geometry& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mCoordinateSystem = rhs.mCoordinateSystem; + mCoordinateComponents = rhs.mCoordinateComponents; + mDomainTypes = rhs.mDomainTypes; + mDomains = rhs.mDomains; + mAdjacentDomains = rhs.mAdjacentDomains; + mGeometryDefinitions = rhs.mGeometryDefinitions; + mSampledFields = rhs.mSampledFields; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Geometry object. + */ +Geometry* +Geometry::clone() const +{ + return new Geometry(*this); +} + + +/* + * Destructor for Geometry. + */ +Geometry::~Geometry() +{ +} + + +/* + * Returns the value of the "id" attribute of this Geometry. + */ +const std::string& +Geometry::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "coordinateSystem" attribute of this Geometry. + */ +GeometryKind_t +Geometry::getCoordinateSystem() const +{ + return mCoordinateSystem; +} + + +/* + * Returns the value of the "coordinateSystem" attribute of this Geometry. + */ +std::string +Geometry::getCoordinateSystemAsString() const +{ + std::string code_str = GeometryKind_toString(mCoordinateSystem); + return code_str; +} + + +/* + * Predicate returning @c true if this Geometry's "id" attribute is set. + */ +bool +Geometry::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this Geometry's "coordinateSystem" attribute + * is set. + */ +bool +Geometry::isSetCoordinateSystem() const +{ + return (mCoordinateSystem != SPATIAL_GEOMETRYKIND_INVALID); +} + + +/* + * Sets the value of the "id" attribute of this Geometry. + */ +int +Geometry::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "coordinateSystem" attribute of this Geometry. + */ +int +Geometry::setCoordinateSystem(const GeometryKind_t coordinateSystem) +{ + if (GeometryKind_isValid(coordinateSystem) == 0) + { + mCoordinateSystem = SPATIAL_GEOMETRYKIND_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mCoordinateSystem = coordinateSystem; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "coordinateSystem" attribute of this Geometry. + */ +int +Geometry::setCoordinateSystem(const std::string& coordinateSystem) +{ + mCoordinateSystem = GeometryKind_fromString(coordinateSystem.c_str()); + + if (mCoordinateSystem == SPATIAL_GEOMETRYKIND_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "id" attribute of this Geometry. + */ +int +Geometry::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "coordinateSystem" attribute of this Geometry. + */ +int +Geometry::unsetCoordinateSystem() +{ + mCoordinateSystem = SPATIAL_GEOMETRYKIND_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the ListOfCoordinateComponents from this Geometry. + */ +const ListOfCoordinateComponents* +Geometry::getListOfCoordinateComponents() const +{ + return &mCoordinateComponents; +} + + +/* + * Returns the ListOfCoordinateComponents from this Geometry. + */ +ListOfCoordinateComponents* +Geometry::getListOfCoordinateComponents() +{ + return &mCoordinateComponents; +} + + +/* + * Get a CoordinateComponent from the Geometry. + */ +CoordinateComponent* +Geometry::getCoordinateComponent(unsigned int n) +{ + return mCoordinateComponents.get(n); +} + + +/* + * Get a CoordinateComponent from the Geometry. + */ +const CoordinateComponent* +Geometry::getCoordinateComponent(unsigned int n) const +{ + return mCoordinateComponents.get(n); +} + + +/* + * Get a CoordinateComponent from the Geometry based on its identifier. + */ +CoordinateComponent* +Geometry::getCoordinateComponent(const std::string& sid) +{ + return mCoordinateComponents.get(sid); +} + + +/* + * Get a CoordinateComponent from the Geometry based on its identifier. + */ +const CoordinateComponent* +Geometry::getCoordinateComponent(const std::string& sid) const +{ + return mCoordinateComponents.get(sid); +} + + +/* + * Adds a copy of the given CoordinateComponent to this Geometry. + */ +int +Geometry::addCoordinateComponent(const CoordinateComponent* cc) +{ + if (cc == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (cc->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (cc->hasRequiredElements() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != cc->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != cc->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(cc)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (cc->isSetId() && (mCoordinateComponents.get(cc->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mCoordinateComponents.append(cc); + } +} + + +/* + * Get the number of CoordinateComponent objects in this Geometry. + */ +unsigned int +Geometry::getNumCoordinateComponents() const +{ + return mCoordinateComponents.size(); +} + + +/* + * Creates a new CoordinateComponent object, adds it to this Geometry object + * and returns the CoordinateComponent object created. + */ +CoordinateComponent* +Geometry::createCoordinateComponent() +{ + CoordinateComponent* cc = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + cc = new CoordinateComponent(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (cc != NULL) + { + mCoordinateComponents.appendAndOwn(cc); + } + + return cc; +} + + +/* + * Removes the nth CoordinateComponent from this Geometry and returns a pointer + * to it. + */ +CoordinateComponent* +Geometry::removeCoordinateComponent(unsigned int n) +{ + return mCoordinateComponents.remove(n); +} + + +/* + * Removes the CoordinateComponent from this Geometry based on its identifier + * and returns a pointer to it. + */ +CoordinateComponent* +Geometry::removeCoordinateComponent(const std::string& sid) +{ + return mCoordinateComponents.remove(sid); +} + + +/* + * Returns the ListOfDomainTypes from this Geometry. + */ +const ListOfDomainTypes* +Geometry::getListOfDomainTypes() const +{ + return &mDomainTypes; +} + + +/* + * Returns the ListOfDomainTypes from this Geometry. + */ +ListOfDomainTypes* +Geometry::getListOfDomainTypes() +{ + return &mDomainTypes; +} + + +/* + * Get a DomainType from the Geometry. + */ +DomainType* +Geometry::getDomainType(unsigned int n) +{ + return mDomainTypes.get(n); +} + + +/* + * Get a DomainType from the Geometry. + */ +const DomainType* +Geometry::getDomainType(unsigned int n) const +{ + return mDomainTypes.get(n); +} + + +/* + * Get a DomainType from the Geometry based on its identifier. + */ +DomainType* +Geometry::getDomainType(const std::string& sid) +{ + return mDomainTypes.get(sid); +} + + +/* + * Get a DomainType from the Geometry based on its identifier. + */ +const DomainType* +Geometry::getDomainType(const std::string& sid) const +{ + return mDomainTypes.get(sid); +} + + +/* + * Adds a copy of the given DomainType to this Geometry. + */ +int +Geometry::addDomainType(const DomainType* dt) +{ + if (dt == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (dt->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != dt->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != dt->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(dt)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (dt->isSetId() && (mDomainTypes.get(dt->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mDomainTypes.append(dt); + } +} + + +/* + * Get the number of DomainType objects in this Geometry. + */ +unsigned int +Geometry::getNumDomainTypes() const +{ + return mDomainTypes.size(); +} + + +/* + * Creates a new DomainType object, adds it to this Geometry object and returns + * the DomainType object created. + */ +DomainType* +Geometry::createDomainType() +{ + DomainType* dt = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + dt = new DomainType(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (dt != NULL) + { + mDomainTypes.appendAndOwn(dt); + } + + return dt; +} + + +/* + * Removes the nth DomainType from this Geometry and returns a pointer to it. + */ +DomainType* +Geometry::removeDomainType(unsigned int n) +{ + return mDomainTypes.remove(n); +} + + +/* + * Removes the DomainType from this Geometry based on its identifier and + * returns a pointer to it. + */ +DomainType* +Geometry::removeDomainType(const std::string& sid) +{ + return mDomainTypes.remove(sid); +} + + +/* + * Returns the ListOfDomains from this Geometry. + */ +const ListOfDomains* +Geometry::getListOfDomains() const +{ + return &mDomains; +} + + +/* + * Returns the ListOfDomains from this Geometry. + */ +ListOfDomains* +Geometry::getListOfDomains() +{ + return &mDomains; +} + + +/* + * Get a Domain from the Geometry. + */ +Domain* +Geometry::getDomain(unsigned int n) +{ + return mDomains.get(n); +} + + +/* + * Get a Domain from the Geometry. + */ +const Domain* +Geometry::getDomain(unsigned int n) const +{ + return mDomains.get(n); +} + + +/* + * Get a Domain from the Geometry based on its identifier. + */ +Domain* +Geometry::getDomain(const std::string& sid) +{ + return mDomains.get(sid); +} + + +/* + * Get a Domain from the Geometry based on its identifier. + */ +const Domain* +Geometry::getDomain(const std::string& sid) const +{ + return mDomains.get(sid); +} + + +/* + * Get a Domain from the Geometry based on the DomainType to which it refers. + */ +const Domain* +Geometry::getDomainByDomainType(const std::string& sid) const +{ + return mDomains.getByDomainType(sid); +} + + +/* + * Get a Domain from the Geometry based on the DomainType to which it refers. + */ +Domain* +Geometry::getDomainByDomainType(const std::string& sid) +{ + return mDomains.getByDomainType(sid); +} + + +/* + * Adds a copy of the given Domain to this Geometry. + */ +int +Geometry::addDomain(const Domain* d) +{ + if (d == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (d->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (d->hasRequiredElements() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != d->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != d->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(d)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (d->isSetId() && (mDomains.get(d->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mDomains.append(d); + } +} + + +/* + * Get the number of Domain objects in this Geometry. + */ +unsigned int +Geometry::getNumDomains() const +{ + return mDomains.size(); +} + + +/* + * Creates a new Domain object, adds it to this Geometry object and returns the + * Domain object created. + */ +Domain* +Geometry::createDomain() +{ + Domain* d = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + d = new Domain(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (d != NULL) + { + mDomains.appendAndOwn(d); + } + + return d; +} + + +/* + * Removes the nth Domain from this Geometry and returns a pointer to it. + */ +Domain* +Geometry::removeDomain(unsigned int n) +{ + return mDomains.remove(n); +} + + +/* + * Removes the Domain from this Geometry based on its identifier and returns a + * pointer to it. + */ +Domain* +Geometry::removeDomain(const std::string& sid) +{ + return mDomains.remove(sid); +} + + +/* + * Returns the ListOfAdjacentDomains from this Geometry. + */ +const ListOfAdjacentDomains* +Geometry::getListOfAdjacentDomains() const +{ + return &mAdjacentDomains; +} + + +/* + * Returns the ListOfAdjacentDomains from this Geometry. + */ +ListOfAdjacentDomains* +Geometry::getListOfAdjacentDomains() +{ + return &mAdjacentDomains; +} + + +/* + * Get an AdjacentDomains from the Geometry. + */ +AdjacentDomains* +Geometry::getAdjacentDomains(unsigned int n) +{ + return mAdjacentDomains.get(n); +} + + +/* + * Get an AdjacentDomains from the Geometry. + */ +const AdjacentDomains* +Geometry::getAdjacentDomains(unsigned int n) const +{ + return mAdjacentDomains.get(n); +} + + +/* + * Get an AdjacentDomains from the Geometry based on its identifier. + */ +AdjacentDomains* +Geometry::getAdjacentDomains(const std::string& sid) +{ + return mAdjacentDomains.get(sid); +} + + +/* + * Get an AdjacentDomains from the Geometry based on its identifier. + */ +const AdjacentDomains* +Geometry::getAdjacentDomains(const std::string& sid) const +{ + return mAdjacentDomains.get(sid); +} + + +/* + * Get an AdjacentDomains from the Geometry based on the Domain1 to which it + * refers. + */ +const AdjacentDomains* +Geometry::getAdjacentDomainsByDomain1(const std::string& sid) const +{ + return mAdjacentDomains.getByDomain1(sid); +} + + +/* + * Get an AdjacentDomains from the Geometry based on the Domain1 to which it + * refers. + */ +AdjacentDomains* +Geometry::getAdjacentDomainsByDomain1(const std::string& sid) +{ + return mAdjacentDomains.getByDomain1(sid); +} + + +/* + * Get an AdjacentDomains from the Geometry based on the Domain2 to which it + * refers. + */ +const AdjacentDomains* +Geometry::getAdjacentDomainsByDomain2(const std::string& sid) const +{ + return mAdjacentDomains.getByDomain2(sid); +} + + +/* + * Get an AdjacentDomains from the Geometry based on the Domain2 to which it + * refers. + */ +AdjacentDomains* +Geometry::getAdjacentDomainsByDomain2(const std::string& sid) +{ + return mAdjacentDomains.getByDomain2(sid); +} + + +/* + * Adds a copy of the given AdjacentDomains to this Geometry. + */ +int +Geometry::addAdjacentDomains(const AdjacentDomains* ad) +{ + if (ad == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (ad->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != ad->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != ad->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(ad)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (ad->isSetId() && (mAdjacentDomains.get(ad->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mAdjacentDomains.append(ad); + } +} + + +/* + * Get the number of AdjacentDomains objects in this Geometry. + */ +unsigned int +Geometry::getNumAdjacentDomains() const +{ + return mAdjacentDomains.size(); +} + + +/* + * Creates a new AdjacentDomains object, adds it to this Geometry object and + * returns the AdjacentDomains object created. + */ +AdjacentDomains* +Geometry::createAdjacentDomains() +{ + AdjacentDomains* ad = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + ad = new AdjacentDomains(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (ad != NULL) + { + mAdjacentDomains.appendAndOwn(ad); + } + + return ad; +} + + +/* + * Removes the nth AdjacentDomains from this Geometry and returns a pointer to + * it. + */ +AdjacentDomains* +Geometry::removeAdjacentDomains(unsigned int n) +{ + return mAdjacentDomains.remove(n); +} + + +/* + * Removes the AdjacentDomains from this Geometry based on its identifier and + * returns a pointer to it. + */ +AdjacentDomains* +Geometry::removeAdjacentDomains(const std::string& sid) +{ + return mAdjacentDomains.remove(sid); +} + + +/* + * Returns the ListOfGeometryDefinitions from this Geometry. + */ +const ListOfGeometryDefinitions* +Geometry::getListOfGeometryDefinitions() const +{ + return &mGeometryDefinitions; +} + + +/* + * Returns the ListOfGeometryDefinitions from this Geometry. + */ +ListOfGeometryDefinitions* +Geometry::getListOfGeometryDefinitions() +{ + return &mGeometryDefinitions; +} + + +/* + * Get a GeometryDefinition from the Geometry. + */ +GeometryDefinition* +Geometry::getGeometryDefinition(unsigned int n) +{ + return mGeometryDefinitions.get(n); +} + + +/* + * Get a GeometryDefinition from the Geometry. + */ +const GeometryDefinition* +Geometry::getGeometryDefinition(unsigned int n) const +{ + return mGeometryDefinitions.get(n); +} + + +/* + * Get a GeometryDefinition from the Geometry based on its identifier. + */ +GeometryDefinition* +Geometry::getGeometryDefinition(const std::string& sid) +{ + return mGeometryDefinitions.get(sid); +} + + +/* + * Get a GeometryDefinition from the Geometry based on its identifier. + */ +const GeometryDefinition* +Geometry::getGeometryDefinition(const std::string& sid) const +{ + return mGeometryDefinitions.get(sid); +} + + +/* + * Adds a copy of the given GeometryDefinition to this Geometry. + */ +int +Geometry::addGeometryDefinition(const GeometryDefinition* gd) +{ + if (gd == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (gd->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != gd->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != gd->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(gd)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (gd->isSetId() && (mGeometryDefinitions.get(gd->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mGeometryDefinitions.append(gd); + } +} + + +/* + * Get the number of GeometryDefinition objects in this Geometry. + */ +unsigned int +Geometry::getNumGeometryDefinitions() const +{ + return mGeometryDefinitions.size(); +} + + +/* + * Creates a new AnalyticGeometry object, adds it to this Geometry object and + * returns the AnalyticGeometry object created. + */ +AnalyticGeometry* +Geometry::createAnalyticGeometry() +{ + AnalyticGeometry* ag = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + ag = new AnalyticGeometry(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (ag != NULL) + { + mGeometryDefinitions.appendAndOwn(ag); + } + + return ag; +} + + +/* + * Creates a new SampledFieldGeometry object, adds it to this Geometry object + * and returns the SampledFieldGeometry object created. + */ +SampledFieldGeometry* +Geometry::createSampledFieldGeometry() +{ + SampledFieldGeometry* sfg = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + sfg = new SampledFieldGeometry(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (sfg != NULL) + { + mGeometryDefinitions.appendAndOwn(sfg); + } + + return sfg; +} + + +/* + * Creates a new CSGeometry object, adds it to this Geometry object and returns + * the CSGeometry object created. + */ +CSGeometry* +Geometry::createCSGeometry() +{ + CSGeometry* csg = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + csg = new CSGeometry(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (csg != NULL) + { + mGeometryDefinitions.appendAndOwn(csg); + } + + return csg; +} + + +/* + * Creates a new ParametricGeometry object, adds it to this Geometry object and + * returns the ParametricGeometry object created. + */ +ParametricGeometry* +Geometry::createParametricGeometry() +{ + ParametricGeometry* pg = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + pg = new ParametricGeometry(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (pg != NULL) + { + mGeometryDefinitions.appendAndOwn(pg); + } + + return pg; +} + + +/* + * Creates a new MixedGeometry object, adds it to this Geometry object and + * returns the MixedGeometry object created. + */ +MixedGeometry* +Geometry::createMixedGeometry() +{ + MixedGeometry* mg = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + mg = new MixedGeometry(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (mg != NULL) + { + mGeometryDefinitions.appendAndOwn(mg); + } + + return mg; +} + + +/* + * Removes the nth GeometryDefinition from this Geometry and returns a pointer + * to it. + */ +GeometryDefinition* +Geometry::removeGeometryDefinition(unsigned int n) +{ + return mGeometryDefinitions.remove(n); +} + + +/* + * Removes the GeometryDefinition from this Geometry based on its identifier + * and returns a pointer to it. + */ +GeometryDefinition* +Geometry::removeGeometryDefinition(const std::string& sid) +{ + return mGeometryDefinitions.remove(sid); +} + + +/* + * Returns the ListOfSampledFields from this Geometry. + */ +const ListOfSampledFields* +Geometry::getListOfSampledFields() const +{ + return &mSampledFields; +} + + +/* + * Returns the ListOfSampledFields from this Geometry. + */ +ListOfSampledFields* +Geometry::getListOfSampledFields() +{ + return &mSampledFields; +} + + +/* + * Get a SampledField from the Geometry. + */ +SampledField* +Geometry::getSampledField(unsigned int n) +{ + return mSampledFields.get(n); +} + + +/* + * Get a SampledField from the Geometry. + */ +const SampledField* +Geometry::getSampledField(unsigned int n) const +{ + return mSampledFields.get(n); +} + + +/* + * Get a SampledField from the Geometry based on its identifier. + */ +SampledField* +Geometry::getSampledField(const std::string& sid) +{ + return mSampledFields.get(sid); +} + + +/* + * Get a SampledField from the Geometry based on its identifier. + */ +const SampledField* +Geometry::getSampledField(const std::string& sid) const +{ + return mSampledFields.get(sid); +} + + +/* + * Adds a copy of the given SampledField to this Geometry. + */ +int +Geometry::addSampledField(const SampledField* sf) +{ + if (sf == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (sf->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != sf->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != sf->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(sf)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (sf->isSetId() && (mSampledFields.get(sf->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mSampledFields.append(sf); + } +} + + +/* + * Get the number of SampledField objects in this Geometry. + */ +unsigned int +Geometry::getNumSampledFields() const +{ + return mSampledFields.size(); +} + + +/* + * Creates a new SampledField object, adds it to this Geometry object and + * returns the SampledField object created. + */ +SampledField* +Geometry::createSampledField() +{ + SampledField* sf = NULL; + + try + { + SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces()); + sf = new SampledField(spatialns); + delete spatialns; + } + catch (...) + { + } + + if (sf != NULL) + { + mSampledFields.appendAndOwn(sf); + } + + return sf; +} + + +/* + * Removes the nth SampledField from this Geometry and returns a pointer to it. + */ +SampledField* +Geometry::removeSampledField(unsigned int n) +{ + return mSampledFields.remove(n); +} + + +/* + * Removes the SampledField from this Geometry based on its identifier and + * returns a pointer to it. + */ +SampledField* +Geometry::removeSampledField(const std::string& sid) +{ + return mSampledFields.remove(sid); +} + + +/* + * Returns the XML element name of this Geometry object. + */ +const std::string& +Geometry::getElementName() const +{ + static const string name = "geometry"; + return name; +} + + +/* + * Returns the libSBML type code for this Geometry object. + */ +int +Geometry::getTypeCode() const +{ + return SBML_SPATIAL_GEOMETRY; +} + + +/* + * Predicate returning @c true if all the required attributes for this Geometry + * object have been set. + */ +bool +Geometry::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetCoordinateSystem() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Geometry::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (getNumCoordinateComponents() > 0) + { + mCoordinateComponents.write(stream); + } + + if (getNumDomainTypes() > 0) + { + mDomainTypes.write(stream); + } + + if (getNumDomains() > 0) + { + mDomains.write(stream); + } + + if (getNumAdjacentDomains() > 0) + { + mAdjacentDomains.write(stream); + } + + if (getNumGeometryDefinitions() > 0) + { + mGeometryDefinitions.write(stream); + } + + if (getNumSampledFields() > 0) + { + mSampledFields.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Geometry::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mCoordinateComponents.accept(v); + + mDomainTypes.accept(v); + + mDomains.accept(v); + + mAdjacentDomains.accept(v); + + mGeometryDefinitions.accept(v); + + mSampledFields.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Geometry::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + mCoordinateComponents.setSBMLDocument(d); + + mDomainTypes.setSBMLDocument(d); + + mDomains.setSBMLDocument(d); + + mAdjacentDomains.setSBMLDocument(d); + + mGeometryDefinitions.setSBMLDocument(d); + + mSampledFields.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Geometry::connectToChild() +{ + SBase::connectToChild(); + + mCoordinateComponents.connectToParent(this); + + mDomainTypes.connectToParent(this); + + mDomains.connectToParent(this); + + mAdjacentDomains.connectToParent(this); + + mGeometryDefinitions.connectToParent(this); + + mSampledFields.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Geometry::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mCoordinateComponents.enablePackageInternal(pkgURI, pkgPrefix, flag); + + mDomainTypes.enablePackageInternal(pkgURI, pkgPrefix, flag); + + mDomains.enablePackageInternal(pkgURI, pkgPrefix, flag); + + mAdjacentDomains.enablePackageInternal(pkgURI, pkgPrefix, flag); + + mGeometryDefinitions.enablePackageInternal(pkgURI, pkgPrefix, flag); + + mSampledFields.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +Geometry::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + mCoordinateComponents.updateSBMLNamespace(package, level, version); + + mDomainTypes.updateSBMLNamespace(package, level, version); + + mDomains.updateSBMLNamespace(package, level, version); + + mAdjacentDomains.updateSBMLNamespace(package, level, version); + + mGeometryDefinitions.updateSBMLNamespace(package, level, version); + + mSampledFields.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "coordinateSystem") + { + value = getCoordinateSystemAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Geometry's attribute "attributeName" is + * set. + */ +bool +Geometry::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "coordinateSystem") + { + value = isSetCoordinateSystem(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "coordinateSystem") + { + return_value = setCoordinateSystem(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Geometry. + */ +int +Geometry::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "coordinateSystem") + { + value = unsetCoordinateSystem(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this Geometry. + */ +SBase* +Geometry::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "coordinateComponent") + { + return createCoordinateComponent(); + } + else if (elementName == "domainType") + { + return createDomainType(); + } + else if (elementName == "domain") + { + return createDomain(); + } + else if (elementName == "adjacentDomain") + { + return createAdjacentDomains(); + } + else if (elementName == "analyticGeometry") + { + return createAnalyticGeometry(); + } + else if (elementName == "sampledFieldGeometry") + { + return createSampledFieldGeometry(); + } + else if (elementName == "csGeometry") + { + return createCSGeometry(); + } + else if (elementName == "parametricGeometry") + { + return createParametricGeometry(); + } + else if (elementName == "mixedGeometry") + { + return createMixedGeometry(); + } + else if (elementName == "sampledField") + { + return createSampledField(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this Geometry. + */ +int +Geometry::addChildObject(const std::string& elementName, const SBase* element) +{ + if (elementName == "coordinateComponent" && element->getTypeCode() == + SBML_SPATIAL_COORDINATECOMPONENT) + { + return addCoordinateComponent((const CoordinateComponent*)(element)); + } + else if (elementName == "domainType" && element->getTypeCode() == + SBML_SPATIAL_DOMAINTYPE) + { + return addDomainType((const DomainType*)(element)); + } + else if (elementName == "domain" && element->getTypeCode() == + SBML_SPATIAL_DOMAIN) + { + return addDomain((const Domain*)(element)); + } + else if (elementName == "adjacentDomain" && element->getTypeCode() == + SBML_SPATIAL_ADJACENTDOMAINS) + { + return addAdjacentDomains((const AdjacentDomains*)(element)); + } + else if (elementName == "analyticGeometry" && element->getTypeCode() == + SBML_SPATIAL_ANALYTICGEOMETRY) + { + return addGeometryDefinition((const GeometryDefinition*)(element)); + } + else if (elementName == "sampledFieldGeometry" && element->getTypeCode() == + SBML_SPATIAL_SAMPLEDFIELDGEOMETRY) + { + return addGeometryDefinition((const GeometryDefinition*)(element)); + } + else if (elementName == "csGeometry" && element->getTypeCode() == + SBML_SPATIAL_CSGEOMETRY) + { + return addGeometryDefinition((const GeometryDefinition*)(element)); + } + else if (elementName == "parametricGeometry" && element->getTypeCode() == + SBML_SPATIAL_PARAMETRICGEOMETRY) + { + return addGeometryDefinition((const GeometryDefinition*)(element)); + } + else if (elementName == "mixedGeometry" && element->getTypeCode() == + SBML_SPATIAL_MIXEDGEOMETRY) + { + return addGeometryDefinition((const GeometryDefinition*)(element)); + } + else if (elementName == "sampledField" && element->getTypeCode() == + SBML_SPATIAL_SAMPLEDFIELD) + { + return addSampledField((const SampledField*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * Geometry. + */ +SBase* +Geometry::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "coordinateComponent") + { + return removeCoordinateComponent(id); + } + else if (elementName == "domainType") + { + return removeDomainType(id); + } + else if (elementName == "domain") + { + return removeDomain(id); + } + else if (elementName == "adjacentDomain") + { + return removeAdjacentDomains(id); + } + else if (elementName == "analyticGeometry") + { + return removeGeometryDefinition(id); + } + else if (elementName == "sampledFieldGeometry") + { + return removeGeometryDefinition(id); + } + else if (elementName == "csGeometry") + { + return removeGeometryDefinition(id); + } + else if (elementName == "parametricGeometry") + { + return removeGeometryDefinition(id); + } + else if (elementName == "mixedGeometry") + { + return removeGeometryDefinition(id); + } + else if (elementName == "sampledField") + { + return removeSampledField(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this Geometry. + */ +unsigned int +Geometry::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "coordinateComponent") + { + return getNumCoordinateComponents(); + } + else if (elementName == "domainType") + { + return getNumDomainTypes(); + } + else if (elementName == "domain") + { + return getNumDomains(); + } + else if (elementName == "adjacentDomain") + { + return getNumAdjacentDomains(); + } + else if (elementName == "geometryDefinition") + { + return getNumGeometryDefinitions(); + } + else if (elementName == "sampledField") + { + return getNumSampledFields(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this Geometry. + */ +SBase* +Geometry::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "coordinateComponent") + { + return getCoordinateComponent(index); + } + else if (elementName == "domainType") + { + return getDomainType(index); + } + else if (elementName == "domain") + { + return getDomain(index); + } + else if (elementName == "adjacentDomain") + { + return getAdjacentDomains(index); + } + else if (elementName == "geometryDefinition") + { + return getGeometryDefinition(index); + } + else if (elementName == "sampledField") + { + return getSampledField(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +Geometry::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + obj = mCoordinateComponents.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + obj = mDomainTypes.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + obj = mDomains.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + obj = mAdjacentDomains.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + obj = mGeometryDefinitions.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + obj = mSampledFields.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +Geometry::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mCoordinateComponents.getMetaId() == metaid) + { + return &mCoordinateComponents; + } + + if (mDomainTypes.getMetaId() == metaid) + { + return &mDomainTypes; + } + + if (mDomains.getMetaId() == metaid) + { + return &mDomains; + } + + if (mAdjacentDomains.getMetaId() == metaid) + { + return &mAdjacentDomains; + } + + if (mGeometryDefinitions.getMetaId() == metaid) + { + return &mGeometryDefinitions; + } + + if (mSampledFields.getMetaId() == metaid) + { + return &mSampledFields; + } + + obj = mCoordinateComponents.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + obj = mDomainTypes.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + obj = mDomains.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + obj = mAdjacentDomains.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + obj = mGeometryDefinitions.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + obj = mSampledFields.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +Geometry::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mCoordinateComponents, filter); + ADD_FILTERED_LIST(ret, sublist, mDomainTypes, filter); + ADD_FILTERED_LIST(ret, sublist, mDomains, filter); + ADD_FILTERED_LIST(ret, sublist, mAdjacentDomains, filter); + ADD_FILTERED_LIST(ret, sublist, mGeometryDefinitions, filter); + ADD_FILTERED_LIST(ret, sublist, mSampledFields, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +Geometry::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "listOfCoordinateComponents") + { + if (getErrorLog() && mCoordinateComponents.size() != 0) + { + getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mCoordinateComponents; + } + else if (name == "listOfDomainTypes") + { + if (getErrorLog() && mDomainTypes.size() != 0) + { + getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mDomainTypes; + } + else if (name == "listOfDomains") + { + if (getErrorLog() && mDomains.size() != 0) + { + getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mDomains; + } + else if (name == "listOfAdjacentDomains") + { + if (getErrorLog() && mAdjacentDomains.size() != 0) + { + getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mAdjacentDomains; + } + else if (name == "listOfGeometryDefinitions") + { + if (getErrorLog() && mGeometryDefinitions.size() != 0) + { + getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mGeometryDefinitions; + } + else if (name == "listOfSampledFields") + { + if (getErrorLog() && mSampledFields.size() != 0) + { + getErrorLog()->logPackageError("spatial", SpatialGeometryAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mSampledFields; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Geometry::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("coordinateSystem"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Geometry::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", SpatialGeometryAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", SpatialGeometryAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "optional" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + + // + // coordinateSystem enum (use = "required" ) + // + + std::string coordinateSystem; + assigned = attributes.readInto("coordinateSystem", coordinateSystem); + + if (assigned == true) + { + if (coordinateSystem.empty() == true) + { + logEmptyString(coordinateSystem, level, version, ""); + } + else + { + mCoordinateSystem = GeometryKind_fromString(coordinateSystem.c_str()); + + if (log && GeometryKind_isValid(mCoordinateSystem) == 0) + { + std::string msg = "The coordinateSystem on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + coordinateSystem + "', which is not a valid option."; + + log->logPackageError("spatial", + SpatialGeometryCoordinateSystemMustBeGeometryKindEnum, pkgVersion, + level, version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'coordinateSystem' is missing."; + log->logPackageError("spatial", SpatialGeometryAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Geometry::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetCoordinateSystem() == true) + { + stream.writeAttribute("coordinateSystem", getPrefix(), + GeometryKind_toString(mCoordinateSystem)); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Geometry_t using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +Geometry_t * +Geometry_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new Geometry(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Geometry_t object. + */ +LIBSBML_EXTERN +Geometry_t* +Geometry_clone(const Geometry_t* g) +{ + if (g != NULL) + { + return static_cast(g->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Geometry_t object. + */ +LIBSBML_EXTERN +void +Geometry_free(Geometry_t* g) +{ + if (g != NULL) + { + delete g; + } +} + + +/* + * Returns the value of the "id" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +char * +Geometry_getId(const Geometry_t * g) +{ + if (g == NULL) + { + return NULL; + } + + return g->getId().empty() ? NULL : safe_strdup(g->getId().c_str()); +} + + +/* + * Returns the value of the "coordinateSystem" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +GeometryKind_t +Geometry_getCoordinateSystem(const Geometry_t * g) +{ + if (g == NULL) + { + return SPATIAL_GEOMETRYKIND_INVALID; + } + + return g->getCoordinateSystem(); +} + + +/* + * Returns the value of the "coordinateSystem" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +char * +Geometry_getCoordinateSystemAsString(const Geometry_t * g) +{ + return (char*)(GeometryKind_toString(g->getCoordinateSystem())); +} + + +/* + * Predicate returning @c 1 (true) if this Geometry_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +Geometry_isSetId(const Geometry_t * g) +{ + return (g != NULL) ? static_cast(g->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Geometry_t's "coordinateSystem" + * attribute is set. + */ +LIBSBML_EXTERN +int +Geometry_isSetCoordinateSystem(const Geometry_t * g) +{ + return (g != NULL) ? static_cast(g->isSetCoordinateSystem()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_setId(Geometry_t * g, const char * id) +{ + return (g != NULL) ? g->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "coordinateSystem" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_setCoordinateSystem(Geometry_t * g, GeometryKind_t coordinateSystem) +{ + return (g != NULL) ? g->setCoordinateSystem(coordinateSystem) : + LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "coordinateSystem" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_setCoordinateSystemAsString(Geometry_t * g, + const char * coordinateSystem) +{ + return (g != NULL) ? g->setCoordinateSystem(coordinateSystem): + LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_unsetId(Geometry_t * g) +{ + return (g != NULL) ? g->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "coordinateSystem" attribute of this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_unsetCoordinateSystem(Geometry_t * g) +{ + return (g != NULL) ? g->unsetCoordinateSystem() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing CoordinateComponent_t objects from this + * Geometry_t. + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfCoordinateComponents(Geometry_t* g) +{ + return (g != NULL) ? g->getListOfCoordinateComponents() : NULL; +} + + +/* + * Get a CoordinateComponent_t from the Geometry_t. + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_getCoordinateComponent(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->getCoordinateComponent(n) : NULL; +} + + +/* + * Get a CoordinateComponent_t from the Geometry_t based on its identifier. + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_getCoordinateComponentById(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getCoordinateComponent(sid) : NULL; +} + + +/* + * Adds a copy of the given CoordinateComponent_t to this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_addCoordinateComponent(Geometry_t* g, + const CoordinateComponent_t* cc) +{ + return (g != NULL) ? g->addCoordinateComponent(cc) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of CoordinateComponent_t objects in this Geometry_t. + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumCoordinateComponents(Geometry_t* g) +{ + return (g != NULL) ? g->getNumCoordinateComponents() : SBML_INT_MAX; +} + + +/* + * Creates a new CoordinateComponent_t object, adds it to this Geometry_t + * object and returns the CoordinateComponent_t object created. + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_createCoordinateComponent(Geometry_t* g) +{ + return (g != NULL) ? g->createCoordinateComponent() : NULL; +} + + +/* + * Removes the nth CoordinateComponent_t from this Geometry_t and returns a + * pointer to it. + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_removeCoordinateComponent(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->removeCoordinateComponent(n) : NULL; +} + + +/* + * Removes the CoordinateComponent_t from this Geometry_t based on its + * identifier and returns a pointer to it. + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_removeCoordinateComponentById(Geometry_t* g, const char* sid) +{ + return (g != NULL && sid != NULL) ? g->removeCoordinateComponent(sid) : NULL; +} + + +/* + * Returns a ListOf_t * containing DomainType_t objects from this Geometry_t. + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfDomainTypes(Geometry_t* g) +{ + return (g != NULL) ? g->getListOfDomainTypes() : NULL; +} + + +/* + * Get a DomainType_t from the Geometry_t. + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_getDomainType(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->getDomainType(n) : NULL; +} + + +/* + * Get a DomainType_t from the Geometry_t based on its identifier. + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_getDomainTypeById(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getDomainType(sid) : NULL; +} + + +/* + * Adds a copy of the given DomainType_t to this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_addDomainType(Geometry_t* g, const DomainType_t* dt) +{ + return (g != NULL) ? g->addDomainType(dt) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of DomainType_t objects in this Geometry_t. + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumDomainTypes(Geometry_t* g) +{ + return (g != NULL) ? g->getNumDomainTypes() : SBML_INT_MAX; +} + + +/* + * Creates a new DomainType_t object, adds it to this Geometry_t object and + * returns the DomainType_t object created. + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_createDomainType(Geometry_t* g) +{ + return (g != NULL) ? g->createDomainType() : NULL; +} + + +/* + * Removes the nth DomainType_t from this Geometry_t and returns a pointer to + * it. + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_removeDomainType(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->removeDomainType(n) : NULL; +} + + +/* + * Removes the DomainType_t from this Geometry_t based on its identifier and + * returns a pointer to it. + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_removeDomainTypeById(Geometry_t* g, const char* sid) +{ + return (g != NULL && sid != NULL) ? g->removeDomainType(sid) : NULL; +} + + +/* + * Returns a ListOf_t * containing Domain_t objects from this Geometry_t. + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfDomains(Geometry_t* g) +{ + return (g != NULL) ? g->getListOfDomains() : NULL; +} + + +/* + * Get a Domain_t from the Geometry_t. + */ +LIBSBML_EXTERN +Domain_t* +Geometry_getDomain(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->getDomain(n) : NULL; +} + + +/* + * Get a Domain_t from the Geometry_t based on its identifier. + */ +LIBSBML_EXTERN +Domain_t* +Geometry_getDomainById(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getDomain(sid) : NULL; +} + + +/* + * Get a Domain_t from the Geometry_t based on the DomainType to which it + * refers. + */ +LIBSBML_EXTERN +Domain_t* +Geometry_getDomainByDomainType(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getDomainByDomainType(sid) : NULL; +} + + +/* + * Adds a copy of the given Domain_t to this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_addDomain(Geometry_t* g, const Domain_t* d) +{ + return (g != NULL) ? g->addDomain(d) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of Domain_t objects in this Geometry_t. + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumDomains(Geometry_t* g) +{ + return (g != NULL) ? g->getNumDomains() : SBML_INT_MAX; +} + + +/* + * Creates a new Domain_t object, adds it to this Geometry_t object and returns + * the Domain_t object created. + */ +LIBSBML_EXTERN +Domain_t* +Geometry_createDomain(Geometry_t* g) +{ + return (g != NULL) ? g->createDomain() : NULL; +} + + +/* + * Removes the nth Domain_t from this Geometry_t and returns a pointer to it. + */ +LIBSBML_EXTERN +Domain_t* +Geometry_removeDomain(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->removeDomain(n) : NULL; +} + + +/* + * Removes the Domain_t from this Geometry_t based on its identifier and + * returns a pointer to it. + */ +LIBSBML_EXTERN +Domain_t* +Geometry_removeDomainById(Geometry_t* g, const char* sid) +{ + return (g != NULL && sid != NULL) ? g->removeDomain(sid) : NULL; +} + + +/* + * Returns a ListOf_t * containing AdjacentDomains_t objects from this + * Geometry_t. + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfAdjacentDomains(Geometry_t* g) +{ + return (g != NULL) ? g->getListOfAdjacentDomains() : NULL; +} + + +/* + * Get an AdjacentDomains_t from the Geometry_t. + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomains(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->getAdjacentDomains(n) : NULL; +} + + +/* + * Get an AdjacentDomains_t from the Geometry_t based on its identifier. + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomainsById(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getAdjacentDomains(sid) : NULL; +} + + +/* + * Get an AdjacentDomains_t from the Geometry_t based on the Domain1 to which + * it refers. + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomainsByDomain1(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getAdjacentDomainsByDomain1(sid) : + NULL; +} + + +/* + * Get an AdjacentDomains_t from the Geometry_t based on the Domain2 to which + * it refers. + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomainsByDomain2(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getAdjacentDomainsByDomain2(sid) : + NULL; +} + + +/* + * Adds a copy of the given AdjacentDomains_t to this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_addAdjacentDomains(Geometry_t* g, const AdjacentDomains_t* ad) +{ + return (g != NULL) ? g->addAdjacentDomains(ad) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of AdjacentDomains_t objects in this Geometry_t. + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumAdjacentDomains(Geometry_t* g) +{ + return (g != NULL) ? g->getNumAdjacentDomains() : SBML_INT_MAX; +} + + +/* + * Creates a new AdjacentDomains_t object, adds it to this Geometry_t object + * and returns the AdjacentDomains_t object created. + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_createAdjacentDomains(Geometry_t* g) +{ + return (g != NULL) ? g->createAdjacentDomains() : NULL; +} + + +/* + * Removes the nth AdjacentDomains_t from this Geometry_t and returns a pointer + * to it. + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_removeAdjacentDomains(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->removeAdjacentDomains(n) : NULL; +} + + +/* + * Removes the AdjacentDomains_t from this Geometry_t based on its identifier + * and returns a pointer to it. + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_removeAdjacentDomainsById(Geometry_t* g, const char* sid) +{ + return (g != NULL && sid != NULL) ? g->removeAdjacentDomains(sid) : NULL; +} + + +/* + * Returns a ListOf_t * containing GeometryDefinition_t objects from this + * Geometry_t. + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfGeometryDefinitions(Geometry_t* g) +{ + return (g != NULL) ? g->getListOfGeometryDefinitions() : NULL; +} + + +/* + * Get a GeometryDefinition_t from the Geometry_t. + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_getGeometryDefinition(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->getGeometryDefinition(n) : NULL; +} + + +/* + * Get a GeometryDefinition_t from the Geometry_t based on its identifier. + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_getGeometryDefinitionById(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getGeometryDefinition(sid) : NULL; +} + + +/* + * Adds a copy of the given GeometryDefinition_t to this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_addGeometryDefinition(Geometry_t* g, const GeometryDefinition_t* gd) +{ + return (g != NULL) ? g->addGeometryDefinition(gd) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of GeometryDefinition_t objects in this Geometry_t. + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumGeometryDefinitions(Geometry_t* g) +{ + return (g != NULL) ? g->getNumGeometryDefinitions() : SBML_INT_MAX; +} + + +/* + * Creates a new AnalyticGeometry_t object, adds it to this Geometry_t object + * and returns the AnalyticGeometry_t object created. + */ +LIBSBML_EXTERN +AnalyticGeometry_t* +Geometry_createAnalyticGeometry(Geometry_t* g) +{ + return (g != NULL) ? g->createAnalyticGeometry() : NULL; +} + + +/* + * Creates a new SampledFieldGeometry_t object, adds it to this Geometry_t + * object and returns the SampledFieldGeometry_t object created. + */ +LIBSBML_EXTERN +SampledFieldGeometry_t* +Geometry_createSampledFieldGeometry(Geometry_t* g) +{ + return (g != NULL) ? g->createSampledFieldGeometry() : NULL; +} + + +/* + * Creates a new CSGeometry_t object, adds it to this Geometry_t object and + * returns the CSGeometry_t object created. + */ +LIBSBML_EXTERN +CSGeometry_t* +Geometry_createCSGeometry(Geometry_t* g) +{ + return (g != NULL) ? g->createCSGeometry() : NULL; +} + + +/* + * Creates a new ParametricGeometry_t object, adds it to this Geometry_t object + * and returns the ParametricGeometry_t object created. + */ +LIBSBML_EXTERN +ParametricGeometry_t* +Geometry_createParametricGeometry(Geometry_t* g) +{ + return (g != NULL) ? g->createParametricGeometry() : NULL; +} + + +/* + * Creates a new MixedGeometry_t object, adds it to this Geometry_t object and + * returns the MixedGeometry_t object created. + */ +LIBSBML_EXTERN +MixedGeometry_t* +Geometry_createMixedGeometry(Geometry_t* g) +{ + return (g != NULL) ? g->createMixedGeometry() : NULL; +} + + +/* + * Removes the nth GeometryDefinition_t from this Geometry_t and returns a + * pointer to it. + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_removeGeometryDefinition(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->removeGeometryDefinition(n) : NULL; +} + + +/* + * Removes the GeometryDefinition_t from this Geometry_t based on its + * identifier and returns a pointer to it. + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_removeGeometryDefinitionById(Geometry_t* g, const char* sid) +{ + return (g != NULL && sid != NULL) ? g->removeGeometryDefinition(sid) : NULL; +} + + +/* + * Returns a ListOf_t * containing SampledField_t objects from this Geometry_t. + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfSampledFields(Geometry_t* g) +{ + return (g != NULL) ? g->getListOfSampledFields() : NULL; +} + + +/* + * Get a SampledField_t from the Geometry_t. + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_getSampledField(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->getSampledField(n) : NULL; +} + + +/* + * Get a SampledField_t from the Geometry_t based on its identifier. + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_getSampledFieldById(Geometry_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getSampledField(sid) : NULL; +} + + +/* + * Adds a copy of the given SampledField_t to this Geometry_t. + */ +LIBSBML_EXTERN +int +Geometry_addSampledField(Geometry_t* g, const SampledField_t* sf) +{ + return (g != NULL) ? g->addSampledField(sf) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of SampledField_t objects in this Geometry_t. + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumSampledFields(Geometry_t* g) +{ + return (g != NULL) ? g->getNumSampledFields() : SBML_INT_MAX; +} + + +/* + * Creates a new SampledField_t object, adds it to this Geometry_t object and + * returns the SampledField_t object created. + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_createSampledField(Geometry_t* g) +{ + return (g != NULL) ? g->createSampledField() : NULL; +} + + +/* + * Removes the nth SampledField_t from this Geometry_t and returns a pointer to + * it. + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_removeSampledField(Geometry_t* g, unsigned int n) +{ + return (g != NULL) ? g->removeSampledField(n) : NULL; +} + + +/* + * Removes the SampledField_t from this Geometry_t based on its identifier and + * returns a pointer to it. + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_removeSampledFieldById(Geometry_t* g, const char* sid) +{ + return (g != NULL && sid != NULL) ? g->removeSampledField(sid) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Geometry_t object have been set. + */ +LIBSBML_EXTERN +int +Geometry_hasRequiredAttributes(const Geometry_t * g) +{ + return (g != NULL) ? static_cast(g->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Geometry.h b/generator/tests/test_cpp_code/test-code/Geometry.h index 7f9990e0..a11f8557 100644 --- a/generator/tests/test_cpp_code/test-code/Geometry.h +++ b/generator/tests/test_cpp_code/test-code/Geometry.h @@ -1,3732 +1,3732 @@ -/** - * @file Geometry.h - * @brief Definition of the Geometry class. - * @author SBMLTeam - * - * - * - * @class Geometry - * @sbmlbrief{spatial} TODO:Definition of the Geometry class. - */ - -/** - * - * - * - * @class doc_geometry_coordinateSystem - * - * @par - * The attribute "coordinateSystem" on a Geometry object is used to TODO:add - * explanation - * - * In the SBML - * Level 3 Version 1 Spatial specification, the following are the - * allowable values for "coordinateSystem": - *
    - *
  • @c "cartesian", TODO:add description - * - *
- */ - - -#ifndef Geometry_H__ -#define Geometry_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Geometry : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - GeometryKind_t mCoordinateSystem; - ListOfCoordinateComponents mCoordinateComponents; - ListOfDomainTypes mDomainTypes; - ListOfDomains mDomains; - ListOfAdjacentDomains mAdjacentDomains; - ListOfGeometryDefinitions mGeometryDefinitions; - ListOfSampledFields mSampledFields; - - /** @endcond */ - -public: - - /** - * Creates a new Geometry using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Geometry. - * - * @param version an unsigned int, the SBML Version to assign to this - * Geometry. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this Geometry. - * - * @copydetails doc_note_setting_lv_pkg - */ - Geometry(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Geometry using the given SpatialPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Geometry(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for Geometry. - * - * @param orig the Geometry instance to copy. - */ - Geometry(const Geometry& orig); - - - /** - * Assignment operator for Geometry. - * - * @param rhs the Geometry object whose values are to be used as the basis of - * the assignment. - */ - Geometry& operator=(const Geometry& rhs); - - - /** - * Creates and returns a deep copy of this Geometry object. - * - * @return a (deep) copy of this Geometry object. - */ - virtual Geometry* clone() const; - - - /** - * Destructor for Geometry. - */ - virtual ~Geometry(); - - - /** - * Returns the value of the "id" attribute of this Geometry. - * - * @return the value of the "id" attribute of this Geometry as a string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "coordinateSystem" attribute of this Geometry. - * - * @return the value of the "coordinateSystem" attribute of this Geometry as - * a GeometryKind_t. - * - * @copydetails doc_geometry_coordinateSystem - * @if clike The value is drawn from the enumeration @ref GeometryKind_t - * @endif - * The possible values returned by this method are: - * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_CARTESIAN, GeometryKind_t} - * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_INVALID, GeometryKind_t} - */ - GeometryKind_t getCoordinateSystem() const; - - - /** - * Returns the value of the "coordinateSystem" attribute of this Geometry. - * - * @return the value of the "coordinateSystem" attribute of this Geometry as - * a string. - * - * @copydetails doc_geometry_coordinateSystem - * The possible values returned by this method are: - * @li @c "cartesian" - * @li @c "invalid GeometryKind value" - */ - std::string getCoordinateSystemAsString() const; - - - /** - * Predicate returning @c true if this Geometry's "id" attribute is set. - * - * @return @c true if this Geometry's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this Geometry's "coordinateSystem" - * attribute is set. - * - * @return @c true if this Geometry's "coordinateSystem" attribute has been - * set, otherwise @c false is returned. - * - * @copydetails doc_geometry_coordinateSystem - */ - bool isSetCoordinateSystem() const; - - - /** - * Sets the value of the "id" attribute of this Geometry. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "coordinateSystem" attribute of this Geometry. - * - * @param coordinateSystem @if clike GeometryKind_t@else int@endif value of - * the "coordinateSystem" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_geometry_coordinateSystem - */ - int setCoordinateSystem(const GeometryKind_t coordinateSystem); - - - /** - * Sets the value of the "coordinateSystem" attribute of this Geometry. - * - * @param coordinateSystem std::string& of the "coordinateSystem" attribute - * to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_geometry_coordinateSystem - */ - int setCoordinateSystem(const std::string& coordinateSystem); - - - /** - * Unsets the value of the "id" attribute of this Geometry. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "coordinateSystem" attribute of this Geometry. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_geometry_coordinateSystem - */ - int unsetCoordinateSystem(); - - - /** - * Returns the ListOfCoordinateComponents from this Geometry. - * - * @return the ListOfCoordinateComponents from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - const ListOfCoordinateComponents* getListOfCoordinateComponents() const; - - - /** - * Returns the ListOfCoordinateComponents from this Geometry. - * - * @return the ListOfCoordinateComponents from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - ListOfCoordinateComponents* getListOfCoordinateComponents(); - - - /** - * Get a CoordinateComponent from the Geometry. - * - * @param n an unsigned int representing the index of the CoordinateComponent - * to retrieve. - * - * @return the nth CoordinateComponent in the ListOfCoordinateComponents - * within this Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - CoordinateComponent* getCoordinateComponent(unsigned int n); - - - /** - * Get a CoordinateComponent from the Geometry. - * - * @param n an unsigned int representing the index of the CoordinateComponent - * to retrieve. - * - * @return the nth CoordinateComponent in the ListOfCoordinateComponents - * within this Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - const CoordinateComponent* getCoordinateComponent(unsigned int n) const; - - - /** - * Get a CoordinateComponent from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the CoordinateComponent - * to retrieve. - * - * @return the CoordinateComponent in the ListOfCoordinateComponents within - * this Geometry with the given @p sid or @c NULL if no such - * CoordinateComponent exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - CoordinateComponent* getCoordinateComponent(const std::string& sid); - - - /** - * Get a CoordinateComponent from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the CoordinateComponent - * to retrieve. - * - * @return the CoordinateComponent in the ListOfCoordinateComponents within - * this Geometry with the given @p sid or @c NULL if no such - * CoordinateComponent exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - const CoordinateComponent* getCoordinateComponent(const std::string& sid) - const; - - - /** - * Adds a copy of the given CoordinateComponent to this Geometry. - * - * @param cc the CoordinateComponent object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - int addCoordinateComponent(const CoordinateComponent* cc); - - - /** - * Get the number of CoordinateComponent objects in this Geometry. - * - * @return the number of CoordinateComponent objects in this Geometry. - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getCoordinateComponent(unsigned int n) - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - unsigned int getNumCoordinateComponents() const; - - - /** - * Creates a new CoordinateComponent object, adds it to this Geometry object - * and returns the CoordinateComponent object created. - * - * @return a new CoordinateComponent object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see getCoordinateComponent(const std::string& sid) - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - * @see removeCoordinateComponent(unsigned int n) - */ - CoordinateComponent* createCoordinateComponent(); - - - /** - * Removes the nth CoordinateComponent from this Geometry and returns a - * pointer to it. - * - * @param n an unsigned int representing the index of the CoordinateComponent - * to remove. - * - * @return a pointer to the nth CoordinateComponent in this Geometry. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(const std::string& sid) - */ - CoordinateComponent* removeCoordinateComponent(unsigned int n); - - - /** - * Removes the CoordinateComponent from this Geometry based on its identifier - * and returns a pointer to it. - * - * @param sid a string representing the identifier of the CoordinateComponent - * to remove. - * - * @return the CoordinateComponent in this Geometry based on the identifier - * or NULL if no such CoordinateComponent exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addCoordinateComponent(const CoordinateComponent* object) - * @see createCoordinateComponent() - * @see getCoordinateComponent(const std::string& sid) - * @see getCoordinateComponent(unsigned int n) - * @see getNumCoordinateComponents() - * @see removeCoordinateComponent(unsigned int n) - */ - CoordinateComponent* removeCoordinateComponent(const std::string& sid); - - - /** - * Returns the ListOfDomainTypes from this Geometry. - * - * @return the ListOfDomainTypes from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - const ListOfDomainTypes* getListOfDomainTypes() const; - - - /** - * Returns the ListOfDomainTypes from this Geometry. - * - * @return the ListOfDomainTypes from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - ListOfDomainTypes* getListOfDomainTypes(); - - - /** - * Get a DomainType from the Geometry. - * - * @param n an unsigned int representing the index of the DomainType to - * retrieve. - * - * @return the nth DomainType in the ListOfDomainTypes within this Geometry - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - DomainType* getDomainType(unsigned int n); - - - /** - * Get a DomainType from the Geometry. - * - * @param n an unsigned int representing the index of the DomainType to - * retrieve. - * - * @return the nth DomainType in the ListOfDomainTypes within this Geometry - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - const DomainType* getDomainType(unsigned int n) const; - - - /** - * Get a DomainType from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the DomainType to - * retrieve. - * - * @return the DomainType in the ListOfDomainTypes within this Geometry with - * the given @p sid or @c NULL if no such DomainType exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - DomainType* getDomainType(const std::string& sid); - - - /** - * Get a DomainType from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the DomainType to - * retrieve. - * - * @return the DomainType in the ListOfDomainTypes within this Geometry with - * the given @p sid or @c NULL if no such DomainType exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - const DomainType* getDomainType(const std::string& sid) const; - - - /** - * Adds a copy of the given DomainType to this Geometry. - * - * @param dt the DomainType object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - int addDomainType(const DomainType* dt); - - - /** - * Get the number of DomainType objects in this Geometry. - * - * @return the number of DomainType objects in this Geometry. - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getDomainType(unsigned int n) - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - unsigned int getNumDomainTypes() const; - - - /** - * Creates a new DomainType object, adds it to this Geometry object and - * returns the DomainType object created. - * - * @return a new DomainType object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomainType(const DomainType* object) - * @see getDomainType(const std::string& sid) - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - * @see removeDomainType(unsigned int n) - */ - DomainType* createDomainType(); - - - /** - * Removes the nth DomainType from this Geometry and returns a pointer to it. - * - * @param n an unsigned int representing the index of the DomainType to - * remove. - * - * @return a pointer to the nth DomainType in this Geometry. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(const std::string& sid) - */ - DomainType* removeDomainType(unsigned int n); - - - /** - * Removes the DomainType from this Geometry based on its identifier and - * returns a pointer to it. - * - * @param sid a string representing the identifier of the DomainType to - * remove. - * - * @return the DomainType in this Geometry based on the identifier or NULL if - * no such DomainType exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addDomainType(const DomainType* object) - * @see createDomainType() - * @see getDomainType(const std::string& sid) - * @see getDomainType(unsigned int n) - * @see getNumDomainTypes() - * @see removeDomainType(unsigned int n) - */ - DomainType* removeDomainType(const std::string& sid); - - - /** - * Returns the ListOfDomains from this Geometry. - * - * @return the ListOfDomains from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - const ListOfDomains* getListOfDomains() const; - - - /** - * Returns the ListOfDomains from this Geometry. - * - * @return the ListOfDomains from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - ListOfDomains* getListOfDomains(); - - - /** - * Get a Domain from the Geometry. - * - * @param n an unsigned int representing the index of the Domain to retrieve. - * - * @return the nth Domain in the ListOfDomains within this Geometry or - * @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - Domain* getDomain(unsigned int n); - - - /** - * Get a Domain from the Geometry. - * - * @param n an unsigned int representing the index of the Domain to retrieve. - * - * @return the nth Domain in the ListOfDomains within this Geometry or - * @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - const Domain* getDomain(unsigned int n) const; - - - /** - * Get a Domain from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the Domain to retrieve. - * - * @return the Domain in the ListOfDomains within this Geometry with the - * given @p sid or @c NULL if no such Domain exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - Domain* getDomain(const std::string& sid); - - - /** - * Get a Domain from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the Domain to retrieve. - * - * @return the Domain in the ListOfDomains within this Geometry with the - * given @p sid or @c NULL if no such Domain exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - const Domain* getDomain(const std::string& sid) const; - - - /** - * Get a Domain from the Geometry based on the DomainType to which it refers. - * - * @param sid a string representing the "domainType" attribute of the Domain - * object to retrieve. - * - * @return the first Domain in this Geometry based on the given domainType - * attribute or NULL if no such Domain exists. - * - * @copydetails doc_returned_unowned_pointer - */ - const Domain* getDomainByDomainType(const std::string& sid) const; - - - /** - * Get a Domain from the Geometry based on the DomainType to which it refers. - * - * @param sid a string representing the "domainType" attribute of the Domain - * object to retrieve. - * - * @return the first Domain in this Geometry based on the given domainType - * attribute or NULL if no such Domain exists. - * - * @copydetails doc_returned_unowned_pointer - */ - Domain* getDomainByDomainType(const std::string& sid); - - - /** - * Adds a copy of the given Domain to this Geometry. - * - * @param d the Domain object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - int addDomain(const Domain* d); - - - /** - * Get the number of Domain objects in this Geometry. - * - * @return the number of Domain objects in this Geometry. - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getDomain(unsigned int n) - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - unsigned int getNumDomains() const; - - - /** - * Creates a new Domain object, adds it to this Geometry object and returns - * the Domain object created. - * - * @return a new Domain object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addDomain(const Domain* object) - * @see getDomain(const std::string& sid) - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - * @see removeDomain(unsigned int n) - */ - Domain* createDomain(); - - - /** - * Removes the nth Domain from this Geometry and returns a pointer to it. - * - * @param n an unsigned int representing the index of the Domain to remove. - * - * @return a pointer to the nth Domain in this Geometry. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(const std::string& sid) - */ - Domain* removeDomain(unsigned int n); - - - /** - * Removes the Domain from this Geometry based on its identifier and returns - * a pointer to it. - * - * @param sid a string representing the identifier of the Domain to remove. - * - * @return the Domain in this Geometry based on the identifier or NULL if no - * such Domain exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addDomain(const Domain* object) - * @see createDomain() - * @see getDomain(const std::string& sid) - * @see getDomain(unsigned int n) - * @see getNumDomains() - * @see removeDomain(unsigned int n) - */ - Domain* removeDomain(const std::string& sid); - - - /** - * Returns the ListOfAdjacentDomains from this Geometry. - * - * @return the ListOfAdjacentDomains from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - const ListOfAdjacentDomains* getListOfAdjacentDomains() const; - - - /** - * Returns the ListOfAdjacentDomains from this Geometry. - * - * @return the ListOfAdjacentDomains from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - ListOfAdjacentDomains* getListOfAdjacentDomains(); - - - /** - * Get an AdjacentDomains from the Geometry. - * - * @param n an unsigned int representing the index of the AdjacentDomains to - * retrieve. - * - * @return the nth AdjacentDomains in the ListOfAdjacentDomains within this - * Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - AdjacentDomains* getAdjacentDomains(unsigned int n); - - - /** - * Get an AdjacentDomains from the Geometry. - * - * @param n an unsigned int representing the index of the AdjacentDomains to - * retrieve. - * - * @return the nth AdjacentDomains in the ListOfAdjacentDomains within this - * Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - const AdjacentDomains* getAdjacentDomains(unsigned int n) const; - - - /** - * Get an AdjacentDomains from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the AdjacentDomains to - * retrieve. - * - * @return the AdjacentDomains in the ListOfAdjacentDomains within this - * Geometry with the given @p sid or @c NULL if no such AdjacentDomains - * exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - AdjacentDomains* getAdjacentDomains(const std::string& sid); - - - /** - * Get an AdjacentDomains from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the AdjacentDomains to - * retrieve. - * - * @return the AdjacentDomains in the ListOfAdjacentDomains within this - * Geometry with the given @p sid or @c NULL if no such AdjacentDomains - * exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - const AdjacentDomains* getAdjacentDomains(const std::string& sid) const; - - - /** - * Get an AdjacentDomains from the Geometry based on the Domain1 to which it - * refers. - * - * @param sid a string representing the "domain1" attribute of the - * AdjacentDomains object to retrieve. - * - * @return the first AdjacentDomains in this Geometry based on the given - * domain1 attribute or NULL if no such AdjacentDomains exists. - * - * @copydetails doc_returned_unowned_pointer - */ - const AdjacentDomains* getAdjacentDomainsByDomain1(const std::string& sid) - const; - - - /** - * Get an AdjacentDomains from the Geometry based on the Domain1 to which it - * refers. - * - * @param sid a string representing the "domain1" attribute of the - * AdjacentDomains object to retrieve. - * - * @return the first AdjacentDomains in this Geometry based on the given - * domain1 attribute or NULL if no such AdjacentDomains exists. - * - * @copydetails doc_returned_unowned_pointer - */ - AdjacentDomains* getAdjacentDomainsByDomain1(const std::string& sid); - - - /** - * Get an AdjacentDomains from the Geometry based on the Domain2 to which it - * refers. - * - * @param sid a string representing the "domain2" attribute of the - * AdjacentDomains object to retrieve. - * - * @return the first AdjacentDomains in this Geometry based on the given - * domain2 attribute or NULL if no such AdjacentDomains exists. - * - * @copydetails doc_returned_unowned_pointer - */ - const AdjacentDomains* getAdjacentDomainsByDomain2(const std::string& sid) - const; - - - /** - * Get an AdjacentDomains from the Geometry based on the Domain2 to which it - * refers. - * - * @param sid a string representing the "domain2" attribute of the - * AdjacentDomains object to retrieve. - * - * @return the first AdjacentDomains in this Geometry based on the given - * domain2 attribute or NULL if no such AdjacentDomains exists. - * - * @copydetails doc_returned_unowned_pointer - */ - AdjacentDomains* getAdjacentDomainsByDomain2(const std::string& sid); - - - /** - * Adds a copy of the given AdjacentDomains to this Geometry. - * - * @param ad the AdjacentDomains object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - int addAdjacentDomains(const AdjacentDomains* ad); - - - /** - * Get the number of AdjacentDomains objects in this Geometry. - * - * @return the number of AdjacentDomains objects in this Geometry. - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getAdjacentDomains(unsigned int n) - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - unsigned int getNumAdjacentDomains() const; - - - /** - * Creates a new AdjacentDomains object, adds it to this Geometry object and - * returns the AdjacentDomains object created. - * - * @return a new AdjacentDomains object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see getAdjacentDomains(const std::string& sid) - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - * @see removeAdjacentDomains(unsigned int n) - */ - AdjacentDomains* createAdjacentDomains(); - - - /** - * Removes the nth AdjacentDomains from this Geometry and returns a pointer - * to it. - * - * @param n an unsigned int representing the index of the AdjacentDomains to - * remove. - * - * @return a pointer to the nth AdjacentDomains in this Geometry. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(const std::string& sid) - */ - AdjacentDomains* removeAdjacentDomains(unsigned int n); - - - /** - * Removes the AdjacentDomains from this Geometry based on its identifier and - * returns a pointer to it. - * - * @param sid a string representing the identifier of the AdjacentDomains to - * remove. - * - * @return the AdjacentDomains in this Geometry based on the identifier or - * NULL if no such AdjacentDomains exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addAdjacentDomains(const AdjacentDomains* object) - * @see createAdjacentDomains() - * @see getAdjacentDomains(const std::string& sid) - * @see getAdjacentDomains(unsigned int n) - * @see getNumAdjacentDomains() - * @see removeAdjacentDomains(unsigned int n) - */ - AdjacentDomains* removeAdjacentDomains(const std::string& sid); - - - /** - * Returns the ListOfGeometryDefinitions from this Geometry. - * - * @return the ListOfGeometryDefinitions from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - const ListOfGeometryDefinitions* getListOfGeometryDefinitions() const; - - - /** - * Returns the ListOfGeometryDefinitions from this Geometry. - * - * @return the ListOfGeometryDefinitions from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - ListOfGeometryDefinitions* getListOfGeometryDefinitions(); - - - /** - * Get a GeometryDefinition from the Geometry. - * - * @param n an unsigned int representing the index of the GeometryDefinition - * to retrieve. - * - * @return the nth GeometryDefinition in the ListOfGeometryDefinitions within - * this Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - GeometryDefinition* getGeometryDefinition(unsigned int n); - - - /** - * Get a GeometryDefinition from the Geometry. - * - * @param n an unsigned int representing the index of the GeometryDefinition - * to retrieve. - * - * @return the nth GeometryDefinition in the ListOfGeometryDefinitions within - * this Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - const GeometryDefinition* getGeometryDefinition(unsigned int n) const; - - - /** - * Get a GeometryDefinition from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the GeometryDefinition - * to retrieve. - * - * @return the GeometryDefinition in the ListOfGeometryDefinitions within - * this Geometry with the given @p sid or @c NULL if no such - * GeometryDefinition exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - GeometryDefinition* getGeometryDefinition(const std::string& sid); - - - /** - * Get a GeometryDefinition from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the GeometryDefinition - * to retrieve. - * - * @return the GeometryDefinition in the ListOfGeometryDefinitions within - * this Geometry with the given @p sid or @c NULL if no such - * GeometryDefinition exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - const GeometryDefinition* getGeometryDefinition(const std::string& sid) - const; - - - /** - * Adds a copy of the given GeometryDefinition to this Geometry. - * - * @param gd the GeometryDefinition object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - int addGeometryDefinition(const GeometryDefinition* gd); - - - /** - * Get the number of GeometryDefinition objects in this Geometry. - * - * @return the number of GeometryDefinition objects in this Geometry. - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - unsigned int getNumGeometryDefinitions() const; - - - /** - * Creates a new AnalyticGeometry object, adds it to this Geometry object and - * returns the AnalyticGeometry object created. - * - * @return a new AnalyticGeometry object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - AnalyticGeometry* createAnalyticGeometry(); - - - /** - * Creates a new SampledFieldGeometry object, adds it to this Geometry object - * and returns the SampledFieldGeometry object created. - * - * @return a new SampledFieldGeometry object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - SampledFieldGeometry* createSampledFieldGeometry(); - - - /** - * Creates a new CSGeometry object, adds it to this Geometry object and - * returns the CSGeometry object created. - * - * @return a new CSGeometry object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - CSGeometry* createCSGeometry(); - - - /** - * Creates a new ParametricGeometry object, adds it to this Geometry object - * and returns the ParametricGeometry object created. - * - * @return a new ParametricGeometry object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - ParametricGeometry* createParametricGeometry(); - - - /** - * Creates a new MixedGeometry object, adds it to this Geometry object and - * returns the MixedGeometry object created. - * - * @return a new MixedGeometry object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - * @see removeGeometryDefinition(unsigned int n) - */ - MixedGeometry* createMixedGeometry(); - - - /** - * Removes the nth GeometryDefinition from this Geometry and returns a - * pointer to it. - * - * @param n an unsigned int representing the index of the GeometryDefinition - * to remove. - * - * @return a pointer to the nth GeometryDefinition in this Geometry. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(const std::string& sid) - */ - GeometryDefinition* removeGeometryDefinition(unsigned int n); - - - /** - * Removes the GeometryDefinition from this Geometry based on its identifier - * and returns a pointer to it. - * - * @param sid a string representing the identifier of the GeometryDefinition - * to remove. - * - * @return the GeometryDefinition in this Geometry based on the identifier or - * NULL if no such GeometryDefinition exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addGeometryDefinition(const GeometryDefinition* object) - * @see createGeometryDefinition() - * @see getGeometryDefinition(const std::string& sid) - * @see getGeometryDefinition(unsigned int n) - * @see getNumGeometryDefinitions() - * @see removeGeometryDefinition(unsigned int n) - */ - GeometryDefinition* removeGeometryDefinition(const std::string& sid); - - - /** - * Returns the ListOfSampledFields from this Geometry. - * - * @return the ListOfSampledFields from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - const ListOfSampledFields* getListOfSampledFields() const; - - - /** - * Returns the ListOfSampledFields from this Geometry. - * - * @return the ListOfSampledFields from this Geometry. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - ListOfSampledFields* getListOfSampledFields(); - - - /** - * Get a SampledField from the Geometry. - * - * @param n an unsigned int representing the index of the SampledField to - * retrieve. - * - * @return the nth SampledField in the ListOfSampledFields within this - * Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - SampledField* getSampledField(unsigned int n); - - - /** - * Get a SampledField from the Geometry. - * - * @param n an unsigned int representing the index of the SampledField to - * retrieve. - * - * @return the nth SampledField in the ListOfSampledFields within this - * Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - const SampledField* getSampledField(unsigned int n) const; - - - /** - * Get a SampledField from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the SampledField to - * retrieve. - * - * @return the SampledField in the ListOfSampledFields within this Geometry - * with the given @p sid or @c NULL if no such SampledField exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - SampledField* getSampledField(const std::string& sid); - - - /** - * Get a SampledField from the Geometry based on its identifier. - * - * @param sid a string representing the identifier of the SampledField to - * retrieve. - * - * @return the SampledField in the ListOfSampledFields within this Geometry - * with the given @p sid or @c NULL if no such SampledField exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - const SampledField* getSampledField(const std::string& sid) const; - - - /** - * Adds a copy of the given SampledField to this Geometry. - * - * @param sf the SampledField object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - int addSampledField(const SampledField* sf); - - - /** - * Get the number of SampledField objects in this Geometry. - * - * @return the number of SampledField objects in this Geometry. - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getSampledField(unsigned int n) - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - unsigned int getNumSampledFields() const; - - - /** - * Creates a new SampledField object, adds it to this Geometry object and - * returns the SampledField object created. - * - * @return a new SampledField object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addSampledField(const SampledField* object) - * @see getSampledField(const std::string& sid) - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - * @see removeSampledField(unsigned int n) - */ - SampledField* createSampledField(); - - - /** - * Removes the nth SampledField from this Geometry and returns a pointer to - * it. - * - * @param n an unsigned int representing the index of the SampledField to - * remove. - * - * @return a pointer to the nth SampledField in this Geometry. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(const std::string& sid) - */ - SampledField* removeSampledField(unsigned int n); - - - /** - * Removes the SampledField from this Geometry based on its identifier and - * returns a pointer to it. - * - * @param sid a string representing the identifier of the SampledField to - * remove. - * - * @return the SampledField in this Geometry based on the identifier or NULL - * if no such SampledField exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addSampledField(const SampledField* object) - * @see createSampledField() - * @see getSampledField(const std::string& sid) - * @see getSampledField(unsigned int n) - * @see getNumSampledFields() - * @see removeSampledField(unsigned int n) - */ - SampledField* removeSampledField(const std::string& sid); - - - /** - * Returns the XML element name of this Geometry object. - * - * For Geometry, the XML element name is always @c "geometry". - * - * @return the name of this element, i.e. @c "geometry". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Geometry object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_GEOMETRY, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * Geometry object have been set. - * - * @return @c true to indicate that all the required attributes of this - * Geometry have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the Geometry object are: - * @li "coordinateSystem" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Geometry's attribute "attributeName" - * is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Geometry's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Geometry. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this Geometry. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this Geometry. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * Geometry. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this Geometry. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this Geometry. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Geometry_t using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Geometry_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * Geometry_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this Geometry_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Geometry_t * -Geometry_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Geometry_t object. - * - * @param g the Geometry_t structure. - * - * @return a (deep) copy of this Geometry_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Geometry_t* -Geometry_clone(const Geometry_t* g); - - -/** - * Frees this Geometry_t object. - * - * @param g the Geometry_t structure. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -void -Geometry_free(Geometry_t* g); - - -/** - * Returns the value of the "id" attribute of this Geometry_t. - * - * @param g the Geometry_t structure whose id is sought. - * - * @return the value of the "id" attribute of this Geometry_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -char * -Geometry_getId(const Geometry_t * g); - - -/** - * Returns the value of the "coordinateSystem" attribute of this Geometry_t. - * - * @param g the Geometry_t structure whose coordinateSystem is sought. - * - * @return the value of the "coordinateSystem" attribute of this Geometry_t as - * a GeometryKind_t. - * - * @copydetails doc_geometry_coordinateSystem - * @if clike The value is drawn from the enumeration @ref GeometryKind_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_CARTESIAN, GeometryKind_t} - * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_INVALID, GeometryKind_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -GeometryKind_t -Geometry_getCoordinateSystem(const Geometry_t * g); - - -/** - * Returns the value of the "coordinateSystem" attribute of this Geometry_t. - * - * @param g the Geometry_t structure whose coordinateSystem is sought. - * - * @return the value of the "coordinateSystem" attribute of this Geometry_t as - * a const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_geometry_coordinateSystem - * The possible values returned by this method are: - * @li @c "cartesian" - * @li @c "invalid GeometryKind value" - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -char * -Geometry_getCoordinateSystemAsString(const Geometry_t * g); - - -/** - * Predicate returning @c 1 (true) if this Geometry_t's "id" attribute is set. - * - * @param g the Geometry_t structure. - * - * @return @c 1 (true) if this Geometry_t's "id" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_isSetId(const Geometry_t * g); - - -/** - * Predicate returning @c 1 (true) if this Geometry_t's "coordinateSystem" - * attribute is set. - * - * @param g the Geometry_t structure. - * - * @return @c 1 (true) if this Geometry_t's "coordinateSystem" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @copydetails doc_geometry_coordinateSystem - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_isSetCoordinateSystem(const Geometry_t * g); - - -/** - * Sets the value of the "id" attribute of this Geometry_t. - * - * @param g the Geometry_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling Geometry_unsetId(). - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_setId(Geometry_t * g, const char * id); - - -/** - * Sets the value of the "coordinateSystem" attribute of this Geometry_t. - * - * @param g the Geometry_t structure. - * - * @param coordinateSystem GeometryKind_t value of the "coordinateSystem" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_geometry_coordinateSystem - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_setCoordinateSystem(Geometry_t * g, GeometryKind_t coordinateSystem); - - -/** - * Sets the value of the "coordinateSystem" attribute of this Geometry_t. - * - * @param g the Geometry_t structure. - * - * @param coordinateSystem const char * of the "coordinateSystem" attribute to - * be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_geometry_coordinateSystem - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_setCoordinateSystemAsString(Geometry_t * g, - const char * coordinateSystem); - - -/** - * Unsets the value of the "id" attribute of this Geometry_t. - * - * @param g the Geometry_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_unsetId(Geometry_t * g); - - -/** - * Unsets the value of the "coordinateSystem" attribute of this Geometry_t. - * - * @param g the Geometry_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_geometry_coordinateSystem - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_unsetCoordinateSystem(Geometry_t * g); - - -/** - * Returns a ListOf_t * containing CoordinateComponent_t objects from this - * Geometry_t. - * - * @param g the Geometry_t structure whose ListOfCoordinateComponents is - * sought. - * - * @return the ListOfCoordinateComponents from this Geometry_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Geometry_addCoordinateComponent() - * @see Geometry_createCoordinateComponent() - * @see Geometry_getCoordinateComponentById() - * @see Geometry_getCoordinateComponent() - * @see Geometry_getNumCoordinateComponents() - * @see Geometry_removeCoordinateComponentById() - * @see Geometry_removeCoordinateComponent() - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfCoordinateComponents(Geometry_t* g); - - -/** - * Get a CoordinateComponent_t from the Geometry_t. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the CoordinateComponent_t - * to retrieve. - * - * @return the nth CoordinateComponent_t in the ListOfCoordinateComponents - * within this Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_getCoordinateComponent(Geometry_t* g, unsigned int n); - - -/** - * Get a CoordinateComponent_t from the Geometry_t based on its identifier. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the CoordinateComponent_t - * to retrieve. - * - * @return the CoordinateComponent_t in the ListOfCoordinateComponents within - * this Geometry with the given @p sid or @c NULL if no such - * CoordinateComponent_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_getCoordinateComponentById(Geometry_t* g, const char *sid); - - -/** - * Adds a copy of the given CoordinateComponent_t to this Geometry_t. - * - * @param g the Geometry_t structure to which the CoordinateComponent_t should - * be added. - * - * @param cc the CoordinateComponent_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_addCoordinateComponent(Geometry_t* g, - const CoordinateComponent_t* cc); - - -/** - * Get the number of CoordinateComponent_t objects in this Geometry_t. - * - * @param g the Geometry_t structure to query. - * - * @return the number of CoordinateComponent_t objects in this Geometry_t. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumCoordinateComponents(Geometry_t* g); - - -/** - * Creates a new CoordinateComponent_t object, adds it to this Geometry_t - * object and returns the CoordinateComponent_t object created. - * - * @param g the Geometry_t structure to which the CoordinateComponent_t should - * be added. - * - * @return a new CoordinateComponent_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_createCoordinateComponent(Geometry_t* g); - - -/** - * Removes the nth CoordinateComponent_t from this Geometry_t and returns a - * pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the CoordinateComponent_t - * to remove. - * - * @return a pointer to the nth CoordinateComponent_t in this Geometry_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_removeCoordinateComponent(Geometry_t* g, unsigned int n); - - -/** - * Removes the CoordinateComponent_t from this Geometry_t based on its - * identifier and returns a pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the CoordinateComponent_t - * to remove. - * - * @return the CoordinateComponent_t in this Geometry_t based on the identifier - * or NULL if no such CoordinateComponent_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -CoordinateComponent_t* -Geometry_removeCoordinateComponentById(Geometry_t* g, const char* sid); - - -/** - * Returns a ListOf_t * containing DomainType_t objects from this Geometry_t. - * - * @param g the Geometry_t structure whose ListOfDomainTypes is sought. - * - * @return the ListOfDomainTypes from this Geometry_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Geometry_addDomainType() - * @see Geometry_createDomainType() - * @see Geometry_getDomainTypeById() - * @see Geometry_getDomainType() - * @see Geometry_getNumDomainTypes() - * @see Geometry_removeDomainTypeById() - * @see Geometry_removeDomainType() - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfDomainTypes(Geometry_t* g); - - -/** - * Get a DomainType_t from the Geometry_t. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the DomainType_t to - * retrieve. - * - * @return the nth DomainType_t in the ListOfDomainTypes within this Geometry - * or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_getDomainType(Geometry_t* g, unsigned int n); - - -/** - * Get a DomainType_t from the Geometry_t based on its identifier. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the DomainType_t to - * retrieve. - * - * @return the DomainType_t in the ListOfDomainTypes within this Geometry with - * the given @p sid or @c NULL if no such DomainType_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_getDomainTypeById(Geometry_t* g, const char *sid); - - -/** - * Adds a copy of the given DomainType_t to this Geometry_t. - * - * @param g the Geometry_t structure to which the DomainType_t should be added. - * - * @param dt the DomainType_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_addDomainType(Geometry_t* g, const DomainType_t* dt); - - -/** - * Get the number of DomainType_t objects in this Geometry_t. - * - * @param g the Geometry_t structure to query. - * - * @return the number of DomainType_t objects in this Geometry_t. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumDomainTypes(Geometry_t* g); - - -/** - * Creates a new DomainType_t object, adds it to this Geometry_t object and - * returns the DomainType_t object created. - * - * @param g the Geometry_t structure to which the DomainType_t should be added. - * - * @return a new DomainType_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_createDomainType(Geometry_t* g); - - -/** - * Removes the nth DomainType_t from this Geometry_t and returns a pointer to - * it. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the DomainType_t to - * remove. - * - * @return a pointer to the nth DomainType_t in this Geometry_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_removeDomainType(Geometry_t* g, unsigned int n); - - -/** - * Removes the DomainType_t from this Geometry_t based on its identifier and - * returns a pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the DomainType_t to - * remove. - * - * @return the DomainType_t in this Geometry_t based on the identifier or NULL - * if no such DomainType_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -DomainType_t* -Geometry_removeDomainTypeById(Geometry_t* g, const char* sid); - - -/** - * Returns a ListOf_t * containing Domain_t objects from this Geometry_t. - * - * @param g the Geometry_t structure whose ListOfDomains is sought. - * - * @return the ListOfDomains from this Geometry_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Geometry_addDomain() - * @see Geometry_createDomain() - * @see Geometry_getDomainById() - * @see Geometry_getDomain() - * @see Geometry_getNumDomains() - * @see Geometry_removeDomainById() - * @see Geometry_removeDomain() - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfDomains(Geometry_t* g); - - -/** - * Get a Domain_t from the Geometry_t. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the Domain_t to retrieve. - * - * @return the nth Domain_t in the ListOfDomains within this Geometry or - * @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Domain_t* -Geometry_getDomain(Geometry_t* g, unsigned int n); - - -/** - * Get a Domain_t from the Geometry_t based on its identifier. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the Domain_t to retrieve. - * - * @return the Domain_t in the ListOfDomains within this Geometry with the - * given @p sid or @c NULL if no such Domain_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Domain_t* -Geometry_getDomainById(Geometry_t* g, const char *sid); - - -/** - * Get a Domain_t from the Geometry_t based on the DomainType to which it - * refers. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the "domainType" attribute of the Domain_t - * object to retrieve. - * - * @return the first Domain_t in this Geometry_t based on the given domainType - * attribute or NULL if no such Domain_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Domain_t* -Geometry_getDomainByDomainType(Geometry_t* g, const char *sid); - - -/** - * Adds a copy of the given Domain_t to this Geometry_t. - * - * @param g the Geometry_t structure to which the Domain_t should be added. - * - * @param d the Domain_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_addDomain(Geometry_t* g, const Domain_t* d); - - -/** - * Get the number of Domain_t objects in this Geometry_t. - * - * @param g the Geometry_t structure to query. - * - * @return the number of Domain_t objects in this Geometry_t. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumDomains(Geometry_t* g); - - -/** - * Creates a new Domain_t object, adds it to this Geometry_t object and returns - * the Domain_t object created. - * - * @param g the Geometry_t structure to which the Domain_t should be added. - * - * @return a new Domain_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Domain_t* -Geometry_createDomain(Geometry_t* g); - - -/** - * Removes the nth Domain_t from this Geometry_t and returns a pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the Domain_t to remove. - * - * @return a pointer to the nth Domain_t in this Geometry_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Domain_t* -Geometry_removeDomain(Geometry_t* g, unsigned int n); - - -/** - * Removes the Domain_t from this Geometry_t based on its identifier and - * returns a pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the Domain_t to remove. - * - * @return the Domain_t in this Geometry_t based on the identifier or NULL if - * no such Domain_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -Domain_t* -Geometry_removeDomainById(Geometry_t* g, const char* sid); - - -/** - * Returns a ListOf_t * containing AdjacentDomains_t objects from this - * Geometry_t. - * - * @param g the Geometry_t structure whose ListOfAdjacentDomains is sought. - * - * @return the ListOfAdjacentDomains from this Geometry_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Geometry_addAdjacentDomains() - * @see Geometry_createAdjacentDomains() - * @see Geometry_getAdjacentDomainsById() - * @see Geometry_getAdjacentDomains() - * @see Geometry_getNumAdjacentDomains() - * @see Geometry_removeAdjacentDomainsById() - * @see Geometry_removeAdjacentDomains() - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfAdjacentDomains(Geometry_t* g); - - -/** - * Get an AdjacentDomains_t from the Geometry_t. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the AdjacentDomains_t to - * retrieve. - * - * @return the nth AdjacentDomains_t in the ListOfAdjacentDomains within this - * Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomains(Geometry_t* g, unsigned int n); - - -/** - * Get an AdjacentDomains_t from the Geometry_t based on its identifier. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the AdjacentDomains_t to - * retrieve. - * - * @return the AdjacentDomains_t in the ListOfAdjacentDomains within this - * Geometry with the given @p sid or @c NULL if no such AdjacentDomains_t - * exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomainsById(Geometry_t* g, const char *sid); - - -/** - * Get an AdjacentDomains_t from the Geometry_t based on the Domain1 to which - * it refers. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the "domain1" attribute of the - * AdjacentDomains_t object to retrieve. - * - * @return the first AdjacentDomains_t in this Geometry_t based on the given - * domain1 attribute or NULL if no such AdjacentDomains_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomainsByDomain1(Geometry_t* g, const char *sid); - - -/** - * Get an AdjacentDomains_t from the Geometry_t based on the Domain2 to which - * it refers. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the "domain2" attribute of the - * AdjacentDomains_t object to retrieve. - * - * @return the first AdjacentDomains_t in this Geometry_t based on the given - * domain2 attribute or NULL if no such AdjacentDomains_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_getAdjacentDomainsByDomain2(Geometry_t* g, const char *sid); - - -/** - * Adds a copy of the given AdjacentDomains_t to this Geometry_t. - * - * @param g the Geometry_t structure to which the AdjacentDomains_t should be - * added. - * - * @param ad the AdjacentDomains_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_addAdjacentDomains(Geometry_t* g, const AdjacentDomains_t* ad); - - -/** - * Get the number of AdjacentDomains_t objects in this Geometry_t. - * - * @param g the Geometry_t structure to query. - * - * @return the number of AdjacentDomains_t objects in this Geometry_t. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumAdjacentDomains(Geometry_t* g); - - -/** - * Creates a new AdjacentDomains_t object, adds it to this Geometry_t object - * and returns the AdjacentDomains_t object created. - * - * @param g the Geometry_t structure to which the AdjacentDomains_t should be - * added. - * - * @return a new AdjacentDomains_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_createAdjacentDomains(Geometry_t* g); - - -/** - * Removes the nth AdjacentDomains_t from this Geometry_t and returns a pointer - * to it. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the AdjacentDomains_t to - * remove. - * - * @return a pointer to the nth AdjacentDomains_t in this Geometry_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_removeAdjacentDomains(Geometry_t* g, unsigned int n); - - -/** - * Removes the AdjacentDomains_t from this Geometry_t based on its identifier - * and returns a pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the AdjacentDomains_t to - * remove. - * - * @return the AdjacentDomains_t in this Geometry_t based on the identifier or - * NULL if no such AdjacentDomains_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AdjacentDomains_t* -Geometry_removeAdjacentDomainsById(Geometry_t* g, const char* sid); - - -/** - * Returns a ListOf_t * containing GeometryDefinition_t objects from this - * Geometry_t. - * - * @param g the Geometry_t structure whose ListOfGeometryDefinitions is sought. - * - * @return the ListOfGeometryDefinitions from this Geometry_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Geometry_addGeometryDefinition() - * @see Geometry_createGeometryDefinition() - * @see Geometry_getGeometryDefinitionById() - * @see Geometry_getGeometryDefinition() - * @see Geometry_getNumGeometryDefinitions() - * @see Geometry_removeGeometryDefinitionById() - * @see Geometry_removeGeometryDefinition() - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfGeometryDefinitions(Geometry_t* g); - - -/** - * Get a GeometryDefinition_t from the Geometry_t. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the GeometryDefinition_t - * to retrieve. - * - * @return the nth GeometryDefinition_t in the ListOfGeometryDefinitions within - * this Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_getGeometryDefinition(Geometry_t* g, unsigned int n); - - -/** - * Get a GeometryDefinition_t from the Geometry_t based on its identifier. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the GeometryDefinition_t - * to retrieve. - * - * @return the GeometryDefinition_t in the ListOfGeometryDefinitions within - * this Geometry with the given @p sid or @c NULL if no such - * GeometryDefinition_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_getGeometryDefinitionById(Geometry_t* g, const char *sid); - - -/** - * Adds a copy of the given GeometryDefinition_t to this Geometry_t. - * - * @param g the Geometry_t structure to which the GeometryDefinition_t should - * be added. - * - * @param gd the GeometryDefinition_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_addGeometryDefinition(Geometry_t* g, const GeometryDefinition_t* gd); - - -/** - * Get the number of GeometryDefinition_t objects in this Geometry_t. - * - * @param g the Geometry_t structure to query. - * - * @return the number of GeometryDefinition_t objects in this Geometry_t. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumGeometryDefinitions(Geometry_t* g); - - -/** - * Creates a new AnalyticGeometry_t object, adds it to this Geometry_t object - * and returns the AnalyticGeometry_t object created. - * - * @param g the Geometry_t structure to which the AnalyticGeometry_t should be - * added. - * - * @return a new AnalyticGeometry_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -AnalyticGeometry_t* -Geometry_createAnalyticGeometry(Geometry_t* g); - - -/** - * Creates a new SampledFieldGeometry_t object, adds it to this Geometry_t - * object and returns the SampledFieldGeometry_t object created. - * - * @param g the Geometry_t structure to which the SampledFieldGeometry_t should - * be added. - * - * @return a new SampledFieldGeometry_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -SampledFieldGeometry_t* -Geometry_createSampledFieldGeometry(Geometry_t* g); - - -/** - * Creates a new CSGeometry_t object, adds it to this Geometry_t object and - * returns the CSGeometry_t object created. - * - * @param g the Geometry_t structure to which the CSGeometry_t should be added. - * - * @return a new CSGeometry_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -CSGeometry_t* -Geometry_createCSGeometry(Geometry_t* g); - - -/** - * Creates a new ParametricGeometry_t object, adds it to this Geometry_t object - * and returns the ParametricGeometry_t object created. - * - * @param g the Geometry_t structure to which the ParametricGeometry_t should - * be added. - * - * @return a new ParametricGeometry_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -ParametricGeometry_t* -Geometry_createParametricGeometry(Geometry_t* g); - - -/** - * Creates a new MixedGeometry_t object, adds it to this Geometry_t object and - * returns the MixedGeometry_t object created. - * - * @param g the Geometry_t structure to which the MixedGeometry_t should be - * added. - * - * @return a new MixedGeometry_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -MixedGeometry_t* -Geometry_createMixedGeometry(Geometry_t* g); - - -/** - * Removes the nth GeometryDefinition_t from this Geometry_t and returns a - * pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the GeometryDefinition_t - * to remove. - * - * @return a pointer to the nth GeometryDefinition_t in this Geometry_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_removeGeometryDefinition(Geometry_t* g, unsigned int n); - - -/** - * Removes the GeometryDefinition_t from this Geometry_t based on its - * identifier and returns a pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the GeometryDefinition_t - * to remove. - * - * @return the GeometryDefinition_t in this Geometry_t based on the identifier - * or NULL if no such GeometryDefinition_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -GeometryDefinition_t* -Geometry_removeGeometryDefinitionById(Geometry_t* g, const char* sid); - - -/** - * Returns a ListOf_t * containing SampledField_t objects from this Geometry_t. - * - * @param g the Geometry_t structure whose ListOfSampledFields is sought. - * - * @return the ListOfSampledFields from this Geometry_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Geometry_addSampledField() - * @see Geometry_createSampledField() - * @see Geometry_getSampledFieldById() - * @see Geometry_getSampledField() - * @see Geometry_getNumSampledFields() - * @see Geometry_removeSampledFieldById() - * @see Geometry_removeSampledField() - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -ListOf_t* -Geometry_getListOfSampledFields(Geometry_t* g); - - -/** - * Get a SampledField_t from the Geometry_t. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the SampledField_t to - * retrieve. - * - * @return the nth SampledField_t in the ListOfSampledFields within this - * Geometry or @c NULL if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_getSampledField(Geometry_t* g, unsigned int n); - - -/** - * Get a SampledField_t from the Geometry_t based on its identifier. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the SampledField_t to - * retrieve. - * - * @return the SampledField_t in the ListOfSampledFields within this Geometry - * with the given @p sid or @c NULL if no such SampledField_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_getSampledFieldById(Geometry_t* g, const char *sid); - - -/** - * Adds a copy of the given SampledField_t to this Geometry_t. - * - * @param g the Geometry_t structure to which the SampledField_t should be - * added. - * - * @param sf the SampledField_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_addSampledField(Geometry_t* g, const SampledField_t* sf); - - -/** - * Get the number of SampledField_t objects in this Geometry_t. - * - * @param g the Geometry_t structure to query. - * - * @return the number of SampledField_t objects in this Geometry_t. - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -unsigned int -Geometry_getNumSampledFields(Geometry_t* g); - - -/** - * Creates a new SampledField_t object, adds it to this Geometry_t object and - * returns the SampledField_t object created. - * - * @param g the Geometry_t structure to which the SampledField_t should be - * added. - * - * @return a new SampledField_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_createSampledField(Geometry_t* g); - - -/** - * Removes the nth SampledField_t from this Geometry_t and returns a pointer to - * it. - * - * @param g the Geometry_t structure to search. - * - * @param n an unsigned int representing the index of the SampledField_t to - * remove. - * - * @return a pointer to the nth SampledField_t in this Geometry_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_removeSampledField(Geometry_t* g, unsigned int n); - - -/** - * Removes the SampledField_t from this Geometry_t based on its identifier and - * returns a pointer to it. - * - * @param g the Geometry_t structure to search. - * - * @param sid a string representing the identifier of the SampledField_t to - * remove. - * - * @return the SampledField_t in this Geometry_t based on the identifier or - * NULL if no such SampledField_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -SampledField_t* -Geometry_removeSampledFieldById(Geometry_t* g, const char* sid); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Geometry_t object have been set. - * - * @param g the Geometry_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Geometry_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the Geometry_t object are: - * @li "coordinateSystem" - * - * @memberof Geometry_t - */ -LIBSBML_EXTERN -int -Geometry_hasRequiredAttributes(const Geometry_t * g); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Geometry_H__ */ - - +/** + * @file Geometry.h + * @brief Definition of the Geometry class. + * @author SBMLTeam + * + * + * + * @class Geometry + * @sbmlbrief{spatial} TODO:Definition of the Geometry class. + */ + +/** + * + * + * + * @class doc_geometry_coordinateSystem + * + * @par + * The attribute "coordinateSystem" on a Geometry object is used to TODO:add + * explanation + * + * In the SBML + * Level 3 Version 1 Spatial specification, the following are the + * allowable values for "coordinateSystem": + *
    + *
  • @c "cartesian", TODO:add description + * + *
+ */ + + +#ifndef Geometry_H__ +#define Geometry_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include +#include +#include +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Geometry : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + GeometryKind_t mCoordinateSystem; + ListOfCoordinateComponents mCoordinateComponents; + ListOfDomainTypes mDomainTypes; + ListOfDomains mDomains; + ListOfAdjacentDomains mAdjacentDomains; + ListOfGeometryDefinitions mGeometryDefinitions; + ListOfSampledFields mSampledFields; + + /** @endcond */ + +public: + + /** + * Creates a new Geometry using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Geometry. + * + * @param version an unsigned int, the SBML Version to assign to this + * Geometry. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this Geometry. + * + * @copydetails doc_note_setting_lv_pkg + */ + Geometry(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Geometry using the given SpatialPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Geometry(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for Geometry. + * + * @param orig the Geometry instance to copy. + */ + Geometry(const Geometry& orig); + + + /** + * Assignment operator for Geometry. + * + * @param rhs the Geometry object whose values are to be used as the basis of + * the assignment. + */ + Geometry& operator=(const Geometry& rhs); + + + /** + * Creates and returns a deep copy of this Geometry object. + * + * @return a (deep) copy of this Geometry object. + */ + virtual Geometry* clone() const; + + + /** + * Destructor for Geometry. + */ + virtual ~Geometry(); + + + /** + * Returns the value of the "id" attribute of this Geometry. + * + * @return the value of the "id" attribute of this Geometry as a string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "coordinateSystem" attribute of this Geometry. + * + * @return the value of the "coordinateSystem" attribute of this Geometry as + * a GeometryKind_t. + * + * @copydetails doc_geometry_coordinateSystem + * @if clike The value is drawn from the enumeration @ref GeometryKind_t + * @endif + * The possible values returned by this method are: + * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_CARTESIAN, GeometryKind_t} + * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_INVALID, GeometryKind_t} + */ + GeometryKind_t getCoordinateSystem() const; + + + /** + * Returns the value of the "coordinateSystem" attribute of this Geometry. + * + * @return the value of the "coordinateSystem" attribute of this Geometry as + * a string. + * + * @copydetails doc_geometry_coordinateSystem + * The possible values returned by this method are: + * @li @c "cartesian" + * @li @c "invalid GeometryKind value" + */ + std::string getCoordinateSystemAsString() const; + + + /** + * Predicate returning @c true if this Geometry's "id" attribute is set. + * + * @return @c true if this Geometry's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this Geometry's "coordinateSystem" + * attribute is set. + * + * @return @c true if this Geometry's "coordinateSystem" attribute has been + * set, otherwise @c false is returned. + * + * @copydetails doc_geometry_coordinateSystem + */ + bool isSetCoordinateSystem() const; + + + /** + * Sets the value of the "id" attribute of this Geometry. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "coordinateSystem" attribute of this Geometry. + * + * @param coordinateSystem @if clike GeometryKind_t@else int@endif value of + * the "coordinateSystem" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_geometry_coordinateSystem + */ + int setCoordinateSystem(const GeometryKind_t coordinateSystem); + + + /** + * Sets the value of the "coordinateSystem" attribute of this Geometry. + * + * @param coordinateSystem std::string& of the "coordinateSystem" attribute + * to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_geometry_coordinateSystem + */ + int setCoordinateSystem(const std::string& coordinateSystem); + + + /** + * Unsets the value of the "id" attribute of this Geometry. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "coordinateSystem" attribute of this Geometry. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_geometry_coordinateSystem + */ + int unsetCoordinateSystem(); + + + /** + * Returns the ListOfCoordinateComponents from this Geometry. + * + * @return the ListOfCoordinateComponents from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + const ListOfCoordinateComponents* getListOfCoordinateComponents() const; + + + /** + * Returns the ListOfCoordinateComponents from this Geometry. + * + * @return the ListOfCoordinateComponents from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + ListOfCoordinateComponents* getListOfCoordinateComponents(); + + + /** + * Get a CoordinateComponent from the Geometry. + * + * @param n an unsigned int representing the index of the CoordinateComponent + * to retrieve. + * + * @return the nth CoordinateComponent in the ListOfCoordinateComponents + * within this Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + CoordinateComponent* getCoordinateComponent(unsigned int n); + + + /** + * Get a CoordinateComponent from the Geometry. + * + * @param n an unsigned int representing the index of the CoordinateComponent + * to retrieve. + * + * @return the nth CoordinateComponent in the ListOfCoordinateComponents + * within this Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + const CoordinateComponent* getCoordinateComponent(unsigned int n) const; + + + /** + * Get a CoordinateComponent from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the CoordinateComponent + * to retrieve. + * + * @return the CoordinateComponent in the ListOfCoordinateComponents within + * this Geometry with the given @p sid or @c NULL if no such + * CoordinateComponent exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + CoordinateComponent* getCoordinateComponent(const std::string& sid); + + + /** + * Get a CoordinateComponent from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the CoordinateComponent + * to retrieve. + * + * @return the CoordinateComponent in the ListOfCoordinateComponents within + * this Geometry with the given @p sid or @c NULL if no such + * CoordinateComponent exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + const CoordinateComponent* getCoordinateComponent(const std::string& sid) + const; + + + /** + * Adds a copy of the given CoordinateComponent to this Geometry. + * + * @param cc the CoordinateComponent object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + int addCoordinateComponent(const CoordinateComponent* cc); + + + /** + * Get the number of CoordinateComponent objects in this Geometry. + * + * @return the number of CoordinateComponent objects in this Geometry. + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getCoordinateComponent(unsigned int n) + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + unsigned int getNumCoordinateComponents() const; + + + /** + * Creates a new CoordinateComponent object, adds it to this Geometry object + * and returns the CoordinateComponent object created. + * + * @return a new CoordinateComponent object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see getCoordinateComponent(const std::string& sid) + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + * @see removeCoordinateComponent(unsigned int n) + */ + CoordinateComponent* createCoordinateComponent(); + + + /** + * Removes the nth CoordinateComponent from this Geometry and returns a + * pointer to it. + * + * @param n an unsigned int representing the index of the CoordinateComponent + * to remove. + * + * @return a pointer to the nth CoordinateComponent in this Geometry. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(const std::string& sid) + */ + CoordinateComponent* removeCoordinateComponent(unsigned int n); + + + /** + * Removes the CoordinateComponent from this Geometry based on its identifier + * and returns a pointer to it. + * + * @param sid a string representing the identifier of the CoordinateComponent + * to remove. + * + * @return the CoordinateComponent in this Geometry based on the identifier + * or NULL if no such CoordinateComponent exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addCoordinateComponent(const CoordinateComponent* object) + * @see createCoordinateComponent() + * @see getCoordinateComponent(const std::string& sid) + * @see getCoordinateComponent(unsigned int n) + * @see getNumCoordinateComponents() + * @see removeCoordinateComponent(unsigned int n) + */ + CoordinateComponent* removeCoordinateComponent(const std::string& sid); + + + /** + * Returns the ListOfDomainTypes from this Geometry. + * + * @return the ListOfDomainTypes from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + const ListOfDomainTypes* getListOfDomainTypes() const; + + + /** + * Returns the ListOfDomainTypes from this Geometry. + * + * @return the ListOfDomainTypes from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + ListOfDomainTypes* getListOfDomainTypes(); + + + /** + * Get a DomainType from the Geometry. + * + * @param n an unsigned int representing the index of the DomainType to + * retrieve. + * + * @return the nth DomainType in the ListOfDomainTypes within this Geometry + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + DomainType* getDomainType(unsigned int n); + + + /** + * Get a DomainType from the Geometry. + * + * @param n an unsigned int representing the index of the DomainType to + * retrieve. + * + * @return the nth DomainType in the ListOfDomainTypes within this Geometry + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + const DomainType* getDomainType(unsigned int n) const; + + + /** + * Get a DomainType from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the DomainType to + * retrieve. + * + * @return the DomainType in the ListOfDomainTypes within this Geometry with + * the given @p sid or @c NULL if no such DomainType exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + DomainType* getDomainType(const std::string& sid); + + + /** + * Get a DomainType from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the DomainType to + * retrieve. + * + * @return the DomainType in the ListOfDomainTypes within this Geometry with + * the given @p sid or @c NULL if no such DomainType exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + const DomainType* getDomainType(const std::string& sid) const; + + + /** + * Adds a copy of the given DomainType to this Geometry. + * + * @param dt the DomainType object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + int addDomainType(const DomainType* dt); + + + /** + * Get the number of DomainType objects in this Geometry. + * + * @return the number of DomainType objects in this Geometry. + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getDomainType(unsigned int n) + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + unsigned int getNumDomainTypes() const; + + + /** + * Creates a new DomainType object, adds it to this Geometry object and + * returns the DomainType object created. + * + * @return a new DomainType object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomainType(const DomainType* object) + * @see getDomainType(const std::string& sid) + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + * @see removeDomainType(unsigned int n) + */ + DomainType* createDomainType(); + + + /** + * Removes the nth DomainType from this Geometry and returns a pointer to it. + * + * @param n an unsigned int representing the index of the DomainType to + * remove. + * + * @return a pointer to the nth DomainType in this Geometry. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(const std::string& sid) + */ + DomainType* removeDomainType(unsigned int n); + + + /** + * Removes the DomainType from this Geometry based on its identifier and + * returns a pointer to it. + * + * @param sid a string representing the identifier of the DomainType to + * remove. + * + * @return the DomainType in this Geometry based on the identifier or NULL if + * no such DomainType exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addDomainType(const DomainType* object) + * @see createDomainType() + * @see getDomainType(const std::string& sid) + * @see getDomainType(unsigned int n) + * @see getNumDomainTypes() + * @see removeDomainType(unsigned int n) + */ + DomainType* removeDomainType(const std::string& sid); + + + /** + * Returns the ListOfDomains from this Geometry. + * + * @return the ListOfDomains from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + const ListOfDomains* getListOfDomains() const; + + + /** + * Returns the ListOfDomains from this Geometry. + * + * @return the ListOfDomains from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + ListOfDomains* getListOfDomains(); + + + /** + * Get a Domain from the Geometry. + * + * @param n an unsigned int representing the index of the Domain to retrieve. + * + * @return the nth Domain in the ListOfDomains within this Geometry or + * @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + Domain* getDomain(unsigned int n); + + + /** + * Get a Domain from the Geometry. + * + * @param n an unsigned int representing the index of the Domain to retrieve. + * + * @return the nth Domain in the ListOfDomains within this Geometry or + * @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + const Domain* getDomain(unsigned int n) const; + + + /** + * Get a Domain from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the Domain to retrieve. + * + * @return the Domain in the ListOfDomains within this Geometry with the + * given @p sid or @c NULL if no such Domain exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + Domain* getDomain(const std::string& sid); + + + /** + * Get a Domain from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the Domain to retrieve. + * + * @return the Domain in the ListOfDomains within this Geometry with the + * given @p sid or @c NULL if no such Domain exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + const Domain* getDomain(const std::string& sid) const; + + + /** + * Get a Domain from the Geometry based on the DomainType to which it refers. + * + * @param sid a string representing the "domainType" attribute of the Domain + * object to retrieve. + * + * @return the first Domain in this Geometry based on the given domainType + * attribute or NULL if no such Domain exists. + * + * @copydetails doc_returned_unowned_pointer + */ + const Domain* getDomainByDomainType(const std::string& sid) const; + + + /** + * Get a Domain from the Geometry based on the DomainType to which it refers. + * + * @param sid a string representing the "domainType" attribute of the Domain + * object to retrieve. + * + * @return the first Domain in this Geometry based on the given domainType + * attribute or NULL if no such Domain exists. + * + * @copydetails doc_returned_unowned_pointer + */ + Domain* getDomainByDomainType(const std::string& sid); + + + /** + * Adds a copy of the given Domain to this Geometry. + * + * @param d the Domain object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + int addDomain(const Domain* d); + + + /** + * Get the number of Domain objects in this Geometry. + * + * @return the number of Domain objects in this Geometry. + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getDomain(unsigned int n) + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + unsigned int getNumDomains() const; + + + /** + * Creates a new Domain object, adds it to this Geometry object and returns + * the Domain object created. + * + * @return a new Domain object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addDomain(const Domain* object) + * @see getDomain(const std::string& sid) + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + * @see removeDomain(unsigned int n) + */ + Domain* createDomain(); + + + /** + * Removes the nth Domain from this Geometry and returns a pointer to it. + * + * @param n an unsigned int representing the index of the Domain to remove. + * + * @return a pointer to the nth Domain in this Geometry. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(const std::string& sid) + */ + Domain* removeDomain(unsigned int n); + + + /** + * Removes the Domain from this Geometry based on its identifier and returns + * a pointer to it. + * + * @param sid a string representing the identifier of the Domain to remove. + * + * @return the Domain in this Geometry based on the identifier or NULL if no + * such Domain exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addDomain(const Domain* object) + * @see createDomain() + * @see getDomain(const std::string& sid) + * @see getDomain(unsigned int n) + * @see getNumDomains() + * @see removeDomain(unsigned int n) + */ + Domain* removeDomain(const std::string& sid); + + + /** + * Returns the ListOfAdjacentDomains from this Geometry. + * + * @return the ListOfAdjacentDomains from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + const ListOfAdjacentDomains* getListOfAdjacentDomains() const; + + + /** + * Returns the ListOfAdjacentDomains from this Geometry. + * + * @return the ListOfAdjacentDomains from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + ListOfAdjacentDomains* getListOfAdjacentDomains(); + + + /** + * Get an AdjacentDomains from the Geometry. + * + * @param n an unsigned int representing the index of the AdjacentDomains to + * retrieve. + * + * @return the nth AdjacentDomains in the ListOfAdjacentDomains within this + * Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + AdjacentDomains* getAdjacentDomains(unsigned int n); + + + /** + * Get an AdjacentDomains from the Geometry. + * + * @param n an unsigned int representing the index of the AdjacentDomains to + * retrieve. + * + * @return the nth AdjacentDomains in the ListOfAdjacentDomains within this + * Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + const AdjacentDomains* getAdjacentDomains(unsigned int n) const; + + + /** + * Get an AdjacentDomains from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the AdjacentDomains to + * retrieve. + * + * @return the AdjacentDomains in the ListOfAdjacentDomains within this + * Geometry with the given @p sid or @c NULL if no such AdjacentDomains + * exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + AdjacentDomains* getAdjacentDomains(const std::string& sid); + + + /** + * Get an AdjacentDomains from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the AdjacentDomains to + * retrieve. + * + * @return the AdjacentDomains in the ListOfAdjacentDomains within this + * Geometry with the given @p sid or @c NULL if no such AdjacentDomains + * exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + const AdjacentDomains* getAdjacentDomains(const std::string& sid) const; + + + /** + * Get an AdjacentDomains from the Geometry based on the Domain1 to which it + * refers. + * + * @param sid a string representing the "domain1" attribute of the + * AdjacentDomains object to retrieve. + * + * @return the first AdjacentDomains in this Geometry based on the given + * domain1 attribute or NULL if no such AdjacentDomains exists. + * + * @copydetails doc_returned_unowned_pointer + */ + const AdjacentDomains* getAdjacentDomainsByDomain1(const std::string& sid) + const; + + + /** + * Get an AdjacentDomains from the Geometry based on the Domain1 to which it + * refers. + * + * @param sid a string representing the "domain1" attribute of the + * AdjacentDomains object to retrieve. + * + * @return the first AdjacentDomains in this Geometry based on the given + * domain1 attribute or NULL if no such AdjacentDomains exists. + * + * @copydetails doc_returned_unowned_pointer + */ + AdjacentDomains* getAdjacentDomainsByDomain1(const std::string& sid); + + + /** + * Get an AdjacentDomains from the Geometry based on the Domain2 to which it + * refers. + * + * @param sid a string representing the "domain2" attribute of the + * AdjacentDomains object to retrieve. + * + * @return the first AdjacentDomains in this Geometry based on the given + * domain2 attribute or NULL if no such AdjacentDomains exists. + * + * @copydetails doc_returned_unowned_pointer + */ + const AdjacentDomains* getAdjacentDomainsByDomain2(const std::string& sid) + const; + + + /** + * Get an AdjacentDomains from the Geometry based on the Domain2 to which it + * refers. + * + * @param sid a string representing the "domain2" attribute of the + * AdjacentDomains object to retrieve. + * + * @return the first AdjacentDomains in this Geometry based on the given + * domain2 attribute or NULL if no such AdjacentDomains exists. + * + * @copydetails doc_returned_unowned_pointer + */ + AdjacentDomains* getAdjacentDomainsByDomain2(const std::string& sid); + + + /** + * Adds a copy of the given AdjacentDomains to this Geometry. + * + * @param ad the AdjacentDomains object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + int addAdjacentDomains(const AdjacentDomains* ad); + + + /** + * Get the number of AdjacentDomains objects in this Geometry. + * + * @return the number of AdjacentDomains objects in this Geometry. + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getAdjacentDomains(unsigned int n) + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + unsigned int getNumAdjacentDomains() const; + + + /** + * Creates a new AdjacentDomains object, adds it to this Geometry object and + * returns the AdjacentDomains object created. + * + * @return a new AdjacentDomains object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see getAdjacentDomains(const std::string& sid) + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + * @see removeAdjacentDomains(unsigned int n) + */ + AdjacentDomains* createAdjacentDomains(); + + + /** + * Removes the nth AdjacentDomains from this Geometry and returns a pointer + * to it. + * + * @param n an unsigned int representing the index of the AdjacentDomains to + * remove. + * + * @return a pointer to the nth AdjacentDomains in this Geometry. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(const std::string& sid) + */ + AdjacentDomains* removeAdjacentDomains(unsigned int n); + + + /** + * Removes the AdjacentDomains from this Geometry based on its identifier and + * returns a pointer to it. + * + * @param sid a string representing the identifier of the AdjacentDomains to + * remove. + * + * @return the AdjacentDomains in this Geometry based on the identifier or + * NULL if no such AdjacentDomains exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addAdjacentDomains(const AdjacentDomains* object) + * @see createAdjacentDomains() + * @see getAdjacentDomains(const std::string& sid) + * @see getAdjacentDomains(unsigned int n) + * @see getNumAdjacentDomains() + * @see removeAdjacentDomains(unsigned int n) + */ + AdjacentDomains* removeAdjacentDomains(const std::string& sid); + + + /** + * Returns the ListOfGeometryDefinitions from this Geometry. + * + * @return the ListOfGeometryDefinitions from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + const ListOfGeometryDefinitions* getListOfGeometryDefinitions() const; + + + /** + * Returns the ListOfGeometryDefinitions from this Geometry. + * + * @return the ListOfGeometryDefinitions from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + ListOfGeometryDefinitions* getListOfGeometryDefinitions(); + + + /** + * Get a GeometryDefinition from the Geometry. + * + * @param n an unsigned int representing the index of the GeometryDefinition + * to retrieve. + * + * @return the nth GeometryDefinition in the ListOfGeometryDefinitions within + * this Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + GeometryDefinition* getGeometryDefinition(unsigned int n); + + + /** + * Get a GeometryDefinition from the Geometry. + * + * @param n an unsigned int representing the index of the GeometryDefinition + * to retrieve. + * + * @return the nth GeometryDefinition in the ListOfGeometryDefinitions within + * this Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + const GeometryDefinition* getGeometryDefinition(unsigned int n) const; + + + /** + * Get a GeometryDefinition from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the GeometryDefinition + * to retrieve. + * + * @return the GeometryDefinition in the ListOfGeometryDefinitions within + * this Geometry with the given @p sid or @c NULL if no such + * GeometryDefinition exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + GeometryDefinition* getGeometryDefinition(const std::string& sid); + + + /** + * Get a GeometryDefinition from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the GeometryDefinition + * to retrieve. + * + * @return the GeometryDefinition in the ListOfGeometryDefinitions within + * this Geometry with the given @p sid or @c NULL if no such + * GeometryDefinition exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + const GeometryDefinition* getGeometryDefinition(const std::string& sid) + const; + + + /** + * Adds a copy of the given GeometryDefinition to this Geometry. + * + * @param gd the GeometryDefinition object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + int addGeometryDefinition(const GeometryDefinition* gd); + + + /** + * Get the number of GeometryDefinition objects in this Geometry. + * + * @return the number of GeometryDefinition objects in this Geometry. + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + unsigned int getNumGeometryDefinitions() const; + + + /** + * Creates a new AnalyticGeometry object, adds it to this Geometry object and + * returns the AnalyticGeometry object created. + * + * @return a new AnalyticGeometry object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + AnalyticGeometry* createAnalyticGeometry(); + + + /** + * Creates a new SampledFieldGeometry object, adds it to this Geometry object + * and returns the SampledFieldGeometry object created. + * + * @return a new SampledFieldGeometry object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + SampledFieldGeometry* createSampledFieldGeometry(); + + + /** + * Creates a new CSGeometry object, adds it to this Geometry object and + * returns the CSGeometry object created. + * + * @return a new CSGeometry object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + CSGeometry* createCSGeometry(); + + + /** + * Creates a new ParametricGeometry object, adds it to this Geometry object + * and returns the ParametricGeometry object created. + * + * @return a new ParametricGeometry object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + ParametricGeometry* createParametricGeometry(); + + + /** + * Creates a new MixedGeometry object, adds it to this Geometry object and + * returns the MixedGeometry object created. + * + * @return a new MixedGeometry object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + * @see removeGeometryDefinition(unsigned int n) + */ + MixedGeometry* createMixedGeometry(); + + + /** + * Removes the nth GeometryDefinition from this Geometry and returns a + * pointer to it. + * + * @param n an unsigned int representing the index of the GeometryDefinition + * to remove. + * + * @return a pointer to the nth GeometryDefinition in this Geometry. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(const std::string& sid) + */ + GeometryDefinition* removeGeometryDefinition(unsigned int n); + + + /** + * Removes the GeometryDefinition from this Geometry based on its identifier + * and returns a pointer to it. + * + * @param sid a string representing the identifier of the GeometryDefinition + * to remove. + * + * @return the GeometryDefinition in this Geometry based on the identifier or + * NULL if no such GeometryDefinition exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addGeometryDefinition(const GeometryDefinition* object) + * @see createGeometryDefinition() + * @see getGeometryDefinition(const std::string& sid) + * @see getGeometryDefinition(unsigned int n) + * @see getNumGeometryDefinitions() + * @see removeGeometryDefinition(unsigned int n) + */ + GeometryDefinition* removeGeometryDefinition(const std::string& sid); + + + /** + * Returns the ListOfSampledFields from this Geometry. + * + * @return the ListOfSampledFields from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + const ListOfSampledFields* getListOfSampledFields() const; + + + /** + * Returns the ListOfSampledFields from this Geometry. + * + * @return the ListOfSampledFields from this Geometry. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + ListOfSampledFields* getListOfSampledFields(); + + + /** + * Get a SampledField from the Geometry. + * + * @param n an unsigned int representing the index of the SampledField to + * retrieve. + * + * @return the nth SampledField in the ListOfSampledFields within this + * Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + SampledField* getSampledField(unsigned int n); + + + /** + * Get a SampledField from the Geometry. + * + * @param n an unsigned int representing the index of the SampledField to + * retrieve. + * + * @return the nth SampledField in the ListOfSampledFields within this + * Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + const SampledField* getSampledField(unsigned int n) const; + + + /** + * Get a SampledField from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the SampledField to + * retrieve. + * + * @return the SampledField in the ListOfSampledFields within this Geometry + * with the given @p sid or @c NULL if no such SampledField exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + SampledField* getSampledField(const std::string& sid); + + + /** + * Get a SampledField from the Geometry based on its identifier. + * + * @param sid a string representing the identifier of the SampledField to + * retrieve. + * + * @return the SampledField in the ListOfSampledFields within this Geometry + * with the given @p sid or @c NULL if no such SampledField exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + const SampledField* getSampledField(const std::string& sid) const; + + + /** + * Adds a copy of the given SampledField to this Geometry. + * + * @param sf the SampledField object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + int addSampledField(const SampledField* sf); + + + /** + * Get the number of SampledField objects in this Geometry. + * + * @return the number of SampledField objects in this Geometry. + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getSampledField(unsigned int n) + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + unsigned int getNumSampledFields() const; + + + /** + * Creates a new SampledField object, adds it to this Geometry object and + * returns the SampledField object created. + * + * @return a new SampledField object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addSampledField(const SampledField* object) + * @see getSampledField(const std::string& sid) + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + * @see removeSampledField(unsigned int n) + */ + SampledField* createSampledField(); + + + /** + * Removes the nth SampledField from this Geometry and returns a pointer to + * it. + * + * @param n an unsigned int representing the index of the SampledField to + * remove. + * + * @return a pointer to the nth SampledField in this Geometry. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(const std::string& sid) + */ + SampledField* removeSampledField(unsigned int n); + + + /** + * Removes the SampledField from this Geometry based on its identifier and + * returns a pointer to it. + * + * @param sid a string representing the identifier of the SampledField to + * remove. + * + * @return the SampledField in this Geometry based on the identifier or NULL + * if no such SampledField exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addSampledField(const SampledField* object) + * @see createSampledField() + * @see getSampledField(const std::string& sid) + * @see getSampledField(unsigned int n) + * @see getNumSampledFields() + * @see removeSampledField(unsigned int n) + */ + SampledField* removeSampledField(const std::string& sid); + + + /** + * Returns the XML element name of this Geometry object. + * + * For Geometry, the XML element name is always @c "geometry". + * + * @return the name of this element, i.e. @c "geometry". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Geometry object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_GEOMETRY, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * Geometry object have been set. + * + * @return @c true to indicate that all the required attributes of this + * Geometry have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the Geometry object are: + * @li "coordinateSystem" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Geometry's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Geometry's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Geometry. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this Geometry. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this Geometry. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * Geometry. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this Geometry. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this Geometry. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Geometry_t using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Geometry_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * Geometry_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this Geometry_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Geometry_t * +Geometry_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Geometry_t object. + * + * @param g the Geometry_t structure. + * + * @return a (deep) copy of this Geometry_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Geometry_t* +Geometry_clone(const Geometry_t* g); + + +/** + * Frees this Geometry_t object. + * + * @param g the Geometry_t structure. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +void +Geometry_free(Geometry_t* g); + + +/** + * Returns the value of the "id" attribute of this Geometry_t. + * + * @param g the Geometry_t structure whose id is sought. + * + * @return the value of the "id" attribute of this Geometry_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +char * +Geometry_getId(const Geometry_t * g); + + +/** + * Returns the value of the "coordinateSystem" attribute of this Geometry_t. + * + * @param g the Geometry_t structure whose coordinateSystem is sought. + * + * @return the value of the "coordinateSystem" attribute of this Geometry_t as + * a GeometryKind_t. + * + * @copydetails doc_geometry_coordinateSystem + * @if clike The value is drawn from the enumeration @ref GeometryKind_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_CARTESIAN, GeometryKind_t} + * @li @sbmlconstant{SPATIAL_GEOMETRYKIND_INVALID, GeometryKind_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +GeometryKind_t +Geometry_getCoordinateSystem(const Geometry_t * g); + + +/** + * Returns the value of the "coordinateSystem" attribute of this Geometry_t. + * + * @param g the Geometry_t structure whose coordinateSystem is sought. + * + * @return the value of the "coordinateSystem" attribute of this Geometry_t as + * a const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_geometry_coordinateSystem + * The possible values returned by this method are: + * @li @c "cartesian" + * @li @c "invalid GeometryKind value" + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +char * +Geometry_getCoordinateSystemAsString(const Geometry_t * g); + + +/** + * Predicate returning @c 1 (true) if this Geometry_t's "id" attribute is set. + * + * @param g the Geometry_t structure. + * + * @return @c 1 (true) if this Geometry_t's "id" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_isSetId(const Geometry_t * g); + + +/** + * Predicate returning @c 1 (true) if this Geometry_t's "coordinateSystem" + * attribute is set. + * + * @param g the Geometry_t structure. + * + * @return @c 1 (true) if this Geometry_t's "coordinateSystem" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @copydetails doc_geometry_coordinateSystem + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_isSetCoordinateSystem(const Geometry_t * g); + + +/** + * Sets the value of the "id" attribute of this Geometry_t. + * + * @param g the Geometry_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling Geometry_unsetId(). + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_setId(Geometry_t * g, const char * id); + + +/** + * Sets the value of the "coordinateSystem" attribute of this Geometry_t. + * + * @param g the Geometry_t structure. + * + * @param coordinateSystem GeometryKind_t value of the "coordinateSystem" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_geometry_coordinateSystem + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_setCoordinateSystem(Geometry_t * g, GeometryKind_t coordinateSystem); + + +/** + * Sets the value of the "coordinateSystem" attribute of this Geometry_t. + * + * @param g the Geometry_t structure. + * + * @param coordinateSystem const char * of the "coordinateSystem" attribute to + * be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_geometry_coordinateSystem + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_setCoordinateSystemAsString(Geometry_t * g, + const char * coordinateSystem); + + +/** + * Unsets the value of the "id" attribute of this Geometry_t. + * + * @param g the Geometry_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_unsetId(Geometry_t * g); + + +/** + * Unsets the value of the "coordinateSystem" attribute of this Geometry_t. + * + * @param g the Geometry_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_geometry_coordinateSystem + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_unsetCoordinateSystem(Geometry_t * g); + + +/** + * Returns a ListOf_t * containing CoordinateComponent_t objects from this + * Geometry_t. + * + * @param g the Geometry_t structure whose ListOfCoordinateComponents is + * sought. + * + * @return the ListOfCoordinateComponents from this Geometry_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Geometry_addCoordinateComponent() + * @see Geometry_createCoordinateComponent() + * @see Geometry_getCoordinateComponentById() + * @see Geometry_getCoordinateComponent() + * @see Geometry_getNumCoordinateComponents() + * @see Geometry_removeCoordinateComponentById() + * @see Geometry_removeCoordinateComponent() + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfCoordinateComponents(Geometry_t* g); + + +/** + * Get a CoordinateComponent_t from the Geometry_t. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the CoordinateComponent_t + * to retrieve. + * + * @return the nth CoordinateComponent_t in the ListOfCoordinateComponents + * within this Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_getCoordinateComponent(Geometry_t* g, unsigned int n); + + +/** + * Get a CoordinateComponent_t from the Geometry_t based on its identifier. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the CoordinateComponent_t + * to retrieve. + * + * @return the CoordinateComponent_t in the ListOfCoordinateComponents within + * this Geometry with the given @p sid or @c NULL if no such + * CoordinateComponent_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_getCoordinateComponentById(Geometry_t* g, const char *sid); + + +/** + * Adds a copy of the given CoordinateComponent_t to this Geometry_t. + * + * @param g the Geometry_t structure to which the CoordinateComponent_t should + * be added. + * + * @param cc the CoordinateComponent_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_addCoordinateComponent(Geometry_t* g, + const CoordinateComponent_t* cc); + + +/** + * Get the number of CoordinateComponent_t objects in this Geometry_t. + * + * @param g the Geometry_t structure to query. + * + * @return the number of CoordinateComponent_t objects in this Geometry_t. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumCoordinateComponents(Geometry_t* g); + + +/** + * Creates a new CoordinateComponent_t object, adds it to this Geometry_t + * object and returns the CoordinateComponent_t object created. + * + * @param g the Geometry_t structure to which the CoordinateComponent_t should + * be added. + * + * @return a new CoordinateComponent_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_createCoordinateComponent(Geometry_t* g); + + +/** + * Removes the nth CoordinateComponent_t from this Geometry_t and returns a + * pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the CoordinateComponent_t + * to remove. + * + * @return a pointer to the nth CoordinateComponent_t in this Geometry_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_removeCoordinateComponent(Geometry_t* g, unsigned int n); + + +/** + * Removes the CoordinateComponent_t from this Geometry_t based on its + * identifier and returns a pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the CoordinateComponent_t + * to remove. + * + * @return the CoordinateComponent_t in this Geometry_t based on the identifier + * or NULL if no such CoordinateComponent_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +CoordinateComponent_t* +Geometry_removeCoordinateComponentById(Geometry_t* g, const char* sid); + + +/** + * Returns a ListOf_t * containing DomainType_t objects from this Geometry_t. + * + * @param g the Geometry_t structure whose ListOfDomainTypes is sought. + * + * @return the ListOfDomainTypes from this Geometry_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Geometry_addDomainType() + * @see Geometry_createDomainType() + * @see Geometry_getDomainTypeById() + * @see Geometry_getDomainType() + * @see Geometry_getNumDomainTypes() + * @see Geometry_removeDomainTypeById() + * @see Geometry_removeDomainType() + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfDomainTypes(Geometry_t* g); + + +/** + * Get a DomainType_t from the Geometry_t. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the DomainType_t to + * retrieve. + * + * @return the nth DomainType_t in the ListOfDomainTypes within this Geometry + * or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_getDomainType(Geometry_t* g, unsigned int n); + + +/** + * Get a DomainType_t from the Geometry_t based on its identifier. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the DomainType_t to + * retrieve. + * + * @return the DomainType_t in the ListOfDomainTypes within this Geometry with + * the given @p sid or @c NULL if no such DomainType_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_getDomainTypeById(Geometry_t* g, const char *sid); + + +/** + * Adds a copy of the given DomainType_t to this Geometry_t. + * + * @param g the Geometry_t structure to which the DomainType_t should be added. + * + * @param dt the DomainType_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_addDomainType(Geometry_t* g, const DomainType_t* dt); + + +/** + * Get the number of DomainType_t objects in this Geometry_t. + * + * @param g the Geometry_t structure to query. + * + * @return the number of DomainType_t objects in this Geometry_t. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumDomainTypes(Geometry_t* g); + + +/** + * Creates a new DomainType_t object, adds it to this Geometry_t object and + * returns the DomainType_t object created. + * + * @param g the Geometry_t structure to which the DomainType_t should be added. + * + * @return a new DomainType_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_createDomainType(Geometry_t* g); + + +/** + * Removes the nth DomainType_t from this Geometry_t and returns a pointer to + * it. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the DomainType_t to + * remove. + * + * @return a pointer to the nth DomainType_t in this Geometry_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_removeDomainType(Geometry_t* g, unsigned int n); + + +/** + * Removes the DomainType_t from this Geometry_t based on its identifier and + * returns a pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the DomainType_t to + * remove. + * + * @return the DomainType_t in this Geometry_t based on the identifier or NULL + * if no such DomainType_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +DomainType_t* +Geometry_removeDomainTypeById(Geometry_t* g, const char* sid); + + +/** + * Returns a ListOf_t * containing Domain_t objects from this Geometry_t. + * + * @param g the Geometry_t structure whose ListOfDomains is sought. + * + * @return the ListOfDomains from this Geometry_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Geometry_addDomain() + * @see Geometry_createDomain() + * @see Geometry_getDomainById() + * @see Geometry_getDomain() + * @see Geometry_getNumDomains() + * @see Geometry_removeDomainById() + * @see Geometry_removeDomain() + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfDomains(Geometry_t* g); + + +/** + * Get a Domain_t from the Geometry_t. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the Domain_t to retrieve. + * + * @return the nth Domain_t in the ListOfDomains within this Geometry or + * @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Domain_t* +Geometry_getDomain(Geometry_t* g, unsigned int n); + + +/** + * Get a Domain_t from the Geometry_t based on its identifier. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the Domain_t to retrieve. + * + * @return the Domain_t in the ListOfDomains within this Geometry with the + * given @p sid or @c NULL if no such Domain_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Domain_t* +Geometry_getDomainById(Geometry_t* g, const char *sid); + + +/** + * Get a Domain_t from the Geometry_t based on the DomainType to which it + * refers. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the "domainType" attribute of the Domain_t + * object to retrieve. + * + * @return the first Domain_t in this Geometry_t based on the given domainType + * attribute or NULL if no such Domain_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Domain_t* +Geometry_getDomainByDomainType(Geometry_t* g, const char *sid); + + +/** + * Adds a copy of the given Domain_t to this Geometry_t. + * + * @param g the Geometry_t structure to which the Domain_t should be added. + * + * @param d the Domain_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_addDomain(Geometry_t* g, const Domain_t* d); + + +/** + * Get the number of Domain_t objects in this Geometry_t. + * + * @param g the Geometry_t structure to query. + * + * @return the number of Domain_t objects in this Geometry_t. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumDomains(Geometry_t* g); + + +/** + * Creates a new Domain_t object, adds it to this Geometry_t object and returns + * the Domain_t object created. + * + * @param g the Geometry_t structure to which the Domain_t should be added. + * + * @return a new Domain_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Domain_t* +Geometry_createDomain(Geometry_t* g); + + +/** + * Removes the nth Domain_t from this Geometry_t and returns a pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the Domain_t to remove. + * + * @return a pointer to the nth Domain_t in this Geometry_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Domain_t* +Geometry_removeDomain(Geometry_t* g, unsigned int n); + + +/** + * Removes the Domain_t from this Geometry_t based on its identifier and + * returns a pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the Domain_t to remove. + * + * @return the Domain_t in this Geometry_t based on the identifier or NULL if + * no such Domain_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +Domain_t* +Geometry_removeDomainById(Geometry_t* g, const char* sid); + + +/** + * Returns a ListOf_t * containing AdjacentDomains_t objects from this + * Geometry_t. + * + * @param g the Geometry_t structure whose ListOfAdjacentDomains is sought. + * + * @return the ListOfAdjacentDomains from this Geometry_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Geometry_addAdjacentDomains() + * @see Geometry_createAdjacentDomains() + * @see Geometry_getAdjacentDomainsById() + * @see Geometry_getAdjacentDomains() + * @see Geometry_getNumAdjacentDomains() + * @see Geometry_removeAdjacentDomainsById() + * @see Geometry_removeAdjacentDomains() + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfAdjacentDomains(Geometry_t* g); + + +/** + * Get an AdjacentDomains_t from the Geometry_t. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the AdjacentDomains_t to + * retrieve. + * + * @return the nth AdjacentDomains_t in the ListOfAdjacentDomains within this + * Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomains(Geometry_t* g, unsigned int n); + + +/** + * Get an AdjacentDomains_t from the Geometry_t based on its identifier. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the AdjacentDomains_t to + * retrieve. + * + * @return the AdjacentDomains_t in the ListOfAdjacentDomains within this + * Geometry with the given @p sid or @c NULL if no such AdjacentDomains_t + * exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomainsById(Geometry_t* g, const char *sid); + + +/** + * Get an AdjacentDomains_t from the Geometry_t based on the Domain1 to which + * it refers. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the "domain1" attribute of the + * AdjacentDomains_t object to retrieve. + * + * @return the first AdjacentDomains_t in this Geometry_t based on the given + * domain1 attribute or NULL if no such AdjacentDomains_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomainsByDomain1(Geometry_t* g, const char *sid); + + +/** + * Get an AdjacentDomains_t from the Geometry_t based on the Domain2 to which + * it refers. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the "domain2" attribute of the + * AdjacentDomains_t object to retrieve. + * + * @return the first AdjacentDomains_t in this Geometry_t based on the given + * domain2 attribute or NULL if no such AdjacentDomains_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_getAdjacentDomainsByDomain2(Geometry_t* g, const char *sid); + + +/** + * Adds a copy of the given AdjacentDomains_t to this Geometry_t. + * + * @param g the Geometry_t structure to which the AdjacentDomains_t should be + * added. + * + * @param ad the AdjacentDomains_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_addAdjacentDomains(Geometry_t* g, const AdjacentDomains_t* ad); + + +/** + * Get the number of AdjacentDomains_t objects in this Geometry_t. + * + * @param g the Geometry_t structure to query. + * + * @return the number of AdjacentDomains_t objects in this Geometry_t. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumAdjacentDomains(Geometry_t* g); + + +/** + * Creates a new AdjacentDomains_t object, adds it to this Geometry_t object + * and returns the AdjacentDomains_t object created. + * + * @param g the Geometry_t structure to which the AdjacentDomains_t should be + * added. + * + * @return a new AdjacentDomains_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_createAdjacentDomains(Geometry_t* g); + + +/** + * Removes the nth AdjacentDomains_t from this Geometry_t and returns a pointer + * to it. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the AdjacentDomains_t to + * remove. + * + * @return a pointer to the nth AdjacentDomains_t in this Geometry_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_removeAdjacentDomains(Geometry_t* g, unsigned int n); + + +/** + * Removes the AdjacentDomains_t from this Geometry_t based on its identifier + * and returns a pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the AdjacentDomains_t to + * remove. + * + * @return the AdjacentDomains_t in this Geometry_t based on the identifier or + * NULL if no such AdjacentDomains_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AdjacentDomains_t* +Geometry_removeAdjacentDomainsById(Geometry_t* g, const char* sid); + + +/** + * Returns a ListOf_t * containing GeometryDefinition_t objects from this + * Geometry_t. + * + * @param g the Geometry_t structure whose ListOfGeometryDefinitions is sought. + * + * @return the ListOfGeometryDefinitions from this Geometry_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Geometry_addGeometryDefinition() + * @see Geometry_createGeometryDefinition() + * @see Geometry_getGeometryDefinitionById() + * @see Geometry_getGeometryDefinition() + * @see Geometry_getNumGeometryDefinitions() + * @see Geometry_removeGeometryDefinitionById() + * @see Geometry_removeGeometryDefinition() + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfGeometryDefinitions(Geometry_t* g); + + +/** + * Get a GeometryDefinition_t from the Geometry_t. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the GeometryDefinition_t + * to retrieve. + * + * @return the nth GeometryDefinition_t in the ListOfGeometryDefinitions within + * this Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_getGeometryDefinition(Geometry_t* g, unsigned int n); + + +/** + * Get a GeometryDefinition_t from the Geometry_t based on its identifier. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the GeometryDefinition_t + * to retrieve. + * + * @return the GeometryDefinition_t in the ListOfGeometryDefinitions within + * this Geometry with the given @p sid or @c NULL if no such + * GeometryDefinition_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_getGeometryDefinitionById(Geometry_t* g, const char *sid); + + +/** + * Adds a copy of the given GeometryDefinition_t to this Geometry_t. + * + * @param g the Geometry_t structure to which the GeometryDefinition_t should + * be added. + * + * @param gd the GeometryDefinition_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_addGeometryDefinition(Geometry_t* g, const GeometryDefinition_t* gd); + + +/** + * Get the number of GeometryDefinition_t objects in this Geometry_t. + * + * @param g the Geometry_t structure to query. + * + * @return the number of GeometryDefinition_t objects in this Geometry_t. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumGeometryDefinitions(Geometry_t* g); + + +/** + * Creates a new AnalyticGeometry_t object, adds it to this Geometry_t object + * and returns the AnalyticGeometry_t object created. + * + * @param g the Geometry_t structure to which the AnalyticGeometry_t should be + * added. + * + * @return a new AnalyticGeometry_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +AnalyticGeometry_t* +Geometry_createAnalyticGeometry(Geometry_t* g); + + +/** + * Creates a new SampledFieldGeometry_t object, adds it to this Geometry_t + * object and returns the SampledFieldGeometry_t object created. + * + * @param g the Geometry_t structure to which the SampledFieldGeometry_t should + * be added. + * + * @return a new SampledFieldGeometry_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +SampledFieldGeometry_t* +Geometry_createSampledFieldGeometry(Geometry_t* g); + + +/** + * Creates a new CSGeometry_t object, adds it to this Geometry_t object and + * returns the CSGeometry_t object created. + * + * @param g the Geometry_t structure to which the CSGeometry_t should be added. + * + * @return a new CSGeometry_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +CSGeometry_t* +Geometry_createCSGeometry(Geometry_t* g); + + +/** + * Creates a new ParametricGeometry_t object, adds it to this Geometry_t object + * and returns the ParametricGeometry_t object created. + * + * @param g the Geometry_t structure to which the ParametricGeometry_t should + * be added. + * + * @return a new ParametricGeometry_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +ParametricGeometry_t* +Geometry_createParametricGeometry(Geometry_t* g); + + +/** + * Creates a new MixedGeometry_t object, adds it to this Geometry_t object and + * returns the MixedGeometry_t object created. + * + * @param g the Geometry_t structure to which the MixedGeometry_t should be + * added. + * + * @return a new MixedGeometry_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +MixedGeometry_t* +Geometry_createMixedGeometry(Geometry_t* g); + + +/** + * Removes the nth GeometryDefinition_t from this Geometry_t and returns a + * pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the GeometryDefinition_t + * to remove. + * + * @return a pointer to the nth GeometryDefinition_t in this Geometry_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_removeGeometryDefinition(Geometry_t* g, unsigned int n); + + +/** + * Removes the GeometryDefinition_t from this Geometry_t based on its + * identifier and returns a pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the GeometryDefinition_t + * to remove. + * + * @return the GeometryDefinition_t in this Geometry_t based on the identifier + * or NULL if no such GeometryDefinition_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +GeometryDefinition_t* +Geometry_removeGeometryDefinitionById(Geometry_t* g, const char* sid); + + +/** + * Returns a ListOf_t * containing SampledField_t objects from this Geometry_t. + * + * @param g the Geometry_t structure whose ListOfSampledFields is sought. + * + * @return the ListOfSampledFields from this Geometry_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Geometry_addSampledField() + * @see Geometry_createSampledField() + * @see Geometry_getSampledFieldById() + * @see Geometry_getSampledField() + * @see Geometry_getNumSampledFields() + * @see Geometry_removeSampledFieldById() + * @see Geometry_removeSampledField() + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +ListOf_t* +Geometry_getListOfSampledFields(Geometry_t* g); + + +/** + * Get a SampledField_t from the Geometry_t. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the SampledField_t to + * retrieve. + * + * @return the nth SampledField_t in the ListOfSampledFields within this + * Geometry or @c NULL if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_getSampledField(Geometry_t* g, unsigned int n); + + +/** + * Get a SampledField_t from the Geometry_t based on its identifier. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the SampledField_t to + * retrieve. + * + * @return the SampledField_t in the ListOfSampledFields within this Geometry + * with the given @p sid or @c NULL if no such SampledField_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_getSampledFieldById(Geometry_t* g, const char *sid); + + +/** + * Adds a copy of the given SampledField_t to this Geometry_t. + * + * @param g the Geometry_t structure to which the SampledField_t should be + * added. + * + * @param sf the SampledField_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_addSampledField(Geometry_t* g, const SampledField_t* sf); + + +/** + * Get the number of SampledField_t objects in this Geometry_t. + * + * @param g the Geometry_t structure to query. + * + * @return the number of SampledField_t objects in this Geometry_t. + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +unsigned int +Geometry_getNumSampledFields(Geometry_t* g); + + +/** + * Creates a new SampledField_t object, adds it to this Geometry_t object and + * returns the SampledField_t object created. + * + * @param g the Geometry_t structure to which the SampledField_t should be + * added. + * + * @return a new SampledField_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_createSampledField(Geometry_t* g); + + +/** + * Removes the nth SampledField_t from this Geometry_t and returns a pointer to + * it. + * + * @param g the Geometry_t structure to search. + * + * @param n an unsigned int representing the index of the SampledField_t to + * remove. + * + * @return a pointer to the nth SampledField_t in this Geometry_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_removeSampledField(Geometry_t* g, unsigned int n); + + +/** + * Removes the SampledField_t from this Geometry_t based on its identifier and + * returns a pointer to it. + * + * @param g the Geometry_t structure to search. + * + * @param sid a string representing the identifier of the SampledField_t to + * remove. + * + * @return the SampledField_t in this Geometry_t based on the identifier or + * NULL if no such SampledField_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +SampledField_t* +Geometry_removeSampledFieldById(Geometry_t* g, const char* sid); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Geometry_t object have been set. + * + * @param g the Geometry_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Geometry_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the Geometry_t object are: + * @li "coordinateSystem" + * + * @memberof Geometry_t + */ +LIBSBML_EXTERN +int +Geometry_hasRequiredAttributes(const Geometry_t * g); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Geometry_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/GeometryDefinition.cpp b/generator/tests/test_cpp_code/test-code/GeometryDefinition.cpp index 73374402..6a86d6d2 100644 --- a/generator/tests/test_cpp_code/test-code/GeometryDefinition.cpp +++ b/generator/tests/test_cpp_code/test-code/GeometryDefinition.cpp @@ -1,1140 +1,1140 @@ -/** - * @file GeometryDefinition.cpp - * @brief Implementation of the GeometryDefinition class. - * @author SBMLTeam - * - * - */ -#include -#include -#include - -#include -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new GeometryDefinition using the given SBML Level, Version and - * “spatial” package version. - */ -GeometryDefinition::GeometryDefinition(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mIsActive (false) - , mIsSetIsActive (false) - , mElementName("geometryDefinition") -{ - setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, - pkgVersion)); -} - - -/* - * Creates a new GeometryDefinition using the given SpatialPkgNamespaces - * object. - */ -GeometryDefinition::GeometryDefinition(SpatialPkgNamespaces *spatialns) - : SBase(spatialns) - , mIsActive (false) - , mIsSetIsActive (false) - , mElementName("geometryDefinition") -{ - setElementNamespace(spatialns->getURI()); - loadPlugins(spatialns); -} - - -/* - * Copy constructor for GeometryDefinition. - */ -GeometryDefinition::GeometryDefinition(const GeometryDefinition& orig) - : SBase( orig ) - , mIsActive ( orig.mIsActive ) - , mIsSetIsActive ( orig.mIsSetIsActive ) - , mElementName ( orig.mElementName ) -{ -} - - -/* - * Assignment operator for GeometryDefinition. - */ -GeometryDefinition& -GeometryDefinition::operator=(const GeometryDefinition& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mIsActive = rhs.mIsActive; - mIsSetIsActive = rhs.mIsSetIsActive; - mElementName = rhs.mElementName; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this GeometryDefinition object. - */ -GeometryDefinition* -GeometryDefinition::clone() const -{ - return new GeometryDefinition(*this); -} - - -/* - * Destructor for GeometryDefinition. - */ -GeometryDefinition::~GeometryDefinition() -{ -} - - -/* - * Returns the value of the "id" attribute of this GeometryDefinition. - */ -const std::string& -GeometryDefinition::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "isActive" attribute of this GeometryDefinition. - */ -bool -GeometryDefinition::getIsActive() const -{ - return mIsActive; -} - - -/* - * Predicate returning @c true if this GeometryDefinition's "id" attribute is - * set. - */ -bool -GeometryDefinition::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this GeometryDefinition's "isActive" - * attribute is set. - */ -bool -GeometryDefinition::isSetIsActive() const -{ - return mIsSetIsActive; -} - - -/* - * Sets the value of the "id" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "isActive" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::setIsActive(bool isActive) -{ - mIsActive = isActive; - mIsSetIsActive = true; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "isActive" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::unsetIsActive() -{ - mIsActive = false; - mIsSetIsActive = false; - - if (isSetIsActive() == false) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Predicate returning @c true if this abstract "GeometryDefinition" is of type - * AnalyticGeometry - */ -bool -GeometryDefinition::isAnalyticGeometry() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "GeometryDefinition" is of type - * SampledFieldGeometry - */ -bool -GeometryDefinition::isSampledFieldGeometry() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "GeometryDefinition" is of type - * CSGeometry - */ -bool -GeometryDefinition::isCSGeometry() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "GeometryDefinition" is of type - * ParametricGeometry - */ -bool -GeometryDefinition::isParametricGeometry() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "GeometryDefinition" is of type - * MixedGeometry - */ -bool -GeometryDefinition::isMixedGeometry() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Returns the XML element name of this GeometryDefinition object. - */ -const std::string& -GeometryDefinition::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this GeometryDefinition object. - */ -void -GeometryDefinition::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this GeometryDefinition object. - */ -int -GeometryDefinition::getTypeCode() const -{ - return SBML_SPATIAL_GEOMETRYDEFINITION; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * GeometryDefinition object have been set. - */ -bool -GeometryDefinition::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetId() == false) - { - allPresent = false; - } - - if (isSetIsActive() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -GeometryDefinition::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -GeometryDefinition::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -GeometryDefinition::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -GeometryDefinition::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "isActive") - { - value = getIsActive(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this GeometryDefinition's attribute - * "attributeName" is set. - */ -bool -GeometryDefinition::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "isActive") - { - value = isSetIsActive(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "isActive") - { - return_value = setIsActive(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GeometryDefinition. - */ -int -GeometryDefinition::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * GeometryDefinition. - */ -int -GeometryDefinition::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "isActive") - { - value = unsetIsActive(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -GeometryDefinition::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("isActive"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -GeometryDefinition::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialGeometryLOGeometryDefinitionsAllowedAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialGeometryLOGeometryDefinitionsAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("spatial", - SpatialGeometryDefinitionAllowedAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("spatial", - SpatialGeometryDefinitionAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "required" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - else - { - if (log) - { - std::string message = "Spatial attribute 'id' is missing from the " - " element."; - log->logPackageError("spatial", - SpatialGeometryDefinitionAllowedAttributes, pkgVersion, level, version, - message, getLine(), getColumn()); - } - } - - // - // isActive bool (use = "required" ) - // - - numErrs = log ? log->getNumErrors() : 0; - mIsSetIsActive = attributes.readInto("isActive", mIsActive); - - if (mIsSetIsActive == false) - { - if (log && log->getNumErrors() == numErrs + 1 && - log->contains(XMLAttributeTypeMismatch)) - { - log->remove(XMLAttributeTypeMismatch); - log->logPackageError("spatial", - SpatialGeometryDefinitionIsActiveMustBeBoolean, pkgVersion, level, - version); - } - else - { - std::string message = "Spatial attribute 'isActive' is missing from the " - " element."; - log->logPackageError("spatial", - SpatialGeometryDefinitionAllowedAttributes, pkgVersion, level, version, - message); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -GeometryDefinition::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetIsActive() == true) - { - stream.writeAttribute("isActive", getPrefix(), mIsActive); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new AnalyticGeometry using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -AnalyticGeometry_t * -GeometryDefinition_createAnalyticGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new AnalyticGeometry(level, version, pkgVersion); -} - - -/* - * Creates a new SampledFieldGeometry using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -SampledFieldGeometry_t * -GeometryDefinition_createSampledFieldGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new SampledFieldGeometry(level, version, pkgVersion); -} - - -/* - * Creates a new CSGeometry using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -CSGeometry_t * -GeometryDefinition_createCSGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new CSGeometry(level, version, pkgVersion); -} - - -/* - * Creates a new ParametricGeometry using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -ParametricGeometry_t * -GeometryDefinition_createParametricGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new ParametricGeometry(level, version, pkgVersion); -} - - -/* - * Creates a new MixedGeometry using the given SBML Level, Version and - * “spatial” package version. - */ -LIBSBML_EXTERN -MixedGeometry_t * -GeometryDefinition_createMixedGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new MixedGeometry(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this GeometryDefinition_t object. - */ -LIBSBML_EXTERN -GeometryDefinition_t* -GeometryDefinition_clone(const GeometryDefinition_t* gd) -{ - if (gd != NULL) - { - return static_cast(gd->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this GeometryDefinition_t object. - */ -LIBSBML_EXTERN -void -GeometryDefinition_free(GeometryDefinition_t* gd) -{ - if (gd != NULL) - { - delete gd; - } -} - - -/* - * Returns the value of the "id" attribute of this GeometryDefinition_t. - */ -LIBSBML_EXTERN -char * -GeometryDefinition_getId(const GeometryDefinition_t * gd) -{ - if (gd == NULL) - { - return NULL; - } - - return gd->getId().empty() ? NULL : safe_strdup(gd->getId().c_str()); -} - - -/* - * Returns the value of the "isActive" attribute of this GeometryDefinition_t. - */ -LIBSBML_EXTERN -int -GeometryDefinition_getIsActive(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->getIsActive()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this GeometryDefinition_t's "id" - * attribute is set. - */ -LIBSBML_EXTERN -int -GeometryDefinition_isSetId(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this GeometryDefinition_t's "isActive" - * attribute is set. - */ -LIBSBML_EXTERN -int -GeometryDefinition_isSetIsActive(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->isSetIsActive()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this GeometryDefinition_t. - */ -LIBSBML_EXTERN -int -GeometryDefinition_setId(GeometryDefinition_t * gd, const char * id) -{ - return (gd != NULL) ? gd->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "isActive" attribute of this GeometryDefinition_t. - */ -LIBSBML_EXTERN -int -GeometryDefinition_setIsActive(GeometryDefinition_t * gd, int isActive) -{ - return (gd != NULL) ? gd->setIsActive(isActive) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this GeometryDefinition_t. - */ -LIBSBML_EXTERN -int -GeometryDefinition_unsetId(GeometryDefinition_t * gd) -{ - return (gd != NULL) ? gd->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "isActive" attribute of this GeometryDefinition_t. - */ -LIBSBML_EXTERN -int -GeometryDefinition_unsetIsActive(GeometryDefinition_t * gd) -{ - return (gd != NULL) ? gd->unsetIsActive() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * AnalyticGeometry_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isAnalyticGeometry(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->isAnalyticGeometry()) : 0; -} - - -/* - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * SampledFieldGeometry_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isSampledFieldGeometry(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->isSampledFieldGeometry()) : 0; -} - - -/* - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * CSGeometry_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isCSGeometry(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->isCSGeometry()) : 0; -} - - -/* - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * ParametricGeometry_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isParametricGeometry(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->isParametricGeometry()) : 0; -} - - -/* - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * MixedGeometry_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isMixedGeometry(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->isMixedGeometry()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * GeometryDefinition_t object have been set. - */ -LIBSBML_EXTERN -int -GeometryDefinition_hasRequiredAttributes(const GeometryDefinition_t * gd) -{ - return (gd != NULL) ? static_cast(gd->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file GeometryDefinition.cpp + * @brief Implementation of the GeometryDefinition class. + * @author SBMLTeam + * + * + */ +#include +#include +#include + +#include +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new GeometryDefinition using the given SBML Level, Version and + * “spatial” package version. + */ +GeometryDefinition::GeometryDefinition(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mIsActive (false) + , mIsSetIsActive (false) + , mElementName("geometryDefinition") +{ + setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version, + pkgVersion)); +} + + +/* + * Creates a new GeometryDefinition using the given SpatialPkgNamespaces + * object. + */ +GeometryDefinition::GeometryDefinition(SpatialPkgNamespaces *spatialns) + : SBase(spatialns) + , mIsActive (false) + , mIsSetIsActive (false) + , mElementName("geometryDefinition") +{ + setElementNamespace(spatialns->getURI()); + loadPlugins(spatialns); +} + + +/* + * Copy constructor for GeometryDefinition. + */ +GeometryDefinition::GeometryDefinition(const GeometryDefinition& orig) + : SBase( orig ) + , mIsActive ( orig.mIsActive ) + , mIsSetIsActive ( orig.mIsSetIsActive ) + , mElementName ( orig.mElementName ) +{ +} + + +/* + * Assignment operator for GeometryDefinition. + */ +GeometryDefinition& +GeometryDefinition::operator=(const GeometryDefinition& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mIsActive = rhs.mIsActive; + mIsSetIsActive = rhs.mIsSetIsActive; + mElementName = rhs.mElementName; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this GeometryDefinition object. + */ +GeometryDefinition* +GeometryDefinition::clone() const +{ + return new GeometryDefinition(*this); +} + + +/* + * Destructor for GeometryDefinition. + */ +GeometryDefinition::~GeometryDefinition() +{ +} + + +/* + * Returns the value of the "id" attribute of this GeometryDefinition. + */ +const std::string& +GeometryDefinition::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "isActive" attribute of this GeometryDefinition. + */ +bool +GeometryDefinition::getIsActive() const +{ + return mIsActive; +} + + +/* + * Predicate returning @c true if this GeometryDefinition's "id" attribute is + * set. + */ +bool +GeometryDefinition::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this GeometryDefinition's "isActive" + * attribute is set. + */ +bool +GeometryDefinition::isSetIsActive() const +{ + return mIsSetIsActive; +} + + +/* + * Sets the value of the "id" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "isActive" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::setIsActive(bool isActive) +{ + mIsActive = isActive; + mIsSetIsActive = true; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "id" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "isActive" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::unsetIsActive() +{ + mIsActive = false; + mIsSetIsActive = false; + + if (isSetIsActive() == false) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Predicate returning @c true if this abstract "GeometryDefinition" is of type + * AnalyticGeometry + */ +bool +GeometryDefinition::isAnalyticGeometry() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "GeometryDefinition" is of type + * SampledFieldGeometry + */ +bool +GeometryDefinition::isSampledFieldGeometry() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "GeometryDefinition" is of type + * CSGeometry + */ +bool +GeometryDefinition::isCSGeometry() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "GeometryDefinition" is of type + * ParametricGeometry + */ +bool +GeometryDefinition::isParametricGeometry() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "GeometryDefinition" is of type + * MixedGeometry + */ +bool +GeometryDefinition::isMixedGeometry() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Returns the XML element name of this GeometryDefinition object. + */ +const std::string& +GeometryDefinition::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this GeometryDefinition object. + */ +void +GeometryDefinition::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this GeometryDefinition object. + */ +int +GeometryDefinition::getTypeCode() const +{ + return SBML_SPATIAL_GEOMETRYDEFINITION; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * GeometryDefinition object have been set. + */ +bool +GeometryDefinition::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetId() == false) + { + allPresent = false; + } + + if (isSetIsActive() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +GeometryDefinition::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +GeometryDefinition::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +GeometryDefinition::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +GeometryDefinition::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "isActive") + { + value = getIsActive(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this GeometryDefinition's attribute + * "attributeName" is set. + */ +bool +GeometryDefinition::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "isActive") + { + value = isSetIsActive(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "isActive") + { + return_value = setIsActive(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GeometryDefinition. + */ +int +GeometryDefinition::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * GeometryDefinition. + */ +int +GeometryDefinition::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "isActive") + { + value = unsetIsActive(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +GeometryDefinition::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("isActive"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +GeometryDefinition::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialGeometryLOGeometryDefinitionsAllowedAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialGeometryLOGeometryDefinitionsAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("spatial", + SpatialGeometryDefinitionAllowedAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("spatial", + SpatialGeometryDefinitionAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "required" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("spatial", SpatialIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + else + { + if (log) + { + std::string message = "Spatial attribute 'id' is missing from the " + " element."; + log->logPackageError("spatial", + SpatialGeometryDefinitionAllowedAttributes, pkgVersion, level, version, + message, getLine(), getColumn()); + } + } + + // + // isActive bool (use = "required" ) + // + + numErrs = log ? log->getNumErrors() : 0; + mIsSetIsActive = attributes.readInto("isActive", mIsActive); + + if (mIsSetIsActive == false) + { + if (log && log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logPackageError("spatial", + SpatialGeometryDefinitionIsActiveMustBeBoolean, pkgVersion, level, + version); + } + else + { + std::string message = "Spatial attribute 'isActive' is missing from the " + " element."; + log->logPackageError("spatial", + SpatialGeometryDefinitionAllowedAttributes, pkgVersion, level, version, + message); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +GeometryDefinition::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetIsActive() == true) + { + stream.writeAttribute("isActive", getPrefix(), mIsActive); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new AnalyticGeometry using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +AnalyticGeometry_t * +GeometryDefinition_createAnalyticGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new AnalyticGeometry(level, version, pkgVersion); +} + + +/* + * Creates a new SampledFieldGeometry using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +SampledFieldGeometry_t * +GeometryDefinition_createSampledFieldGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new SampledFieldGeometry(level, version, pkgVersion); +} + + +/* + * Creates a new CSGeometry using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +CSGeometry_t * +GeometryDefinition_createCSGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new CSGeometry(level, version, pkgVersion); +} + + +/* + * Creates a new ParametricGeometry using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +ParametricGeometry_t * +GeometryDefinition_createParametricGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new ParametricGeometry(level, version, pkgVersion); +} + + +/* + * Creates a new MixedGeometry using the given SBML Level, Version and + * “spatial” package version. + */ +LIBSBML_EXTERN +MixedGeometry_t * +GeometryDefinition_createMixedGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new MixedGeometry(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this GeometryDefinition_t object. + */ +LIBSBML_EXTERN +GeometryDefinition_t* +GeometryDefinition_clone(const GeometryDefinition_t* gd) +{ + if (gd != NULL) + { + return static_cast(gd->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this GeometryDefinition_t object. + */ +LIBSBML_EXTERN +void +GeometryDefinition_free(GeometryDefinition_t* gd) +{ + if (gd != NULL) + { + delete gd; + } +} + + +/* + * Returns the value of the "id" attribute of this GeometryDefinition_t. + */ +LIBSBML_EXTERN +char * +GeometryDefinition_getId(const GeometryDefinition_t * gd) +{ + if (gd == NULL) + { + return NULL; + } + + return gd->getId().empty() ? NULL : safe_strdup(gd->getId().c_str()); +} + + +/* + * Returns the value of the "isActive" attribute of this GeometryDefinition_t. + */ +LIBSBML_EXTERN +int +GeometryDefinition_getIsActive(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->getIsActive()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this GeometryDefinition_t's "id" + * attribute is set. + */ +LIBSBML_EXTERN +int +GeometryDefinition_isSetId(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this GeometryDefinition_t's "isActive" + * attribute is set. + */ +LIBSBML_EXTERN +int +GeometryDefinition_isSetIsActive(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->isSetIsActive()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this GeometryDefinition_t. + */ +LIBSBML_EXTERN +int +GeometryDefinition_setId(GeometryDefinition_t * gd, const char * id) +{ + return (gd != NULL) ? gd->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "isActive" attribute of this GeometryDefinition_t. + */ +LIBSBML_EXTERN +int +GeometryDefinition_setIsActive(GeometryDefinition_t * gd, int isActive) +{ + return (gd != NULL) ? gd->setIsActive(isActive) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this GeometryDefinition_t. + */ +LIBSBML_EXTERN +int +GeometryDefinition_unsetId(GeometryDefinition_t * gd) +{ + return (gd != NULL) ? gd->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "isActive" attribute of this GeometryDefinition_t. + */ +LIBSBML_EXTERN +int +GeometryDefinition_unsetIsActive(GeometryDefinition_t * gd) +{ + return (gd != NULL) ? gd->unsetIsActive() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * AnalyticGeometry_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isAnalyticGeometry(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->isAnalyticGeometry()) : 0; +} + + +/* + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * SampledFieldGeometry_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isSampledFieldGeometry(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->isSampledFieldGeometry()) : 0; +} + + +/* + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * CSGeometry_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isCSGeometry(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->isCSGeometry()) : 0; +} + + +/* + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * ParametricGeometry_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isParametricGeometry(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->isParametricGeometry()) : 0; +} + + +/* + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * MixedGeometry_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isMixedGeometry(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->isMixedGeometry()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * GeometryDefinition_t object have been set. + */ +LIBSBML_EXTERN +int +GeometryDefinition_hasRequiredAttributes(const GeometryDefinition_t * gd) +{ + return (gd != NULL) ? static_cast(gd->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/GeometryDefinition.h b/generator/tests/test_cpp_code/test-code/GeometryDefinition.h index 36ea2552..151a209f 100644 --- a/generator/tests/test_cpp_code/test-code/GeometryDefinition.h +++ b/generator/tests/test_cpp_code/test-code/GeometryDefinition.h @@ -1,1117 +1,1117 @@ -/** - * @file GeometryDefinition.h - * @brief Definition of the GeometryDefinition class. - * @author SBMLTeam - * - * - * - * @class GeometryDefinition - * @sbmlbrief{spatial} TODO:Definition of the GeometryDefinition class. - */ - - -#ifndef GeometryDefinition_H__ -#define GeometryDefinition_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class AnalyticGeometry; -class SampledFieldGeometry; -class CSGeometry; -class ParametricGeometry; -class MixedGeometry; - -class LIBSBML_EXTERN GeometryDefinition : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - bool mIsActive; - bool mIsSetIsActive; - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new GeometryDefinition using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GeometryDefinition. - * - * @param version an unsigned int, the SBML Version to assign to this - * GeometryDefinition. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this GeometryDefinition. - * - * @copydetails doc_note_setting_lv_pkg - */ - GeometryDefinition(unsigned int level = SpatialExtension::getDefaultLevel(), - unsigned int version = - SpatialExtension::getDefaultVersion(), - unsigned int pkgVersion = - SpatialExtension::getDefaultPackageVersion()); - - - /** - * Creates a new GeometryDefinition using the given SpatialPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param spatialns the SpatialPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - GeometryDefinition(SpatialPkgNamespaces *spatialns); - - - /** - * Copy constructor for GeometryDefinition. - * - * @param orig the GeometryDefinition instance to copy. - */ - GeometryDefinition(const GeometryDefinition& orig); - - - /** - * Assignment operator for GeometryDefinition. - * - * @param rhs the GeometryDefinition object whose values are to be used as - * the basis of the assignment. - */ - GeometryDefinition& operator=(const GeometryDefinition& rhs); - - - /** - * Creates and returns a deep copy of this GeometryDefinition object. - * - * @return a (deep) copy of this GeometryDefinition object. - */ - virtual GeometryDefinition* clone() const; - - - /** - * Destructor for GeometryDefinition. - */ - virtual ~GeometryDefinition(); - - - /** - * Returns the value of the "id" attribute of this GeometryDefinition. - * - * @return the value of the "id" attribute of this GeometryDefinition as a - * string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "isActive" attribute of this GeometryDefinition. - * - * @return the value of the "isActive" attribute of this GeometryDefinition - * as a boolean. - */ - bool getIsActive() const; - - - /** - * Predicate returning @c true if this GeometryDefinition's "id" attribute is - * set. - * - * @return @c true if this GeometryDefinition's "id" attribute has been set, - * otherwise @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this GeometryDefinition's "isActive" - * attribute is set. - * - * @return @c true if this GeometryDefinition's "isActive" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetIsActive() const; - - - /** - * Sets the value of the "id" attribute of this GeometryDefinition. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "isActive" attribute of this GeometryDefinition. - * - * @param isActive bool value of the "isActive" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setIsActive(bool isActive); - - - /** - * Unsets the value of the "id" attribute of this GeometryDefinition. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "isActive" attribute of this GeometryDefinition. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetIsActive(); - - - /** - * Predicate returning @c true if this abstract "GeometryDefinition" is of - * type AnalyticGeometry - * - * @return @c true if this abstract "GeometryDefinition" is of type - * AnalyticGeometry, @c false otherwise - */ - virtual bool isAnalyticGeometry() const; - - - /** - * Predicate returning @c true if this abstract "GeometryDefinition" is of - * type SampledFieldGeometry - * - * @return @c true if this abstract "GeometryDefinition" is of type - * SampledFieldGeometry, @c false otherwise - */ - virtual bool isSampledFieldGeometry() const; - - - /** - * Predicate returning @c true if this abstract "GeometryDefinition" is of - * type CSGeometry - * - * @return @c true if this abstract "GeometryDefinition" is of type - * CSGeometry, @c false otherwise - */ - virtual bool isCSGeometry() const; - - - /** - * Predicate returning @c true if this abstract "GeometryDefinition" is of - * type ParametricGeometry - * - * @return @c true if this abstract "GeometryDefinition" is of type - * ParametricGeometry, @c false otherwise - */ - virtual bool isParametricGeometry() const; - - - /** - * Predicate returning @c true if this abstract "GeometryDefinition" is of - * type MixedGeometry - * - * @return @c true if this abstract "GeometryDefinition" is of type - * MixedGeometry, @c false otherwise - */ - virtual bool isMixedGeometry() const; - - - /** - * Returns the XML element name of this GeometryDefinition object. - * - * For GeometryDefinition, the XML element name is always - * @c "geometryDefinition". - * - * @return the name of this element, i.e. @c "geometryDefinition". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this GeometryDefinition object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this GeometryDefinition object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_SPATIAL_GEOMETRYDEFINITION, SBMLSpatialTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * GeometryDefinition object have been set. - * - * @return @c true to indicate that all the required attributes of this - * GeometryDefinition have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the GeometryDefinition object are: - * @li "id" - * @li "isActive" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this GeometryDefinition's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this GeometryDefinition's attribute "attributeName" has - * been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * GeometryDefinition. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new AnalyticGeometry using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GeometryDefinition_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * GeometryDefinition_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this GeometryDefinition_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -AnalyticGeometry_t * -GeometryDefinition_createAnalyticGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new SampledFieldGeometry using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GeometryDefinition_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * GeometryDefinition_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this GeometryDefinition_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -SampledFieldGeometry_t * -GeometryDefinition_createSampledFieldGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new CSGeometry using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GeometryDefinition_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * GeometryDefinition_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this GeometryDefinition_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -CSGeometry_t * -GeometryDefinition_createCSGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new ParametricGeometry using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GeometryDefinition_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * GeometryDefinition_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this GeometryDefinition_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -ParametricGeometry_t * -GeometryDefinition_createParametricGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates a new MixedGeometry using the given SBML Level, Version and - * “spatial” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GeometryDefinition_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * GeometryDefinition_t. - * - * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to - * this GeometryDefinition_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -MixedGeometry_t * -GeometryDefinition_createMixedGeometry(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this GeometryDefinition_t object. - * - * @param gd the GeometryDefinition_t structure. - * - * @return a (deep) copy of this GeometryDefinition_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -GeometryDefinition_t* -GeometryDefinition_clone(const GeometryDefinition_t* gd); - - -/** - * Frees this GeometryDefinition_t object. - * - * @param gd the GeometryDefinition_t structure. - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -void -GeometryDefinition_free(GeometryDefinition_t* gd); - - -/** - * Returns the value of the "id" attribute of this GeometryDefinition_t. - * - * @param gd the GeometryDefinition_t structure whose id is sought. - * - * @return the value of the "id" attribute of this GeometryDefinition_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -char * -GeometryDefinition_getId(const GeometryDefinition_t * gd); - - -/** - * Returns the value of the "isActive" attribute of this GeometryDefinition_t. - * - * @param gd the GeometryDefinition_t structure whose isActive is sought. - * - * @return the value of the "isActive" attribute of this GeometryDefinition_t - * as a boolean. - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_getIsActive(const GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 (true) if this GeometryDefinition_t's "id" - * attribute is set. - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 (true) if this GeometryDefinition_t's "id" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isSetId(const GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 (true) if this GeometryDefinition_t's "isActive" - * attribute is set. - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 (true) if this GeometryDefinition_t's "isActive" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isSetIsActive(const GeometryDefinition_t * gd); - - -/** - * Sets the value of the "id" attribute of this GeometryDefinition_t. - * - * @param gd the GeometryDefinition_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling GeometryDefinition_unsetId(). - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_setId(GeometryDefinition_t * gd, const char * id); - - -/** - * Sets the value of the "isActive" attribute of this GeometryDefinition_t. - * - * @param gd the GeometryDefinition_t structure. - * - * @param isActive int value of the "isActive" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_setIsActive(GeometryDefinition_t * gd, int isActive); - - -/** - * Unsets the value of the "id" attribute of this GeometryDefinition_t. - * - * @param gd the GeometryDefinition_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_unsetId(GeometryDefinition_t * gd); - - -/** - * Unsets the value of the "isActive" attribute of this GeometryDefinition_t. - * - * @param gd the GeometryDefinition_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_unsetIsActive(GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * AnalyticGeometry_t - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 if this GeometryDefinition_t is of type AnalyticGeometry_t, - * @c 0 otherwise - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isAnalyticGeometry(const GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * SampledFieldGeometry_t - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 if this GeometryDefinition_t is of type SampledFieldGeometry_t, - * @c 0 otherwise - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isSampledFieldGeometry(const GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * CSGeometry_t - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 if this GeometryDefinition_t is of type CSGeometry_t, @c 0 - * otherwise - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isCSGeometry(const GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * ParametricGeometry_t - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 if this GeometryDefinition_t is of type ParametricGeometry_t, - * @c 0 otherwise - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isParametricGeometry(const GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 if this GeometryDefinition_t is of type - * MixedGeometry_t - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 if this GeometryDefinition_t is of type MixedGeometry_t, @c 0 - * otherwise - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_isMixedGeometry(const GeometryDefinition_t * gd); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * GeometryDefinition_t object have been set. - * - * @param gd the GeometryDefinition_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * GeometryDefinition_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the GeometryDefinition_t object are: - * @li "id" - * @li "isActive" - * - * @memberof GeometryDefinition_t - */ -LIBSBML_EXTERN -int -GeometryDefinition_hasRequiredAttributes(const GeometryDefinition_t * gd); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !GeometryDefinition_H__ */ - - +/** + * @file GeometryDefinition.h + * @brief Definition of the GeometryDefinition class. + * @author SBMLTeam + * + * + * + * @class GeometryDefinition + * @sbmlbrief{spatial} TODO:Definition of the GeometryDefinition class. + */ + + +#ifndef GeometryDefinition_H__ +#define GeometryDefinition_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class AnalyticGeometry; +class SampledFieldGeometry; +class CSGeometry; +class ParametricGeometry; +class MixedGeometry; + +class LIBSBML_EXTERN GeometryDefinition : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + bool mIsActive; + bool mIsSetIsActive; + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new GeometryDefinition using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GeometryDefinition. + * + * @param version an unsigned int, the SBML Version to assign to this + * GeometryDefinition. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this GeometryDefinition. + * + * @copydetails doc_note_setting_lv_pkg + */ + GeometryDefinition(unsigned int level = SpatialExtension::getDefaultLevel(), + unsigned int version = + SpatialExtension::getDefaultVersion(), + unsigned int pkgVersion = + SpatialExtension::getDefaultPackageVersion()); + + + /** + * Creates a new GeometryDefinition using the given SpatialPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param spatialns the SpatialPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + GeometryDefinition(SpatialPkgNamespaces *spatialns); + + + /** + * Copy constructor for GeometryDefinition. + * + * @param orig the GeometryDefinition instance to copy. + */ + GeometryDefinition(const GeometryDefinition& orig); + + + /** + * Assignment operator for GeometryDefinition. + * + * @param rhs the GeometryDefinition object whose values are to be used as + * the basis of the assignment. + */ + GeometryDefinition& operator=(const GeometryDefinition& rhs); + + + /** + * Creates and returns a deep copy of this GeometryDefinition object. + * + * @return a (deep) copy of this GeometryDefinition object. + */ + virtual GeometryDefinition* clone() const; + + + /** + * Destructor for GeometryDefinition. + */ + virtual ~GeometryDefinition(); + + + /** + * Returns the value of the "id" attribute of this GeometryDefinition. + * + * @return the value of the "id" attribute of this GeometryDefinition as a + * string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "isActive" attribute of this GeometryDefinition. + * + * @return the value of the "isActive" attribute of this GeometryDefinition + * as a boolean. + */ + bool getIsActive() const; + + + /** + * Predicate returning @c true if this GeometryDefinition's "id" attribute is + * set. + * + * @return @c true if this GeometryDefinition's "id" attribute has been set, + * otherwise @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this GeometryDefinition's "isActive" + * attribute is set. + * + * @return @c true if this GeometryDefinition's "isActive" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetIsActive() const; + + + /** + * Sets the value of the "id" attribute of this GeometryDefinition. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "isActive" attribute of this GeometryDefinition. + * + * @param isActive bool value of the "isActive" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setIsActive(bool isActive); + + + /** + * Unsets the value of the "id" attribute of this GeometryDefinition. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "isActive" attribute of this GeometryDefinition. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetIsActive(); + + + /** + * Predicate returning @c true if this abstract "GeometryDefinition" is of + * type AnalyticGeometry + * + * @return @c true if this abstract "GeometryDefinition" is of type + * AnalyticGeometry, @c false otherwise + */ + virtual bool isAnalyticGeometry() const; + + + /** + * Predicate returning @c true if this abstract "GeometryDefinition" is of + * type SampledFieldGeometry + * + * @return @c true if this abstract "GeometryDefinition" is of type + * SampledFieldGeometry, @c false otherwise + */ + virtual bool isSampledFieldGeometry() const; + + + /** + * Predicate returning @c true if this abstract "GeometryDefinition" is of + * type CSGeometry + * + * @return @c true if this abstract "GeometryDefinition" is of type + * CSGeometry, @c false otherwise + */ + virtual bool isCSGeometry() const; + + + /** + * Predicate returning @c true if this abstract "GeometryDefinition" is of + * type ParametricGeometry + * + * @return @c true if this abstract "GeometryDefinition" is of type + * ParametricGeometry, @c false otherwise + */ + virtual bool isParametricGeometry() const; + + + /** + * Predicate returning @c true if this abstract "GeometryDefinition" is of + * type MixedGeometry + * + * @return @c true if this abstract "GeometryDefinition" is of type + * MixedGeometry, @c false otherwise + */ + virtual bool isMixedGeometry() const; + + + /** + * Returns the XML element name of this GeometryDefinition object. + * + * For GeometryDefinition, the XML element name is always + * @c "geometryDefinition". + * + * @return the name of this element, i.e. @c "geometryDefinition". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this GeometryDefinition object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this GeometryDefinition object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_SPATIAL_GEOMETRYDEFINITION, SBMLSpatialTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * GeometryDefinition object have been set. + * + * @return @c true to indicate that all the required attributes of this + * GeometryDefinition have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the GeometryDefinition object are: + * @li "id" + * @li "isActive" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this GeometryDefinition's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this GeometryDefinition's attribute "attributeName" has + * been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * GeometryDefinition. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new AnalyticGeometry using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GeometryDefinition_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * GeometryDefinition_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this GeometryDefinition_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +AnalyticGeometry_t * +GeometryDefinition_createAnalyticGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new SampledFieldGeometry using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GeometryDefinition_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * GeometryDefinition_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this GeometryDefinition_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +SampledFieldGeometry_t * +GeometryDefinition_createSampledFieldGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new CSGeometry using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GeometryDefinition_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * GeometryDefinition_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this GeometryDefinition_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +CSGeometry_t * +GeometryDefinition_createCSGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new ParametricGeometry using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GeometryDefinition_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * GeometryDefinition_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this GeometryDefinition_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +ParametricGeometry_t * +GeometryDefinition_createParametricGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates a new MixedGeometry using the given SBML Level, Version and + * “spatial” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GeometryDefinition_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * GeometryDefinition_t. + * + * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to + * this GeometryDefinition_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +MixedGeometry_t * +GeometryDefinition_createMixedGeometry(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this GeometryDefinition_t object. + * + * @param gd the GeometryDefinition_t structure. + * + * @return a (deep) copy of this GeometryDefinition_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +GeometryDefinition_t* +GeometryDefinition_clone(const GeometryDefinition_t* gd); + + +/** + * Frees this GeometryDefinition_t object. + * + * @param gd the GeometryDefinition_t structure. + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +void +GeometryDefinition_free(GeometryDefinition_t* gd); + + +/** + * Returns the value of the "id" attribute of this GeometryDefinition_t. + * + * @param gd the GeometryDefinition_t structure whose id is sought. + * + * @return the value of the "id" attribute of this GeometryDefinition_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +char * +GeometryDefinition_getId(const GeometryDefinition_t * gd); + + +/** + * Returns the value of the "isActive" attribute of this GeometryDefinition_t. + * + * @param gd the GeometryDefinition_t structure whose isActive is sought. + * + * @return the value of the "isActive" attribute of this GeometryDefinition_t + * as a boolean. + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_getIsActive(const GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 (true) if this GeometryDefinition_t's "id" + * attribute is set. + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 (true) if this GeometryDefinition_t's "id" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isSetId(const GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 (true) if this GeometryDefinition_t's "isActive" + * attribute is set. + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 (true) if this GeometryDefinition_t's "isActive" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isSetIsActive(const GeometryDefinition_t * gd); + + +/** + * Sets the value of the "id" attribute of this GeometryDefinition_t. + * + * @param gd the GeometryDefinition_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling GeometryDefinition_unsetId(). + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_setId(GeometryDefinition_t * gd, const char * id); + + +/** + * Sets the value of the "isActive" attribute of this GeometryDefinition_t. + * + * @param gd the GeometryDefinition_t structure. + * + * @param isActive int value of the "isActive" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_setIsActive(GeometryDefinition_t * gd, int isActive); + + +/** + * Unsets the value of the "id" attribute of this GeometryDefinition_t. + * + * @param gd the GeometryDefinition_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_unsetId(GeometryDefinition_t * gd); + + +/** + * Unsets the value of the "isActive" attribute of this GeometryDefinition_t. + * + * @param gd the GeometryDefinition_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_unsetIsActive(GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * AnalyticGeometry_t + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 if this GeometryDefinition_t is of type AnalyticGeometry_t, + * @c 0 otherwise + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isAnalyticGeometry(const GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * SampledFieldGeometry_t + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 if this GeometryDefinition_t is of type SampledFieldGeometry_t, + * @c 0 otherwise + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isSampledFieldGeometry(const GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * CSGeometry_t + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 if this GeometryDefinition_t is of type CSGeometry_t, @c 0 + * otherwise + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isCSGeometry(const GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * ParametricGeometry_t + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 if this GeometryDefinition_t is of type ParametricGeometry_t, + * @c 0 otherwise + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isParametricGeometry(const GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 if this GeometryDefinition_t is of type + * MixedGeometry_t + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 if this GeometryDefinition_t is of type MixedGeometry_t, @c 0 + * otherwise + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_isMixedGeometry(const GeometryDefinition_t * gd); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * GeometryDefinition_t object have been set. + * + * @param gd the GeometryDefinition_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * GeometryDefinition_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the GeometryDefinition_t object are: + * @li "id" + * @li "isActive" + * + * @memberof GeometryDefinition_t + */ +LIBSBML_EXTERN +int +GeometryDefinition_hasRequiredAttributes(const GeometryDefinition_t * gd); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !GeometryDefinition_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/GradientStop.cpp b/generator/tests/test_cpp_code/test-code/GradientStop.cpp index 7c88e749..2afc7dc6 100644 --- a/generator/tests/test_cpp_code/test-code/GradientStop.cpp +++ b/generator/tests/test_cpp_code/test-code/GradientStop.cpp @@ -1,1307 +1,1307 @@ -/** - * @file GradientStop.cpp - * @brief Implementation of the GradientStop class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new GradientStop using the given SBML Level, Version and - * “render” package version. - */ -GradientStop::GradientStop(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mOffset (NULL) - , mStopColor ("") - , mElementName("stop") -{ - setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new GradientStop using the given RenderPkgNamespaces object. - */ -GradientStop::GradientStop(RenderPkgNamespaces *renderns) - : SBase(renderns) - , mOffset (NULL) - , mStopColor ("") - , mElementName("stop") -{ - setElementNamespace(renderns->getURI()); - connectToChild(); - loadPlugins(renderns); -} - - -/* - * Copy constructor for GradientStop. - */ -GradientStop::GradientStop(const GradientStop& orig) - : SBase( orig ) - , mOffset ( NULL ) - , mStopColor ( orig.mStopColor ) - , mElementName ( orig.mElementName ) -{ - if (orig.mOffset != NULL) - { - mOffset = orig.mOffset->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for GradientStop. - */ -GradientStop& -GradientStop::operator=(const GradientStop& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mStopColor = rhs.mStopColor; - mElementName = rhs.mElementName; - delete mOffset; - if (rhs.mOffset != NULL) - { - mOffset = rhs.mOffset->clone(); - } - else - { - mOffset = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this GradientStop object. - */ -GradientStop* -GradientStop::clone() const -{ - return new GradientStop(*this); -} - - -/* - * Destructor for GradientStop. - */ -GradientStop::~GradientStop() -{ - delete mOffset; - mOffset = NULL; -} - - -/* - * Returns the value of the "stop-color" attribute of this GradientStop. - */ -const std::string& -GradientStop::getStopColor() const -{ - return mStopColor; -} - - -/* - * Predicate returning @c true if this GradientStop's "stop-color" attribute is - * set. - */ -bool -GradientStop::isSetStopColor() const -{ - return (mStopColor.empty() == false); -} - - -/* - * Sets the value of the "stop-color" attribute of this GradientStop. - */ -int -GradientStop::setStopColor(const std::string& stopColor) -{ - mStopColor = stopColor; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "stop-color" attribute of this GradientStop. - */ -int -GradientStop::unsetStopColor() -{ - mStopColor.erase(); - - if (mStopColor.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "offset" element of this GradientStop. - */ -const RelAbsVector* -GradientStop::getOffset() const -{ - return mOffset; -} - - -/* - * Returns the value of the "offset" element of this GradientStop. - */ -RelAbsVector* -GradientStop::getOffset() -{ - return mOffset; -} - - -/* - * Predicate returning @c true if this GradientStop's "offset" element is set. - */ -bool -GradientStop::isSetOffset() const -{ - return (mOffset != NULL); -} - - -/* - * Sets the value of the "offset" element of this GradientStop. - */ -int -GradientStop::setOffset(const RelAbsVector* offset) -{ - if (mOffset == offset) - { - return LIBSBML_OPERATION_SUCCESS; - } - else if (offset == NULL) - { - delete mOffset; - mOffset = NULL; - return LIBSBML_OPERATION_SUCCESS; - } - else - { - delete mOffset; - mOffset = (offset != NULL) ? offset->clone() : NULL; - if (mOffset != NULL) - { - mOffset->setElementName("offset"); - mOffset->connectToParent(this); - } - - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new RelAbsVector object, adds it to this GradientStop object and - * returns the RelAbsVector object created. - */ -RelAbsVector* -GradientStop::createOffset() -{ - if (mOffset != NULL) - { - delete mOffset; - } - - RENDER_CREATE_NS(renderns, getSBMLNamespaces()); - mOffset = new RelAbsVector(renderns); - - mOffset->setElementName("offset"); - - delete renderns; - - connectToChild(); - - return mOffset; -} - - -/* - * Unsets the value of the "offset" element of this GradientStop. - */ -int -GradientStop::unsetOffset() -{ - delete mOffset; - mOffset = NULL; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this GradientStop object. - */ -const std::string& -GradientStop::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this GradientStop object. - */ -void -GradientStop::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this GradientStop object. - */ -int -GradientStop::getTypeCode() const -{ - return SBML_RENDER_GRADIENT_STOP; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * GradientStop object have been set. - */ -bool -GradientStop::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetStopColor() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this - * GradientStop object have been set. - */ -bool -GradientStop::hasRequiredElements() const -{ - bool allPresent = true; - - if (isSetOffset() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -GradientStop::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (isSetOffset() == true) - { - mOffset->write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -GradientStop::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - if (mOffset != NULL) - { - mOffset->accept(v); - } - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -GradientStop::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - if (mOffset != NULL) - { - mOffset->setSBMLDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -GradientStop::connectToChild() -{ - SBase::connectToChild(); - - if (mOffset != NULL) - { - mOffset->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -GradientStop::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - if (isSetOffset()) - { - mOffset->enablePackageInternal(pkgURI, pkgPrefix, flag); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -GradientStop::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - if (mOffset != NULL) - { - mOffset->updateSBMLNamespace(package, level, version); - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "stop-color") - { - value = getStopColor(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this GradientStop's attribute "attributeName" - * is set. - */ -bool -GradientStop::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "stop-color") - { - value = isSetStopColor(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "stop-color") - { - return_value = setStopColor(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this GradientStop. - */ -int -GradientStop::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "stop-color") - { - value = unsetStopColor(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this GradientStop. - */ -SBase* -GradientStop::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "offset") - { - return createOffset(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this GradientStop. - */ -int -GradientStop::addChildObject(const std::string& elementName, - const SBase* element) -{ - if (elementName == "offset" && element->getTypeCode() == - SBML_RENDER_RELABSVECTOR) - { - return setOffset((const RelAbsVector*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * GradientStop. - */ -SBase* -GradientStop::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "offset") - { - RelAbsVector * obj = mOffset; - mOffset = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this GradientStop. - */ -unsigned int -GradientStop::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "offset") - { - if (isSetOffset()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this GradientStop. - */ -SBase* -GradientStop::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "offset") - { - return getOffset(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -GradientStop::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mOffset != NULL) - { - if (mOffset->getId() == id) - { - return mOffset; - } - - obj = mOffset->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -GradientStop::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mOffset != NULL) - { - if (mOffset->getMetaId() == metaid) - { - return mOffset; - } - - obj = mOffset->getElementByMetaId(metaid); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -GradientStop::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - ADD_FILTERED_POINTER(ret, sublist, mOffset, filter); - - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -GradientStop::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - RENDER_CREATE_NS(renderns, getSBMLNamespaces()); - - if (name == "offset") - { - if (getErrorLog() && isSetOffset()) - { - getErrorLog()->logPackageError("render", - RenderGradientStopAllowedAttributes, getPackageVersion(), getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mOffset; - mOffset = new RelAbsVector(renderns); - mOffset->setElementName(name); - obj = mOffset; - } - - delete renderns; - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -GradientStop::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("stop-color"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -GradientStop::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("render", - RenderGradientBaseLOGradientStopsAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("render", - RenderGradientBaseLOGradientStopsAllowedCoreAttributes, pkgVersion, - level, version, details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("render", RenderGradientStopAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("render", RenderGradientStopAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // stop-color string (use = "required" ) - // - - assigned = attributes.readInto("stop-color", mStopColor); - - if (assigned == true) - { - if (mStopColor.empty() == true) - { - logEmptyString(mStopColor, level, version, ""); - } - } - else - { - if (log) - { - std::string message = "Render attribute 'stop-color' is missing from the " - " element."; - log->logPackageError("render", RenderGradientStopAllowedAttributes, - pkgVersion, level, version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -GradientStop::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetStopColor() == true) - { - stream.writeAttribute("stop-color", getPrefix(), mStopColor); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new GradientStop_t using the given SBML Level, Version and - * “render” package version. - */ -LIBSBML_EXTERN -GradientStop_t * -GradientStop_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new GradientStop(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this GradientStop_t object. - */ -LIBSBML_EXTERN -GradientStop_t* -GradientStop_clone(const GradientStop_t* gs) -{ - if (gs != NULL) - { - return static_cast(gs->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this GradientStop_t object. - */ -LIBSBML_EXTERN -void -GradientStop_free(GradientStop_t* gs) -{ - if (gs != NULL) - { - delete gs; - } -} - - -/* - * Returns the value of the "stop-color" attribute of this GradientStop_t. - */ -LIBSBML_EXTERN -char * -GradientStop_getStopColor(const GradientStop_t * gs) -{ - if (gs == NULL) - { - return NULL; - } - - return gs->getStopColor().empty() ? NULL : - safe_strdup(gs->getStopColor().c_str()); -} - - -/* - * Predicate returning @c 1 (true) if this GradientStop_t's "stop-color" - * attribute is set. - */ -LIBSBML_EXTERN -int -GradientStop_isSetStopColor(const GradientStop_t * gs) -{ - return (gs != NULL) ? static_cast(gs->isSetStopColor()) : 0; -} - - -/* - * Sets the value of the "stop-color" attribute of this GradientStop_t. - */ -LIBSBML_EXTERN -int -GradientStop_setStopColor(GradientStop_t * gs, const char * stopColor) -{ - return (gs != NULL) ? gs->setStopColor(stopColor) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "stop-color" attribute of this GradientStop_t. - */ -LIBSBML_EXTERN -int -GradientStop_unsetStopColor(GradientStop_t * gs) -{ - return (gs != NULL) ? gs->unsetStopColor() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns the value of the "offset" element of this GradientStop_t. - */ -LIBSBML_EXTERN -const RelAbsVector_t* -GradientStop_getOffset(const GradientStop_t * gs) -{ - if (gs == NULL) - { - return NULL; - } - - return (RelAbsVector_t*)(gs->getOffset()); -} - - -/* - * Predicate returning @c 1 (true) if this GradientStop_t's "offset" element is - * set. - */ -LIBSBML_EXTERN -int -GradientStop_isSetOffset(const GradientStop_t * gs) -{ - return (gs != NULL) ? static_cast(gs->isSetOffset()) : 0; -} - - -/* - * Sets the value of the "offset" element of this GradientStop_t. - */ -LIBSBML_EXTERN -int -GradientStop_setOffset(GradientStop_t * gs, const RelAbsVector_t* offset) -{ - return (gs != NULL) ? gs->setOffset(offset) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Creates a new RelAbsVector_t object, adds it to this GradientStop_t object - * and returns the RelAbsVector_t object created. - */ -LIBSBML_EXTERN -RelAbsVector_t* -GradientStop_createOffset(GradientStop_t* gs) -{ - if (gs == NULL) - { - return NULL; - } - - return (RelAbsVector_t*)(gs->createOffset()); -} - - -/* - * Unsets the value of the "offset" element of this GradientStop_t. - */ -LIBSBML_EXTERN -int -GradientStop_unsetOffset(GradientStop_t * gs) -{ - return (gs != NULL) ? gs->unsetOffset() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * GradientStop_t object have been set. - */ -LIBSBML_EXTERN -int -GradientStop_hasRequiredAttributes(const GradientStop_t * gs) -{ - return (gs != NULL) ? static_cast(gs->hasRequiredAttributes()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required elements for this - * GradientStop_t object have been set. - */ -LIBSBML_EXTERN -int -GradientStop_hasRequiredElements(const GradientStop_t * gs) -{ - return (gs != NULL) ? static_cast(gs->hasRequiredElements()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file GradientStop.cpp + * @brief Implementation of the GradientStop class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new GradientStop using the given SBML Level, Version and + * “render” package version. + */ +GradientStop::GradientStop(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mOffset (NULL) + , mStopColor ("") + , mElementName("stop") +{ + setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new GradientStop using the given RenderPkgNamespaces object. + */ +GradientStop::GradientStop(RenderPkgNamespaces *renderns) + : SBase(renderns) + , mOffset (NULL) + , mStopColor ("") + , mElementName("stop") +{ + setElementNamespace(renderns->getURI()); + connectToChild(); + loadPlugins(renderns); +} + + +/* + * Copy constructor for GradientStop. + */ +GradientStop::GradientStop(const GradientStop& orig) + : SBase( orig ) + , mOffset ( NULL ) + , mStopColor ( orig.mStopColor ) + , mElementName ( orig.mElementName ) +{ + if (orig.mOffset != NULL) + { + mOffset = orig.mOffset->clone(); + } + + connectToChild(); +} + + +/* + * Assignment operator for GradientStop. + */ +GradientStop& +GradientStop::operator=(const GradientStop& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mStopColor = rhs.mStopColor; + mElementName = rhs.mElementName; + delete mOffset; + if (rhs.mOffset != NULL) + { + mOffset = rhs.mOffset->clone(); + } + else + { + mOffset = NULL; + } + + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this GradientStop object. + */ +GradientStop* +GradientStop::clone() const +{ + return new GradientStop(*this); +} + + +/* + * Destructor for GradientStop. + */ +GradientStop::~GradientStop() +{ + delete mOffset; + mOffset = NULL; +} + + +/* + * Returns the value of the "stop-color" attribute of this GradientStop. + */ +const std::string& +GradientStop::getStopColor() const +{ + return mStopColor; +} + + +/* + * Predicate returning @c true if this GradientStop's "stop-color" attribute is + * set. + */ +bool +GradientStop::isSetStopColor() const +{ + return (mStopColor.empty() == false); +} + + +/* + * Sets the value of the "stop-color" attribute of this GradientStop. + */ +int +GradientStop::setStopColor(const std::string& stopColor) +{ + mStopColor = stopColor; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "stop-color" attribute of this GradientStop. + */ +int +GradientStop::unsetStopColor() +{ + mStopColor.erase(); + + if (mStopColor.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Returns the value of the "offset" element of this GradientStop. + */ +const RelAbsVector* +GradientStop::getOffset() const +{ + return mOffset; +} + + +/* + * Returns the value of the "offset" element of this GradientStop. + */ +RelAbsVector* +GradientStop::getOffset() +{ + return mOffset; +} + + +/* + * Predicate returning @c true if this GradientStop's "offset" element is set. + */ +bool +GradientStop::isSetOffset() const +{ + return (mOffset != NULL); +} + + +/* + * Sets the value of the "offset" element of this GradientStop. + */ +int +GradientStop::setOffset(const RelAbsVector* offset) +{ + if (mOffset == offset) + { + return LIBSBML_OPERATION_SUCCESS; + } + else if (offset == NULL) + { + delete mOffset; + mOffset = NULL; + return LIBSBML_OPERATION_SUCCESS; + } + else + { + delete mOffset; + mOffset = (offset != NULL) ? offset->clone() : NULL; + if (mOffset != NULL) + { + mOffset->setElementName("offset"); + mOffset->connectToParent(this); + } + + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Creates a new RelAbsVector object, adds it to this GradientStop object and + * returns the RelAbsVector object created. + */ +RelAbsVector* +GradientStop::createOffset() +{ + if (mOffset != NULL) + { + delete mOffset; + } + + RENDER_CREATE_NS(renderns, getSBMLNamespaces()); + mOffset = new RelAbsVector(renderns); + + mOffset->setElementName("offset"); + + delete renderns; + + connectToChild(); + + return mOffset; +} + + +/* + * Unsets the value of the "offset" element of this GradientStop. + */ +int +GradientStop::unsetOffset() +{ + delete mOffset; + mOffset = NULL; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the XML element name of this GradientStop object. + */ +const std::string& +GradientStop::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this GradientStop object. + */ +void +GradientStop::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this GradientStop object. + */ +int +GradientStop::getTypeCode() const +{ + return SBML_RENDER_GRADIENT_STOP; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * GradientStop object have been set. + */ +bool +GradientStop::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetStopColor() == false) + { + allPresent = false; + } + + return allPresent; +} + + +/* + * Predicate returning @c true if all the required elements for this + * GradientStop object have been set. + */ +bool +GradientStop::hasRequiredElements() const +{ + bool allPresent = true; + + if (isSetOffset() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +GradientStop::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (isSetOffset() == true) + { + mOffset->write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +GradientStop::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + if (mOffset != NULL) + { + mOffset->accept(v); + } + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +GradientStop::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + if (mOffset != NULL) + { + mOffset->setSBMLDocument(d); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +GradientStop::connectToChild() +{ + SBase::connectToChild(); + + if (mOffset != NULL) + { + mOffset->connectToParent(this); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +GradientStop::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + if (isSetOffset()) + { + mOffset->enablePackageInternal(pkgURI, pkgPrefix, flag); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +GradientStop::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + if (mOffset != NULL) + { + mOffset->updateSBMLNamespace(package, level, version); + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "stop-color") + { + value = getStopColor(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this GradientStop's attribute "attributeName" + * is set. + */ +bool +GradientStop::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "stop-color") + { + value = isSetStopColor(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "stop-color") + { + return_value = setStopColor(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this GradientStop. + */ +int +GradientStop::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "stop-color") + { + value = unsetStopColor(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this GradientStop. + */ +SBase* +GradientStop::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "offset") + { + return createOffset(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this GradientStop. + */ +int +GradientStop::addChildObject(const std::string& elementName, + const SBase* element) +{ + if (elementName == "offset" && element->getTypeCode() == + SBML_RENDER_RELABSVECTOR) + { + return setOffset((const RelAbsVector*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * GradientStop. + */ +SBase* +GradientStop::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "offset") + { + RelAbsVector * obj = mOffset; + mOffset = NULL; return obj; + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this GradientStop. + */ +unsigned int +GradientStop::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "offset") + { + if (isSetOffset()) + { + return 1; + } + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this GradientStop. + */ +SBase* +GradientStop::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "offset") + { + return getOffset(); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +GradientStop::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mOffset != NULL) + { + if (mOffset->getId() == id) + { + return mOffset; + } + + obj = mOffset->getElementBySId(id); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +GradientStop::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mOffset != NULL) + { + if (mOffset->getMetaId() == metaid) + { + return mOffset; + } + + obj = mOffset->getElementByMetaId(metaid); + if (obj != NULL) + { + return obj; + } + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +GradientStop::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + ADD_FILTERED_POINTER(ret, sublist, mOffset, filter); + + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +GradientStop::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + RENDER_CREATE_NS(renderns, getSBMLNamespaces()); + + if (name == "offset") + { + if (getErrorLog() && isSetOffset()) + { + getErrorLog()->logPackageError("render", + RenderGradientStopAllowedAttributes, getPackageVersion(), getLevel(), + getVersion(), "", getLine(), getColumn()); + } + + delete mOffset; + mOffset = new RelAbsVector(renderns); + mOffset->setElementName(name); + obj = mOffset; + } + + delete renderns; + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +GradientStop::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("stop-color"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +GradientStop::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("render", + RenderGradientBaseLOGradientStopsAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("render", + RenderGradientBaseLOGradientStopsAllowedCoreAttributes, pkgVersion, + level, version, details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("render", RenderGradientStopAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("render", RenderGradientStopAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // stop-color string (use = "required" ) + // + + assigned = attributes.readInto("stop-color", mStopColor); + + if (assigned == true) + { + if (mStopColor.empty() == true) + { + logEmptyString(mStopColor, level, version, ""); + } + } + else + { + if (log) + { + std::string message = "Render attribute 'stop-color' is missing from the " + " element."; + log->logPackageError("render", RenderGradientStopAllowedAttributes, + pkgVersion, level, version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +GradientStop::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetStopColor() == true) + { + stream.writeAttribute("stop-color", getPrefix(), mStopColor); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new GradientStop_t using the given SBML Level, Version and + * “render” package version. + */ +LIBSBML_EXTERN +GradientStop_t * +GradientStop_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new GradientStop(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this GradientStop_t object. + */ +LIBSBML_EXTERN +GradientStop_t* +GradientStop_clone(const GradientStop_t* gs) +{ + if (gs != NULL) + { + return static_cast(gs->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this GradientStop_t object. + */ +LIBSBML_EXTERN +void +GradientStop_free(GradientStop_t* gs) +{ + if (gs != NULL) + { + delete gs; + } +} + + +/* + * Returns the value of the "stop-color" attribute of this GradientStop_t. + */ +LIBSBML_EXTERN +char * +GradientStop_getStopColor(const GradientStop_t * gs) +{ + if (gs == NULL) + { + return NULL; + } + + return gs->getStopColor().empty() ? NULL : + safe_strdup(gs->getStopColor().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this GradientStop_t's "stop-color" + * attribute is set. + */ +LIBSBML_EXTERN +int +GradientStop_isSetStopColor(const GradientStop_t * gs) +{ + return (gs != NULL) ? static_cast(gs->isSetStopColor()) : 0; +} + + +/* + * Sets the value of the "stop-color" attribute of this GradientStop_t. + */ +LIBSBML_EXTERN +int +GradientStop_setStopColor(GradientStop_t * gs, const char * stopColor) +{ + return (gs != NULL) ? gs->setStopColor(stopColor) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "stop-color" attribute of this GradientStop_t. + */ +LIBSBML_EXTERN +int +GradientStop_unsetStopColor(GradientStop_t * gs) +{ + return (gs != NULL) ? gs->unsetStopColor() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns the value of the "offset" element of this GradientStop_t. + */ +LIBSBML_EXTERN +const RelAbsVector_t* +GradientStop_getOffset(const GradientStop_t * gs) +{ + if (gs == NULL) + { + return NULL; + } + + return (RelAbsVector_t*)(gs->getOffset()); +} + + +/* + * Predicate returning @c 1 (true) if this GradientStop_t's "offset" element is + * set. + */ +LIBSBML_EXTERN +int +GradientStop_isSetOffset(const GradientStop_t * gs) +{ + return (gs != NULL) ? static_cast(gs->isSetOffset()) : 0; +} + + +/* + * Sets the value of the "offset" element of this GradientStop_t. + */ +LIBSBML_EXTERN +int +GradientStop_setOffset(GradientStop_t * gs, const RelAbsVector_t* offset) +{ + return (gs != NULL) ? gs->setOffset(offset) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Creates a new RelAbsVector_t object, adds it to this GradientStop_t object + * and returns the RelAbsVector_t object created. + */ +LIBSBML_EXTERN +RelAbsVector_t* +GradientStop_createOffset(GradientStop_t* gs) +{ + if (gs == NULL) + { + return NULL; + } + + return (RelAbsVector_t*)(gs->createOffset()); +} + + +/* + * Unsets the value of the "offset" element of this GradientStop_t. + */ +LIBSBML_EXTERN +int +GradientStop_unsetOffset(GradientStop_t * gs) +{ + return (gs != NULL) ? gs->unsetOffset() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * GradientStop_t object have been set. + */ +LIBSBML_EXTERN +int +GradientStop_hasRequiredAttributes(const GradientStop_t * gs) +{ + return (gs != NULL) ? static_cast(gs->hasRequiredAttributes()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required elements for this + * GradientStop_t object have been set. + */ +LIBSBML_EXTERN +int +GradientStop_hasRequiredElements(const GradientStop_t * gs) +{ + return (gs != NULL) ? static_cast(gs->hasRequiredElements()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/GradientStop.h b/generator/tests/test_cpp_code/test-code/GradientStop.h index 224b2115..eaf5b76e 100644 --- a/generator/tests/test_cpp_code/test-code/GradientStop.h +++ b/generator/tests/test_cpp_code/test-code/GradientStop.h @@ -1,1088 +1,1088 @@ -/** - * @file GradientStop.h - * @brief Definition of the GradientStop class. - * @author SBMLTeam - * - * - * - * @class GradientStop - * @sbmlbrief{render} TODO:Definition of the GradientStop class. - */ - - -#ifndef GradientStop_H__ -#define GradientStop_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN GradientStop : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - RelAbsVector* mOffset; - std::string mStopColor; - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new GradientStop using the given SBML Level, Version and - * “render” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GradientStop. - * - * @param version an unsigned int, the SBML Version to assign to this - * GradientStop. - * - * @param pkgVersion an unsigned int, the SBML Render Version to assign to - * this GradientStop. - * - * @copydetails doc_note_setting_lv_pkg - */ - GradientStop(unsigned int level = RenderExtension::getDefaultLevel(), - unsigned int version = RenderExtension::getDefaultVersion(), - unsigned int pkgVersion = - RenderExtension::getDefaultPackageVersion()); - - - /** - * Creates a new GradientStop using the given RenderPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param renderns the RenderPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - GradientStop(RenderPkgNamespaces *renderns); - - - /** - * Copy constructor for GradientStop. - * - * @param orig the GradientStop instance to copy. - */ - GradientStop(const GradientStop& orig); - - - /** - * Assignment operator for GradientStop. - * - * @param rhs the GradientStop object whose values are to be used as the - * basis of the assignment. - */ - GradientStop& operator=(const GradientStop& rhs); - - - /** - * Creates and returns a deep copy of this GradientStop object. - * - * @return a (deep) copy of this GradientStop object. - */ - virtual GradientStop* clone() const; - - - /** - * Destructor for GradientStop. - */ - virtual ~GradientStop(); - - - /** - * Returns the value of the "stop-color" attribute of this GradientStop. - * - * @return the value of the "stop-color" attribute of this GradientStop as a - * string. - */ - const std::string& getStopColor() const; - - - /** - * Predicate returning @c true if this GradientStop's "stop-color" attribute - * is set. - * - * @return @c true if this GradientStop's "stop-color" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetStopColor() const; - - - /** - * Sets the value of the "stop-color" attribute of this GradientStop. - * - * @param stopColor std::string& value of the "stop-color" attribute to be - * set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p stopColor = @c NULL or an empty string is - * equivalent to calling unsetStopColor(). - */ - int setStopColor(const std::string& stopColor); - - - /** - * Unsets the value of the "stop-color" attribute of this GradientStop. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetStopColor(); - - - /** - * Returns the value of the "offset" element of this GradientStop. - * - * @return the value of the "offset" element of this GradientStop as a - * RelAbsVector*. - */ - const RelAbsVector* getOffset() const; - - - /** - * Returns the value of the "offset" element of this GradientStop. - * - * @return the value of the "offset" element of this GradientStop as a - * RelAbsVector*. - */ - RelAbsVector* getOffset(); - - - /** - * Predicate returning @c true if this GradientStop's "offset" element is - * set. - * - * @return @c true if this GradientStop's "offset" element has been set, - * otherwise @c false is returned. - */ - bool isSetOffset() const; - - - /** - * Sets the value of the "offset" element of this GradientStop. - * - * @param offset RelAbsVector* value of the "offset" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - */ - int setOffset(const RelAbsVector* offset); - - - /** - * Creates a new RelAbsVector object, adds it to this GradientStop object and - * returns the RelAbsVector object created. - * - * @return a new RelAbsVector object instance. - */ - RelAbsVector* createOffset(); - - - /** - * Unsets the value of the "offset" element of this GradientStop. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetOffset(); - - - /** - * Returns the XML element name of this GradientStop object. - * - * For GradientStop, the XML element name is always @c "stop". - * - * @return the name of this element, i.e. @c "stop". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this GradientStop object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this GradientStop object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_RENDER_GRADIENT_STOP, SBMLRenderTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * GradientStop object have been set. - * - * @return @c true to indicate that all the required attributes of this - * GradientStop have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the GradientStop object are: - * @li "stop-color" - */ - virtual bool hasRequiredAttributes() const; - - - /** - * Predicate returning @c true if all the required elements for this - * GradientStop object have been set. - * - * @return @c true to indicate that all the required elements of this - * GradientStop have been set, otherwise @c false is returned. - * - * - * @note The required elements for the GradientStop object are: - * @li "offset" - */ - virtual bool hasRequiredElements() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this GradientStop's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this GradientStop's attribute "attributeName" has been - * set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this GradientStop. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this GradientStop. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this GradientStop. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * GradientStop. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this GradientStop. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this GradientStop. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new GradientStop_t using the given SBML Level, Version and - * “render” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GradientStop_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * GradientStop_t. - * - * @param pkgVersion an unsigned int, the SBML Render Version to assign to this - * GradientStop_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -GradientStop_t * -GradientStop_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this GradientStop_t object. - * - * @param gs the GradientStop_t structure. - * - * @return a (deep) copy of this GradientStop_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -GradientStop_t* -GradientStop_clone(const GradientStop_t* gs); - - -/** - * Frees this GradientStop_t object. - * - * @param gs the GradientStop_t structure. - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -void -GradientStop_free(GradientStop_t* gs); - - -/** - * Returns the value of the "stop-color" attribute of this GradientStop_t. - * - * @param gs the GradientStop_t structure whose stop-color is sought. - * - * @return the value of the "stop-color" attribute of this GradientStop_t as a - * pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -char * -GradientStop_getStopColor(const GradientStop_t * gs); - - -/** - * Predicate returning @c 1 (true) if this GradientStop_t's "stop-color" - * attribute is set. - * - * @param gs the GradientStop_t structure. - * - * @return @c 1 (true) if this GradientStop_t's "stop-color" attribute has been - * set, otherwise @c 0 (false) is returned. - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_isSetStopColor(const GradientStop_t * gs); - - -/** - * Sets the value of the "stop-color" attribute of this GradientStop_t. - * - * @param gs the GradientStop_t structure. - * - * @param stopColor const char * value of the "stop-color" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p stopColor = @c NULL or an empty string is - * equivalent to calling GradientStop_unsetStopColor(). - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_setStopColor(GradientStop_t * gs, const char * stopColor); - - -/** - * Unsets the value of the "stop-color" attribute of this GradientStop_t. - * - * @param gs the GradientStop_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_unsetStopColor(GradientStop_t * gs); - - -/** - * Returns the value of the "offset" element of this GradientStop_t. - * - * @param gs the GradientStop_t structure whose offset is sought. - * - * @return the value of the "offset" element of this GradientStop_t as a - * RelAbsVector*. - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -const RelAbsVector_t* -GradientStop_getOffset(const GradientStop_t * gs); - - -/** - * Predicate returning @c 1 (true) if this GradientStop_t's "offset" element is - * set. - * - * @param gs the GradientStop_t structure. - * - * @return @c 1 (true) if this GradientStop_t's "offset" element has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_isSetOffset(const GradientStop_t * gs); - - -/** - * Sets the value of the "offset" element of this GradientStop_t. - * - * @param gs the GradientStop_t structure. - * - * @param offset RelAbsVector_t* value of the "offset" element to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_setOffset(GradientStop_t * gs, const RelAbsVector_t* offset); - - -/** - * Creates a new RelAbsVector_t object, adds it to this GradientStop_t object - * and returns the RelAbsVector_t object created. - * - * @param gs the GradientStop_t structure to which the RelAbsVector_t should be - * added. - * - * @return a new RelAbsVector_t object instance. - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -RelAbsVector_t* -GradientStop_createOffset(GradientStop_t* gs); - - -/** - * Unsets the value of the "offset" element of this GradientStop_t. - * - * @param gs the GradientStop_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_unsetOffset(GradientStop_t * gs); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * GradientStop_t object have been set. - * - * @param gs the GradientStop_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * GradientStop_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the GradientStop_t object are: - * @li "stop-color" - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_hasRequiredAttributes(const GradientStop_t * gs); - - -/** - * Predicate returning @c 1 (true) if all the required elements for this - * GradientStop_t object have been set. - * - * @param gs the GradientStop_t structure. - * - * @return @c 1 (true) to indicate that all the required elements of this - * GradientStop_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required elements for the GradientStop_t object are: - * @li "offset" - * - * @memberof GradientStop_t - */ -LIBSBML_EXTERN -int -GradientStop_hasRequiredElements(const GradientStop_t * gs); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !GradientStop_H__ */ - - +/** + * @file GradientStop.h + * @brief Definition of the GradientStop class. + * @author SBMLTeam + * + * + * + * @class GradientStop + * @sbmlbrief{render} TODO:Definition of the GradientStop class. + */ + + +#ifndef GradientStop_H__ +#define GradientStop_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN GradientStop : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + RelAbsVector* mOffset; + std::string mStopColor; + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new GradientStop using the given SBML Level, Version and + * “render” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GradientStop. + * + * @param version an unsigned int, the SBML Version to assign to this + * GradientStop. + * + * @param pkgVersion an unsigned int, the SBML Render Version to assign to + * this GradientStop. + * + * @copydetails doc_note_setting_lv_pkg + */ + GradientStop(unsigned int level = RenderExtension::getDefaultLevel(), + unsigned int version = RenderExtension::getDefaultVersion(), + unsigned int pkgVersion = + RenderExtension::getDefaultPackageVersion()); + + + /** + * Creates a new GradientStop using the given RenderPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param renderns the RenderPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + GradientStop(RenderPkgNamespaces *renderns); + + + /** + * Copy constructor for GradientStop. + * + * @param orig the GradientStop instance to copy. + */ + GradientStop(const GradientStop& orig); + + + /** + * Assignment operator for GradientStop. + * + * @param rhs the GradientStop object whose values are to be used as the + * basis of the assignment. + */ + GradientStop& operator=(const GradientStop& rhs); + + + /** + * Creates and returns a deep copy of this GradientStop object. + * + * @return a (deep) copy of this GradientStop object. + */ + virtual GradientStop* clone() const; + + + /** + * Destructor for GradientStop. + */ + virtual ~GradientStop(); + + + /** + * Returns the value of the "stop-color" attribute of this GradientStop. + * + * @return the value of the "stop-color" attribute of this GradientStop as a + * string. + */ + const std::string& getStopColor() const; + + + /** + * Predicate returning @c true if this GradientStop's "stop-color" attribute + * is set. + * + * @return @c true if this GradientStop's "stop-color" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetStopColor() const; + + + /** + * Sets the value of the "stop-color" attribute of this GradientStop. + * + * @param stopColor std::string& value of the "stop-color" attribute to be + * set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p stopColor = @c NULL or an empty string is + * equivalent to calling unsetStopColor(). + */ + int setStopColor(const std::string& stopColor); + + + /** + * Unsets the value of the "stop-color" attribute of this GradientStop. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetStopColor(); + + + /** + * Returns the value of the "offset" element of this GradientStop. + * + * @return the value of the "offset" element of this GradientStop as a + * RelAbsVector*. + */ + const RelAbsVector* getOffset() const; + + + /** + * Returns the value of the "offset" element of this GradientStop. + * + * @return the value of the "offset" element of this GradientStop as a + * RelAbsVector*. + */ + RelAbsVector* getOffset(); + + + /** + * Predicate returning @c true if this GradientStop's "offset" element is + * set. + * + * @return @c true if this GradientStop's "offset" element has been set, + * otherwise @c false is returned. + */ + bool isSetOffset() const; + + + /** + * Sets the value of the "offset" element of this GradientStop. + * + * @param offset RelAbsVector* value of the "offset" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + */ + int setOffset(const RelAbsVector* offset); + + + /** + * Creates a new RelAbsVector object, adds it to this GradientStop object and + * returns the RelAbsVector object created. + * + * @return a new RelAbsVector object instance. + */ + RelAbsVector* createOffset(); + + + /** + * Unsets the value of the "offset" element of this GradientStop. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetOffset(); + + + /** + * Returns the XML element name of this GradientStop object. + * + * For GradientStop, the XML element name is always @c "stop". + * + * @return the name of this element, i.e. @c "stop". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this GradientStop object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this GradientStop object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_RENDER_GRADIENT_STOP, SBMLRenderTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * GradientStop object have been set. + * + * @return @c true to indicate that all the required attributes of this + * GradientStop have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the GradientStop object are: + * @li "stop-color" + */ + virtual bool hasRequiredAttributes() const; + + + /** + * Predicate returning @c true if all the required elements for this + * GradientStop object have been set. + * + * @return @c true to indicate that all the required elements of this + * GradientStop have been set, otherwise @c false is returned. + * + * + * @note The required elements for the GradientStop object are: + * @li "offset" + */ + virtual bool hasRequiredElements() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this GradientStop's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this GradientStop's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this GradientStop. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this GradientStop. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this GradientStop. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * GradientStop. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this GradientStop. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this GradientStop. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new GradientStop_t using the given SBML Level, Version and + * “render” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GradientStop_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * GradientStop_t. + * + * @param pkgVersion an unsigned int, the SBML Render Version to assign to this + * GradientStop_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +GradientStop_t * +GradientStop_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this GradientStop_t object. + * + * @param gs the GradientStop_t structure. + * + * @return a (deep) copy of this GradientStop_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +GradientStop_t* +GradientStop_clone(const GradientStop_t* gs); + + +/** + * Frees this GradientStop_t object. + * + * @param gs the GradientStop_t structure. + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +void +GradientStop_free(GradientStop_t* gs); + + +/** + * Returns the value of the "stop-color" attribute of this GradientStop_t. + * + * @param gs the GradientStop_t structure whose stop-color is sought. + * + * @return the value of the "stop-color" attribute of this GradientStop_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +char * +GradientStop_getStopColor(const GradientStop_t * gs); + + +/** + * Predicate returning @c 1 (true) if this GradientStop_t's "stop-color" + * attribute is set. + * + * @param gs the GradientStop_t structure. + * + * @return @c 1 (true) if this GradientStop_t's "stop-color" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_isSetStopColor(const GradientStop_t * gs); + + +/** + * Sets the value of the "stop-color" attribute of this GradientStop_t. + * + * @param gs the GradientStop_t structure. + * + * @param stopColor const char * value of the "stop-color" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p stopColor = @c NULL or an empty string is + * equivalent to calling GradientStop_unsetStopColor(). + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_setStopColor(GradientStop_t * gs, const char * stopColor); + + +/** + * Unsets the value of the "stop-color" attribute of this GradientStop_t. + * + * @param gs the GradientStop_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_unsetStopColor(GradientStop_t * gs); + + +/** + * Returns the value of the "offset" element of this GradientStop_t. + * + * @param gs the GradientStop_t structure whose offset is sought. + * + * @return the value of the "offset" element of this GradientStop_t as a + * RelAbsVector*. + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +const RelAbsVector_t* +GradientStop_getOffset(const GradientStop_t * gs); + + +/** + * Predicate returning @c 1 (true) if this GradientStop_t's "offset" element is + * set. + * + * @param gs the GradientStop_t structure. + * + * @return @c 1 (true) if this GradientStop_t's "offset" element has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_isSetOffset(const GradientStop_t * gs); + + +/** + * Sets the value of the "offset" element of this GradientStop_t. + * + * @param gs the GradientStop_t structure. + * + * @param offset RelAbsVector_t* value of the "offset" element to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_setOffset(GradientStop_t * gs, const RelAbsVector_t* offset); + + +/** + * Creates a new RelAbsVector_t object, adds it to this GradientStop_t object + * and returns the RelAbsVector_t object created. + * + * @param gs the GradientStop_t structure to which the RelAbsVector_t should be + * added. + * + * @return a new RelAbsVector_t object instance. + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +RelAbsVector_t* +GradientStop_createOffset(GradientStop_t* gs); + + +/** + * Unsets the value of the "offset" element of this GradientStop_t. + * + * @param gs the GradientStop_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_unsetOffset(GradientStop_t * gs); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * GradientStop_t object have been set. + * + * @param gs the GradientStop_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * GradientStop_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the GradientStop_t object are: + * @li "stop-color" + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_hasRequiredAttributes(const GradientStop_t * gs); + + +/** + * Predicate returning @c 1 (true) if all the required elements for this + * GradientStop_t object have been set. + * + * @param gs the GradientStop_t structure. + * + * @return @c 1 (true) to indicate that all the required elements of this + * GradientStop_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required elements for the GradientStop_t object are: + * @li "offset" + * + * @memberof GradientStop_t + */ +LIBSBML_EXTERN +int +GradientStop_hasRequiredElements(const GradientStop_t * gs); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !GradientStop_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.cpp b/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.cpp index 0670e2e6..56cdeab0 100644 --- a/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.cpp +++ b/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.cpp @@ -1,1096 +1,1096 @@ -/** - * @file GraphicalPrimitive2D.cpp - * @brief Implementation of the GraphicalPrimitive2D class. - * @author SBMLTeam - * - * - */ -#include -#include - -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new GraphicalPrimitive2D using the given SBML Level, Version and - * “render” package version. - */ -GraphicalPrimitive2D::GraphicalPrimitive2D(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : GraphicalPrimitive1D(level, version, pkgVersion) - , mFill ("") - , mFillRule (FILL_EVENODD_INVALID) - , mElementName("graphicalPrimitive2D") -{ - setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level, version, pkgVersion)); -} - - -/* - * Creates a new GraphicalPrimitive2D using the given RenderPkgNamespaces - * object. - */ -GraphicalPrimitive2D::GraphicalPrimitive2D(RenderPkgNamespaces *renderns) - : GraphicalPrimitive1D(renderns) - , mFill ("") - , mFillRule (FILL_EVENODD_INVALID) - , mElementName("graphicalPrimitive2D") -{ - setElementNamespace(renderns->getURI()); - loadPlugins(renderns); -} - - -/* - * Copy constructor for GraphicalPrimitive2D. - */ -GraphicalPrimitive2D::GraphicalPrimitive2D(const GraphicalPrimitive2D& orig) - : GraphicalPrimitive1D( orig ) - , mFill ( orig.mFill ) - , mFillRule ( orig.mFillRule ) - , mElementName ( orig.mElementName ) -{ -} - - -/* - * Assignment operator for GraphicalPrimitive2D. - */ -GraphicalPrimitive2D& -GraphicalPrimitive2D::operator=(const GraphicalPrimitive2D& rhs) -{ - if (&rhs != this) - { - GraphicalPrimitive1D::operator=(rhs); - mFill = rhs.mFill; - mFillRule = rhs.mFillRule; - mElementName = rhs.mElementName; - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this GraphicalPrimitive2D object. - */ -GraphicalPrimitive2D* -GraphicalPrimitive2D::clone() const -{ - return new GraphicalPrimitive2D(*this); -} - - -/* - * Destructor for GraphicalPrimitive2D. - */ -GraphicalPrimitive2D::~GraphicalPrimitive2D() -{ -} - - -/* - * Returns the value of the "fill" attribute of this GraphicalPrimitive2D. - */ -const std::string& -GraphicalPrimitive2D::getFill() const -{ - return mFill; -} - - -/* - * Returns the value of the "fill-rule" attribute of this GraphicalPrimitive2D. - */ -FillRule_t -GraphicalPrimitive2D::getFillRule() const -{ - return mFillRule; -} - - -/* - * Returns the value of the "fill-rule" attribute of this GraphicalPrimitive2D. - */ -std::string -GraphicalPrimitive2D::getFillRuleAsString() const -{ - std::string code_str = FillRule_toString(mFillRule); - return code_str; -} - - -/* - * Predicate returning @c true if this GraphicalPrimitive2D's "fill" attribute - * is set. - */ -bool -GraphicalPrimitive2D::isSetFill() const -{ - return (mFill.empty() == false); -} - - -/* - * Predicate returning @c true if this GraphicalPrimitive2D's "fill-rule" - * attribute is set. - */ -bool -GraphicalPrimitive2D::isSetFillRule() const -{ - return (mFillRule != FILL_EVENODD_INVALID); -} - - -/* - * Sets the value of the "fill" attribute of this GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setFill(const std::string& fill) -{ - mFill = fill; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setFillRule(const FillRule_t fillRule) -{ - if (FillRule_isValid(fillRule) == 0) - { - mFillRule = FILL_EVENODD_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mFillRule = fillRule; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setFillRule(const std::string& fillRule) -{ - mFillRule = FillRule_fromString(fillRule.c_str()); - - if (mFillRule == FILL_EVENODD_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::unsetFill() -{ - mFill.erase(); - - if (mFill.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::unsetFillRule() -{ - mFillRule = FILL_EVENODD_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type Ellipse - */ -bool -GraphicalPrimitive2D::isEllipse() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type Rectangle - */ -bool -GraphicalPrimitive2D::isRectangle() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type Polygon - */ -bool -GraphicalPrimitive2D::isPolygon() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type RenderGroup - */ -bool -GraphicalPrimitive2D::isRenderGroup() const -{ - return dynamic_cast(this) != NULL; -} - - -/* - * Returns the XML element name of this GraphicalPrimitive2D object. - */ -const std::string& -GraphicalPrimitive2D::getElementName() const -{ - return mElementName; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the XML name of this GraphicalPrimitive2D object. - */ -void -GraphicalPrimitive2D::setElementName(const std::string& name) -{ - mElementName = name; -} - -/** @endcond */ - - -/* - * Returns the libSBML type code for this GraphicalPrimitive2D object. - */ -int -GraphicalPrimitive2D::getTypeCode() const -{ - return SBML_RENDER_GRAPHICALPRIMITIVE2D; -} - - -/* - * Predicate returning @c true if all the required attributes for this - * GraphicalPrimitive2D object have been set. - */ -bool -GraphicalPrimitive2D::hasRequiredAttributes() const -{ - bool allPresent = GraphicalPrimitive1D::hasRequiredAttributes(); - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -GraphicalPrimitive2D::writeElements(XMLOutputStream& stream) const -{ - GraphicalPrimitive1D::writeElements(stream); - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -GraphicalPrimitive2D::accept(SBMLVisitor& v) const -{ - return v.visit(*this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -GraphicalPrimitive2D::setSBMLDocument(SBMLDocument* d) -{ - GraphicalPrimitive1D::setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -GraphicalPrimitive2D::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - GraphicalPrimitive1D::enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::getAttribute(const std::string& attributeName, - bool& value) const -{ - int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::getAttribute(const std::string& attributeName, - int& value) const -{ - int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::getAttribute(const std::string& attributeName, - double& value) const -{ - int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "fill") - { - value = getFill(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "fill-rule") - { - value = getFillRuleAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this GraphicalPrimitive2D's attribute - * "attributeName" is set. - */ -bool -GraphicalPrimitive2D::isSetAttribute(const std::string& attributeName) const -{ - bool value = GraphicalPrimitive1D::isSetAttribute(attributeName); - - if (attributeName == "fill") - { - value = isSetFill(); - } - else if (attributeName == "fill-rule") - { - value = isSetFillRule(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setAttribute(const std::string& attributeName, - bool value) -{ - int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setAttribute(const std::string& attributeName, - int value) -{ - int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setAttribute(const std::string& attributeName, - double value) -{ - int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setAttribute(const std::string& attributeName, - unsigned int value) -{ - int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); - - if (attributeName == "fill") - { - return_value = setFill(value); - } - else if (attributeName == "fill-rule") - { - return_value = setFillRule(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - */ -int -GraphicalPrimitive2D::unsetAttribute(const std::string& attributeName) -{ - int value = GraphicalPrimitive1D::unsetAttribute(attributeName); - - if (attributeName == "fill") - { - value = unsetFill(); - } - else if (attributeName == "fill-rule") - { - value = unsetFillRule(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -GraphicalPrimitive2D::createObject(XMLInputStream& stream) -{ - SBase* obj = GraphicalPrimitive1D::createObject(stream); - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -GraphicalPrimitive2D::addExpectedAttributes(ExpectedAttributes& attributes) -{ - GraphicalPrimitive1D::addExpectedAttributes(attributes); - - attributes.add("fill"); - - attributes.add("fill-rule"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -GraphicalPrimitive2D::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - GraphicalPrimitive1D::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("render", - RenderGraphicalPrimitive2DAllowedAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("render", - RenderGraphicalPrimitive2DAllowedCoreAttributes, pkgVersion, level, - version, details, getLine(), getColumn()); - } - } - } - - // - // fill string (use = "optional" ) - // - - assigned = attributes.readInto("fill", mFill); - - if (assigned == true) - { - if (mFill.empty() == true) - { - logEmptyString(mFill, level, version, ""); - } - } - - // - // fill-rule enum (use = "optional" ) - // - - std::string fillRule; - assigned = attributes.readInto("fill-rule", fillRule); - - if (assigned == true) - { - if (fillRule.empty() == true) - { - logEmptyString(fillRule, level, version, ""); - } - else - { - mFillRule = FillRule_fromString(fillRule.c_str()); - - if (log && FillRule_isValid(mFillRule) == 0) - { - std::string msg = "The fill-rule on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + fillRule + "', which is not a valid option."; - - log->logPackageError("render", - RenderGraphicalPrimitive2DFillRuleMustBeFillRuleEnum, pkgVersion, - level, version, msg, getLine(), getColumn()); - } - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -GraphicalPrimitive2D::writeAttributes(XMLOutputStream& stream) const -{ - GraphicalPrimitive1D::writeAttributes(stream); - - if (isSetFill() == true) - { - stream.writeAttribute("fill", getPrefix(), mFill); - } - - if (isSetFillRule() == true) - { - stream.writeAttribute("fill-rule", getPrefix(), - FillRule_toString(mFillRule)); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new GraphicalPrimitive2D_t using the given SBML Level, Version and - * “render” package version. - */ -LIBSBML_EXTERN -GraphicalPrimitive2D_t * -GraphicalPrimitive2D_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new GraphicalPrimitive2D(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this GraphicalPrimitive2D_t object. - */ -LIBSBML_EXTERN -GraphicalPrimitive2D_t* -GraphicalPrimitive2D_clone(const GraphicalPrimitive2D_t* gpd) -{ - if (gpd != NULL) - { - return static_cast(gpd->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this GraphicalPrimitive2D_t object. - */ -LIBSBML_EXTERN -void -GraphicalPrimitive2D_free(GraphicalPrimitive2D_t* gpd) -{ - if (gpd != NULL) - { - delete gpd; - } -} - - -/* - * Returns the value of the "fill" attribute of this GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -char * -GraphicalPrimitive2D_getFill(const GraphicalPrimitive2D_t * gpd) -{ - if (gpd == NULL) - { - return NULL; - } - - return gpd->getFill().empty() ? NULL : safe_strdup(gpd->getFill().c_str()); -} - - -/* - * Returns the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -FillRule_t -GraphicalPrimitive2D_getFillRule(const GraphicalPrimitive2D_t * gpd) -{ - if (gpd == NULL) - { - return FILL_EVENODD_INVALID; - } - - return gpd->getFillRule(); -} - - -/* - * Returns the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -char * -GraphicalPrimitive2D_getFillRuleAsString(const GraphicalPrimitive2D_t * gpd) -{ - return (char*)(FillRule_toString(gpd->getFillRule())); -} - - -/* - * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill" - * attribute is set. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isSetFill(const GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? static_cast(gpd->isSetFill()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill-rule" - * attribute is set. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isSetFillRule(const GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? static_cast(gpd->isSetFillRule()) : 0; -} - - -/* - * Sets the value of the "fill" attribute of this GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_setFill(GraphicalPrimitive2D_t * gpd, const char * fill) -{ - return (gpd != NULL) ? gpd->setFill(fill) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_setFillRule(GraphicalPrimitive2D_t * gpd, - FillRule_t fillRule) -{ - return (gpd != NULL) ? gpd->setFillRule(fillRule) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_setFillRuleAsString(GraphicalPrimitive2D_t * gpd, - const char * fillRule) -{ - return (gpd != NULL) ? gpd->setFillRule(fillRule): LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_unsetFill(GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? gpd->unsetFill() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_unsetFillRule(GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? gpd->unsetFillRule() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Ellipse_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isEllipse(const GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? static_cast(gpd->isEllipse()) : 0; -} - - -/* - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type - * Rectangle_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isRectangle(const GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? static_cast(gpd->isRectangle()) : 0; -} - - -/* - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Polygon_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isPolygon(const GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? static_cast(gpd->isPolygon()) : 0; -} - - -/* - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type - * RenderGroup_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isRenderGroup(const GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? static_cast(gpd->isRenderGroup()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * GraphicalPrimitive2D_t object have been set. - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_hasRequiredAttributes(const GraphicalPrimitive2D_t * gpd) -{ - return (gpd != NULL) ? static_cast(gpd->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file GraphicalPrimitive2D.cpp + * @brief Implementation of the GraphicalPrimitive2D class. + * @author SBMLTeam + * + * + */ +#include +#include + +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new GraphicalPrimitive2D using the given SBML Level, Version and + * “render” package version. + */ +GraphicalPrimitive2D::GraphicalPrimitive2D(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : GraphicalPrimitive1D(level, version, pkgVersion) + , mFill ("") + , mFillRule (FILL_EVENODD_INVALID) + , mElementName("graphicalPrimitive2D") +{ + setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level, version, pkgVersion)); +} + + +/* + * Creates a new GraphicalPrimitive2D using the given RenderPkgNamespaces + * object. + */ +GraphicalPrimitive2D::GraphicalPrimitive2D(RenderPkgNamespaces *renderns) + : GraphicalPrimitive1D(renderns) + , mFill ("") + , mFillRule (FILL_EVENODD_INVALID) + , mElementName("graphicalPrimitive2D") +{ + setElementNamespace(renderns->getURI()); + loadPlugins(renderns); +} + + +/* + * Copy constructor for GraphicalPrimitive2D. + */ +GraphicalPrimitive2D::GraphicalPrimitive2D(const GraphicalPrimitive2D& orig) + : GraphicalPrimitive1D( orig ) + , mFill ( orig.mFill ) + , mFillRule ( orig.mFillRule ) + , mElementName ( orig.mElementName ) +{ +} + + +/* + * Assignment operator for GraphicalPrimitive2D. + */ +GraphicalPrimitive2D& +GraphicalPrimitive2D::operator=(const GraphicalPrimitive2D& rhs) +{ + if (&rhs != this) + { + GraphicalPrimitive1D::operator=(rhs); + mFill = rhs.mFill; + mFillRule = rhs.mFillRule; + mElementName = rhs.mElementName; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this GraphicalPrimitive2D object. + */ +GraphicalPrimitive2D* +GraphicalPrimitive2D::clone() const +{ + return new GraphicalPrimitive2D(*this); +} + + +/* + * Destructor for GraphicalPrimitive2D. + */ +GraphicalPrimitive2D::~GraphicalPrimitive2D() +{ +} + + +/* + * Returns the value of the "fill" attribute of this GraphicalPrimitive2D. + */ +const std::string& +GraphicalPrimitive2D::getFill() const +{ + return mFill; +} + + +/* + * Returns the value of the "fill-rule" attribute of this GraphicalPrimitive2D. + */ +FillRule_t +GraphicalPrimitive2D::getFillRule() const +{ + return mFillRule; +} + + +/* + * Returns the value of the "fill-rule" attribute of this GraphicalPrimitive2D. + */ +std::string +GraphicalPrimitive2D::getFillRuleAsString() const +{ + std::string code_str = FillRule_toString(mFillRule); + return code_str; +} + + +/* + * Predicate returning @c true if this GraphicalPrimitive2D's "fill" attribute + * is set. + */ +bool +GraphicalPrimitive2D::isSetFill() const +{ + return (mFill.empty() == false); +} + + +/* + * Predicate returning @c true if this GraphicalPrimitive2D's "fill-rule" + * attribute is set. + */ +bool +GraphicalPrimitive2D::isSetFillRule() const +{ + return (mFillRule != FILL_EVENODD_INVALID); +} + + +/* + * Sets the value of the "fill" attribute of this GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setFill(const std::string& fill) +{ + mFill = fill; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setFillRule(const FillRule_t fillRule) +{ + if (FillRule_isValid(fillRule) == 0) + { + mFillRule = FILL_EVENODD_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mFillRule = fillRule; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setFillRule(const std::string& fillRule) +{ + mFillRule = FillRule_fromString(fillRule.c_str()); + + if (mFillRule == FILL_EVENODD_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::unsetFill() +{ + mFill.erase(); + + if (mFill.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::unsetFillRule() +{ + mFillRule = FILL_EVENODD_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type Ellipse + */ +bool +GraphicalPrimitive2D::isEllipse() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type Rectangle + */ +bool +GraphicalPrimitive2D::isRectangle() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type Polygon + */ +bool +GraphicalPrimitive2D::isPolygon() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type RenderGroup + */ +bool +GraphicalPrimitive2D::isRenderGroup() const +{ + return dynamic_cast(this) != NULL; +} + + +/* + * Returns the XML element name of this GraphicalPrimitive2D object. + */ +const std::string& +GraphicalPrimitive2D::getElementName() const +{ + return mElementName; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the XML name of this GraphicalPrimitive2D object. + */ +void +GraphicalPrimitive2D::setElementName(const std::string& name) +{ + mElementName = name; +} + +/** @endcond */ + + +/* + * Returns the libSBML type code for this GraphicalPrimitive2D object. + */ +int +GraphicalPrimitive2D::getTypeCode() const +{ + return SBML_RENDER_GRAPHICALPRIMITIVE2D; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * GraphicalPrimitive2D object have been set. + */ +bool +GraphicalPrimitive2D::hasRequiredAttributes() const +{ + bool allPresent = GraphicalPrimitive1D::hasRequiredAttributes(); + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +GraphicalPrimitive2D::writeElements(XMLOutputStream& stream) const +{ + GraphicalPrimitive1D::writeElements(stream); + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +GraphicalPrimitive2D::accept(SBMLVisitor& v) const +{ + return v.visit(*this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +GraphicalPrimitive2D::setSBMLDocument(SBMLDocument* d) +{ + GraphicalPrimitive1D::setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +GraphicalPrimitive2D::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + GraphicalPrimitive1D::enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = GraphicalPrimitive1D::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "fill") + { + value = getFill(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "fill-rule") + { + value = getFillRuleAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this GraphicalPrimitive2D's attribute + * "attributeName" is set. + */ +bool +GraphicalPrimitive2D::isSetAttribute(const std::string& attributeName) const +{ + bool value = GraphicalPrimitive1D::isSetAttribute(attributeName); + + if (attributeName == "fill") + { + value = isSetFill(); + } + else if (attributeName == "fill-rule") + { + value = isSetFillRule(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setAttribute(const std::string& attributeName, + bool value) +{ + int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setAttribute(const std::string& attributeName, + int value) +{ + int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setAttribute(const std::string& attributeName, + double value) +{ + int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = GraphicalPrimitive1D::setAttribute(attributeName, value); + + if (attributeName == "fill") + { + return_value = setFill(value); + } + else if (attributeName == "fill-rule") + { + return_value = setFillRule(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + */ +int +GraphicalPrimitive2D::unsetAttribute(const std::string& attributeName) +{ + int value = GraphicalPrimitive1D::unsetAttribute(attributeName); + + if (attributeName == "fill") + { + value = unsetFill(); + } + else if (attributeName == "fill-rule") + { + value = unsetFillRule(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +GraphicalPrimitive2D::createObject(XMLInputStream& stream) +{ + SBase* obj = GraphicalPrimitive1D::createObject(stream); + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +GraphicalPrimitive2D::addExpectedAttributes(ExpectedAttributes& attributes) +{ + GraphicalPrimitive1D::addExpectedAttributes(attributes); + + attributes.add("fill"); + + attributes.add("fill-rule"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +GraphicalPrimitive2D::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& + expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + GraphicalPrimitive1D::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("render", + RenderGraphicalPrimitive2DAllowedAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("render", + RenderGraphicalPrimitive2DAllowedCoreAttributes, pkgVersion, level, + version, details, getLine(), getColumn()); + } + } + } + + // + // fill string (use = "optional" ) + // + + assigned = attributes.readInto("fill", mFill); + + if (assigned == true) + { + if (mFill.empty() == true) + { + logEmptyString(mFill, level, version, ""); + } + } + + // + // fill-rule enum (use = "optional" ) + // + + std::string fillRule; + assigned = attributes.readInto("fill-rule", fillRule); + + if (assigned == true) + { + if (fillRule.empty() == true) + { + logEmptyString(fillRule, level, version, ""); + } + else + { + mFillRule = FillRule_fromString(fillRule.c_str()); + + if (log && FillRule_isValid(mFillRule) == 0) + { + std::string msg = "The fill-rule on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + fillRule + "', which is not a valid option."; + + log->logPackageError("render", + RenderGraphicalPrimitive2DFillRuleMustBeFillRuleEnum, pkgVersion, + level, version, msg, getLine(), getColumn()); + } + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +GraphicalPrimitive2D::writeAttributes(XMLOutputStream& stream) const +{ + GraphicalPrimitive1D::writeAttributes(stream); + + if (isSetFill() == true) + { + stream.writeAttribute("fill", getPrefix(), mFill); + } + + if (isSetFillRule() == true) + { + stream.writeAttribute("fill-rule", getPrefix(), + FillRule_toString(mFillRule)); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new GraphicalPrimitive2D_t using the given SBML Level, Version and + * “render” package version. + */ +LIBSBML_EXTERN +GraphicalPrimitive2D_t * +GraphicalPrimitive2D_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new GraphicalPrimitive2D(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this GraphicalPrimitive2D_t object. + */ +LIBSBML_EXTERN +GraphicalPrimitive2D_t* +GraphicalPrimitive2D_clone(const GraphicalPrimitive2D_t* gpd) +{ + if (gpd != NULL) + { + return static_cast(gpd->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this GraphicalPrimitive2D_t object. + */ +LIBSBML_EXTERN +void +GraphicalPrimitive2D_free(GraphicalPrimitive2D_t* gpd) +{ + if (gpd != NULL) + { + delete gpd; + } +} + + +/* + * Returns the value of the "fill" attribute of this GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +char * +GraphicalPrimitive2D_getFill(const GraphicalPrimitive2D_t * gpd) +{ + if (gpd == NULL) + { + return NULL; + } + + return gpd->getFill().empty() ? NULL : safe_strdup(gpd->getFill().c_str()); +} + + +/* + * Returns the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +FillRule_t +GraphicalPrimitive2D_getFillRule(const GraphicalPrimitive2D_t * gpd) +{ + if (gpd == NULL) + { + return FILL_EVENODD_INVALID; + } + + return gpd->getFillRule(); +} + + +/* + * Returns the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +char * +GraphicalPrimitive2D_getFillRuleAsString(const GraphicalPrimitive2D_t * gpd) +{ + return (char*)(FillRule_toString(gpd->getFillRule())); +} + + +/* + * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill" + * attribute is set. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isSetFill(const GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? static_cast(gpd->isSetFill()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill-rule" + * attribute is set. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isSetFillRule(const GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? static_cast(gpd->isSetFillRule()) : 0; +} + + +/* + * Sets the value of the "fill" attribute of this GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_setFill(GraphicalPrimitive2D_t * gpd, const char * fill) +{ + return (gpd != NULL) ? gpd->setFill(fill) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_setFillRule(GraphicalPrimitive2D_t * gpd, + FillRule_t fillRule) +{ + return (gpd != NULL) ? gpd->setFillRule(fillRule) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_setFillRuleAsString(GraphicalPrimitive2D_t * gpd, + const char * fillRule) +{ + return (gpd != NULL) ? gpd->setFillRule(fillRule): LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_unsetFill(GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? gpd->unsetFill() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_unsetFillRule(GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? gpd->unsetFillRule() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Ellipse_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isEllipse(const GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? static_cast(gpd->isEllipse()) : 0; +} + + +/* + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type + * Rectangle_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isRectangle(const GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? static_cast(gpd->isRectangle()) : 0; +} + + +/* + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Polygon_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isPolygon(const GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? static_cast(gpd->isPolygon()) : 0; +} + + +/* + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type + * RenderGroup_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isRenderGroup(const GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? static_cast(gpd->isRenderGroup()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * GraphicalPrimitive2D_t object have been set. + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_hasRequiredAttributes(const GraphicalPrimitive2D_t * gpd) +{ + return (gpd != NULL) ? static_cast(gpd->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.h b/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.h index 73b9e720..39ecf72f 100644 --- a/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.h +++ b/generator/tests/test_cpp_code/test-code/GraphicalPrimitive2D.h @@ -1,1115 +1,1115 @@ -/** - * @file GraphicalPrimitive2D.h - * @brief Definition of the GraphicalPrimitive2D class. - * @author SBMLTeam - * - * - * - * @class GraphicalPrimitive2D - * @sbmlbrief{render} TODO:Definition of the GraphicalPrimitive2D class. - */ - -/** - * - * - * - * @class doc_graphicalprimitive2d_fill-rule - * - * @par - * The attribute "fill-rule" on a GraphicalPrimitive2D object is used to - * TODO:add explanation - * - * In the SBML - * Level 3 Version 1 Render specification, the following are the - * allowable values for "fill-rule": - *
    - *
  • @c "nonzero", TODO:add description - * - *
  • @c "evenodd", TODO:add description - * - *
- */ - - -#ifndef GraphicalPrimitive2D_H__ -#define GraphicalPrimitive2D_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class Ellipse; -class Rectangle; -class Polygon; -class RenderGroup; - -class LIBSBML_EXTERN GraphicalPrimitive2D : public GraphicalPrimitive1D -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - std::string mFill; - FillRule_t mFillRule; - std::string mElementName; - - /** @endcond */ - -public: - - /** - * Creates a new GraphicalPrimitive2D using the given SBML Level, Version and - * “render” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GraphicalPrimitive2D. - * - * @param version an unsigned int, the SBML Version to assign to this - * GraphicalPrimitive2D. - * - * @param pkgVersion an unsigned int, the SBML Render Version to assign to - * this GraphicalPrimitive2D. - * - * @copydetails doc_note_setting_lv_pkg - */ - GraphicalPrimitive2D(unsigned int level = RenderExtension::getDefaultLevel(), - unsigned int version = - RenderExtension::getDefaultVersion(), - unsigned int pkgVersion = - RenderExtension::getDefaultPackageVersion()); - - - /** - * Creates a new GraphicalPrimitive2D using the given RenderPkgNamespaces - * object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param renderns the RenderPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - GraphicalPrimitive2D(RenderPkgNamespaces *renderns); - - - /** - * Copy constructor for GraphicalPrimitive2D. - * - * @param orig the GraphicalPrimitive2D instance to copy. - */ - GraphicalPrimitive2D(const GraphicalPrimitive2D& orig); - - - /** - * Assignment operator for GraphicalPrimitive2D. - * - * @param rhs the GraphicalPrimitive2D object whose values are to be used as - * the basis of the assignment. - */ - GraphicalPrimitive2D& operator=(const GraphicalPrimitive2D& rhs); - - - /** - * Creates and returns a deep copy of this GraphicalPrimitive2D object. - * - * @return a (deep) copy of this GraphicalPrimitive2D object. - */ - virtual GraphicalPrimitive2D* clone() const; - - - /** - * Destructor for GraphicalPrimitive2D. - */ - virtual ~GraphicalPrimitive2D(); - - - /** - * Returns the value of the "fill" attribute of this GraphicalPrimitive2D. - * - * @return the value of the "fill" attribute of this GraphicalPrimitive2D as - * a string. - */ - const std::string& getFill() const; - - - /** - * Returns the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D. - * - * @return the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D as a FillRule_t. - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * @if clike The value is drawn from the enumeration @ref FillRule_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{FILL_RULE_NONZERO, FillRule_t} - * @li @sbmlconstant{FILL_RULE_EVENODD, FillRule_t} - * @li @sbmlconstant{FILL_EVENODD_INVALID, FillRule_t} - */ - FillRule_t getFillRule() const; - - - /** - * Returns the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D. - * - * @return the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D as a string. - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * The possible values returned by this method are: - * @li @c "nonzero" - * @li @c "evenodd" - * @li @c "invalid FillRule value" - */ - std::string getFillRuleAsString() const; - - - /** - * Predicate returning @c true if this GraphicalPrimitive2D's "fill" - * attribute is set. - * - * @return @c true if this GraphicalPrimitive2D's "fill" attribute has been - * set, otherwise @c false is returned. - */ - bool isSetFill() const; - - - /** - * Predicate returning @c true if this GraphicalPrimitive2D's "fill-rule" - * attribute is set. - * - * @return @c true if this GraphicalPrimitive2D's "fill-rule" attribute has - * been set, otherwise @c false is returned. - * - * @copydetails doc_graphicalprimitive2d_fill-rule - */ - bool isSetFillRule() const; - - - /** - * Sets the value of the "fill" attribute of this GraphicalPrimitive2D. - * - * @param fill std::string& value of the "fill" attribute to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p fill = @c NULL or an empty string is - * equivalent to calling unsetFill(). - */ - int setFill(const std::string& fill); - - - /** - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. - * - * @param fillRule @if clike FillRule_t@else int@endif value of the - * "fill-rule" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_graphicalprimitive2d_fill-rule - */ - int setFillRule(const FillRule_t fillRule); - - - /** - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. - * - * @param fillRule std::string& of the "fill-rule" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_graphicalprimitive2d_fill-rule - */ - int setFillRule(const std::string& fillRule); - - - /** - * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - int unsetFill(); - - - /** - * Unsets the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_graphicalprimitive2d_fill-rule - */ - int unsetFillRule(); - - - /** - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type Ellipse - * - * @return @c true if this abstract "GraphicalPrimitive2D" is of type - * Ellipse, @c false otherwise - */ - virtual bool isEllipse() const; - - - /** - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type Rectangle - * - * @return @c true if this abstract "GraphicalPrimitive2D" is of type - * Rectangle, @c false otherwise - */ - virtual bool isRectangle() const; - - - /** - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type Polygon - * - * @return @c true if this abstract "GraphicalPrimitive2D" is of type - * Polygon, @c false otherwise - */ - virtual bool isPolygon() const; - - - /** - * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of - * type RenderGroup - * - * @return @c true if this abstract "GraphicalPrimitive2D" is of type - * RenderGroup, @c false otherwise - */ - virtual bool isRenderGroup() const; - - - /** - * Returns the XML element name of this GraphicalPrimitive2D object. - * - * For GraphicalPrimitive2D, the XML element name is always - * @c "graphicalPrimitive2D". - * - * @return the name of this element, i.e. @c "graphicalPrimitive2D". - */ - virtual const std::string& getElementName() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the XML name of this GraphicalPrimitive2D object. - */ - virtual void setElementName(const std::string& name); - - /** @endcond */ - - - /** - * Returns the libSBML type code for this GraphicalPrimitive2D object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_RENDER_GRAPHICALPRIMITIVE2D, SBMLRenderTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this - * GraphicalPrimitive2D object have been set. - * - * @return @c true to indicate that all the required attributes of this - * GraphicalPrimitive2D have been set, otherwise @c false is returned. - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this GraphicalPrimitive2D's attribute - * "attributeName" is set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this GraphicalPrimitive2D's attribute "attributeName" - * has been set, otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this - * GraphicalPrimitive2D. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new GraphicalPrimitive2D_t using the given SBML Level, Version and - * “render” package version. - * - * @param level an unsigned int, the SBML Level to assign to this - * GraphicalPrimitive2D_t. - * - * @param version an unsigned int, the SBML Version to assign to this - * GraphicalPrimitive2D_t. - * - * @param pkgVersion an unsigned int, the SBML Render Version to assign to this - * GraphicalPrimitive2D_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -GraphicalPrimitive2D_t * -GraphicalPrimitive2D_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this GraphicalPrimitive2D_t object. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return a (deep) copy of this GraphicalPrimitive2D_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -GraphicalPrimitive2D_t* -GraphicalPrimitive2D_clone(const GraphicalPrimitive2D_t* gpd); - - -/** - * Frees this GraphicalPrimitive2D_t object. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -void -GraphicalPrimitive2D_free(GraphicalPrimitive2D_t* gpd); - - -/** - * Returns the value of the "fill" attribute of this GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure whose fill is sought. - * - * @return the value of the "fill" attribute of this GraphicalPrimitive2D_t as - * a pointer to a string. - * - * @copydetails doc_returned_owned_char - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -char * -GraphicalPrimitive2D_getFill(const GraphicalPrimitive2D_t * gpd); - - -/** - * Returns the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure whose fill-rule is sought. - * - * @return the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t as a FillRule_t. - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * @if clike The value is drawn from the enumeration @ref FillRule_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{FILL_RULE_NONZERO, FillRule_t} - * @li @sbmlconstant{FILL_RULE_EVENODD, FillRule_t} - * @li @sbmlconstant{FILL_EVENODD_INVALID, FillRule_t} - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -FillRule_t -GraphicalPrimitive2D_getFillRule(const GraphicalPrimitive2D_t * gpd); - - -/** - * Returns the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure whose fill-rule is sought. - * - * @return the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t as a const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * The possible values returned by this method are: - * @li @c "nonzero" - * @li @c "evenodd" - * @li @c "invalid FillRule value" - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -char * -GraphicalPrimitive2D_getFillRuleAsString(const GraphicalPrimitive2D_t * gpd); - - -/** - * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill" - * attribute is set. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return @c 1 (true) if this GraphicalPrimitive2D_t's "fill" attribute has - * been set, otherwise @c 0 (false) is returned. - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isSetFill(const GraphicalPrimitive2D_t * gpd); - - -/** - * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill-rule" - * attribute is set. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return @c 1 (true) if this GraphicalPrimitive2D_t's "fill-rule" attribute - * has been set, otherwise @c 0 (false) is returned. - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isSetFillRule(const GraphicalPrimitive2D_t * gpd); - - -/** - * Sets the value of the "fill" attribute of this GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @param fill const char * value of the "fill" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p fill = @c NULL or an empty string is - * equivalent to calling GraphicalPrimitive2D_unsetFill(). - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_setFill(GraphicalPrimitive2D_t * gpd, const char * fill); - - -/** - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @param fillRule FillRule_t value of the "fill-rule" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_setFillRule(GraphicalPrimitive2D_t * gpd, - FillRule_t fillRule); - - -/** - * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @param fillRule const char * of the "fill-rule" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_setFillRuleAsString(GraphicalPrimitive2D_t * gpd, - const char * fillRule); - - -/** - * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_unsetFill(GraphicalPrimitive2D_t * gpd); - - -/** - * Unsets the value of the "fill-rule" attribute of this - * GraphicalPrimitive2D_t. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_graphicalprimitive2d_fill-rule - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_unsetFillRule(GraphicalPrimitive2D_t * gpd); - - -/** - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Ellipse_t - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return @c 1 if this GraphicalPrimitive2D_t is of type Ellipse_t, @c 0 - * otherwise - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isEllipse(const GraphicalPrimitive2D_t * gpd); - - -/** - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type - * Rectangle_t - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return @c 1 if this GraphicalPrimitive2D_t is of type Rectangle_t, @c 0 - * otherwise - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isRectangle(const GraphicalPrimitive2D_t * gpd); - - -/** - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Polygon_t - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return @c 1 if this GraphicalPrimitive2D_t is of type Polygon_t, @c 0 - * otherwise - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isPolygon(const GraphicalPrimitive2D_t * gpd); - - -/** - * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type - * RenderGroup_t - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return @c 1 if this GraphicalPrimitive2D_t is of type RenderGroup_t, @c 0 - * otherwise - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_isRenderGroup(const GraphicalPrimitive2D_t * gpd); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * GraphicalPrimitive2D_t object have been set. - * - * @param gpd the GraphicalPrimitive2D_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * GraphicalPrimitive2D_t have been set, otherwise @c 0 (false) is returned. - * - * @memberof GraphicalPrimitive2D_t - */ -LIBSBML_EXTERN -int -GraphicalPrimitive2D_hasRequiredAttributes(const GraphicalPrimitive2D_t * gpd); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !GraphicalPrimitive2D_H__ */ - - +/** + * @file GraphicalPrimitive2D.h + * @brief Definition of the GraphicalPrimitive2D class. + * @author SBMLTeam + * + * + * + * @class GraphicalPrimitive2D + * @sbmlbrief{render} TODO:Definition of the GraphicalPrimitive2D class. + */ + +/** + * + * + * + * @class doc_graphicalprimitive2d_fill-rule + * + * @par + * The attribute "fill-rule" on a GraphicalPrimitive2D object is used to + * TODO:add explanation + * + * In the SBML + * Level 3 Version 1 Render specification, the following are the + * allowable values for "fill-rule": + *
    + *
  • @c "nonzero", TODO:add description + * + *
  • @c "evenodd", TODO:add description + * + *
+ */ + + +#ifndef GraphicalPrimitive2D_H__ +#define GraphicalPrimitive2D_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class Ellipse; +class Rectangle; +class Polygon; +class RenderGroup; + +class LIBSBML_EXTERN GraphicalPrimitive2D : public GraphicalPrimitive1D +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + std::string mFill; + FillRule_t mFillRule; + std::string mElementName; + + /** @endcond */ + +public: + + /** + * Creates a new GraphicalPrimitive2D using the given SBML Level, Version and + * “render” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GraphicalPrimitive2D. + * + * @param version an unsigned int, the SBML Version to assign to this + * GraphicalPrimitive2D. + * + * @param pkgVersion an unsigned int, the SBML Render Version to assign to + * this GraphicalPrimitive2D. + * + * @copydetails doc_note_setting_lv_pkg + */ + GraphicalPrimitive2D(unsigned int level = RenderExtension::getDefaultLevel(), + unsigned int version = + RenderExtension::getDefaultVersion(), + unsigned int pkgVersion = + RenderExtension::getDefaultPackageVersion()); + + + /** + * Creates a new GraphicalPrimitive2D using the given RenderPkgNamespaces + * object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param renderns the RenderPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + GraphicalPrimitive2D(RenderPkgNamespaces *renderns); + + + /** + * Copy constructor for GraphicalPrimitive2D. + * + * @param orig the GraphicalPrimitive2D instance to copy. + */ + GraphicalPrimitive2D(const GraphicalPrimitive2D& orig); + + + /** + * Assignment operator for GraphicalPrimitive2D. + * + * @param rhs the GraphicalPrimitive2D object whose values are to be used as + * the basis of the assignment. + */ + GraphicalPrimitive2D& operator=(const GraphicalPrimitive2D& rhs); + + + /** + * Creates and returns a deep copy of this GraphicalPrimitive2D object. + * + * @return a (deep) copy of this GraphicalPrimitive2D object. + */ + virtual GraphicalPrimitive2D* clone() const; + + + /** + * Destructor for GraphicalPrimitive2D. + */ + virtual ~GraphicalPrimitive2D(); + + + /** + * Returns the value of the "fill" attribute of this GraphicalPrimitive2D. + * + * @return the value of the "fill" attribute of this GraphicalPrimitive2D as + * a string. + */ + const std::string& getFill() const; + + + /** + * Returns the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D. + * + * @return the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D as a FillRule_t. + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * @if clike The value is drawn from the enumeration @ref FillRule_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{FILL_RULE_NONZERO, FillRule_t} + * @li @sbmlconstant{FILL_RULE_EVENODD, FillRule_t} + * @li @sbmlconstant{FILL_EVENODD_INVALID, FillRule_t} + */ + FillRule_t getFillRule() const; + + + /** + * Returns the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D. + * + * @return the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D as a string. + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * The possible values returned by this method are: + * @li @c "nonzero" + * @li @c "evenodd" + * @li @c "invalid FillRule value" + */ + std::string getFillRuleAsString() const; + + + /** + * Predicate returning @c true if this GraphicalPrimitive2D's "fill" + * attribute is set. + * + * @return @c true if this GraphicalPrimitive2D's "fill" attribute has been + * set, otherwise @c false is returned. + */ + bool isSetFill() const; + + + /** + * Predicate returning @c true if this GraphicalPrimitive2D's "fill-rule" + * attribute is set. + * + * @return @c true if this GraphicalPrimitive2D's "fill-rule" attribute has + * been set, otherwise @c false is returned. + * + * @copydetails doc_graphicalprimitive2d_fill-rule + */ + bool isSetFillRule() const; + + + /** + * Sets the value of the "fill" attribute of this GraphicalPrimitive2D. + * + * @param fill std::string& value of the "fill" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p fill = @c NULL or an empty string is + * equivalent to calling unsetFill(). + */ + int setFill(const std::string& fill); + + + /** + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. + * + * @param fillRule @if clike FillRule_t@else int@endif value of the + * "fill-rule" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_graphicalprimitive2d_fill-rule + */ + int setFillRule(const FillRule_t fillRule); + + + /** + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D. + * + * @param fillRule std::string& of the "fill-rule" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_graphicalprimitive2d_fill-rule + */ + int setFillRule(const std::string& fillRule); + + + /** + * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetFill(); + + + /** + * Unsets the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_graphicalprimitive2d_fill-rule + */ + int unsetFillRule(); + + + /** + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type Ellipse + * + * @return @c true if this abstract "GraphicalPrimitive2D" is of type + * Ellipse, @c false otherwise + */ + virtual bool isEllipse() const; + + + /** + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type Rectangle + * + * @return @c true if this abstract "GraphicalPrimitive2D" is of type + * Rectangle, @c false otherwise + */ + virtual bool isRectangle() const; + + + /** + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type Polygon + * + * @return @c true if this abstract "GraphicalPrimitive2D" is of type + * Polygon, @c false otherwise + */ + virtual bool isPolygon() const; + + + /** + * Predicate returning @c true if this abstract "GraphicalPrimitive2D" is of + * type RenderGroup + * + * @return @c true if this abstract "GraphicalPrimitive2D" is of type + * RenderGroup, @c false otherwise + */ + virtual bool isRenderGroup() const; + + + /** + * Returns the XML element name of this GraphicalPrimitive2D object. + * + * For GraphicalPrimitive2D, the XML element name is always + * @c "graphicalPrimitive2D". + * + * @return the name of this element, i.e. @c "graphicalPrimitive2D". + */ + virtual const std::string& getElementName() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the XML name of this GraphicalPrimitive2D object. + */ + virtual void setElementName(const std::string& name); + + /** @endcond */ + + + /** + * Returns the libSBML type code for this GraphicalPrimitive2D object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_RENDER_GRAPHICALPRIMITIVE2D, SBMLRenderTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * GraphicalPrimitive2D object have been set. + * + * @return @c true to indicate that all the required attributes of this + * GraphicalPrimitive2D have been set, otherwise @c false is returned. + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this GraphicalPrimitive2D's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this GraphicalPrimitive2D's attribute "attributeName" + * has been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this + * GraphicalPrimitive2D. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new GraphicalPrimitive2D_t using the given SBML Level, Version and + * “render” package version. + * + * @param level an unsigned int, the SBML Level to assign to this + * GraphicalPrimitive2D_t. + * + * @param version an unsigned int, the SBML Version to assign to this + * GraphicalPrimitive2D_t. + * + * @param pkgVersion an unsigned int, the SBML Render Version to assign to this + * GraphicalPrimitive2D_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +GraphicalPrimitive2D_t * +GraphicalPrimitive2D_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this GraphicalPrimitive2D_t object. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return a (deep) copy of this GraphicalPrimitive2D_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +GraphicalPrimitive2D_t* +GraphicalPrimitive2D_clone(const GraphicalPrimitive2D_t* gpd); + + +/** + * Frees this GraphicalPrimitive2D_t object. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +void +GraphicalPrimitive2D_free(GraphicalPrimitive2D_t* gpd); + + +/** + * Returns the value of the "fill" attribute of this GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure whose fill is sought. + * + * @return the value of the "fill" attribute of this GraphicalPrimitive2D_t as + * a pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +char * +GraphicalPrimitive2D_getFill(const GraphicalPrimitive2D_t * gpd); + + +/** + * Returns the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure whose fill-rule is sought. + * + * @return the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t as a FillRule_t. + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * @if clike The value is drawn from the enumeration @ref FillRule_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{FILL_RULE_NONZERO, FillRule_t} + * @li @sbmlconstant{FILL_RULE_EVENODD, FillRule_t} + * @li @sbmlconstant{FILL_EVENODD_INVALID, FillRule_t} + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +FillRule_t +GraphicalPrimitive2D_getFillRule(const GraphicalPrimitive2D_t * gpd); + + +/** + * Returns the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure whose fill-rule is sought. + * + * @return the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t as a const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * The possible values returned by this method are: + * @li @c "nonzero" + * @li @c "evenodd" + * @li @c "invalid FillRule value" + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +char * +GraphicalPrimitive2D_getFillRuleAsString(const GraphicalPrimitive2D_t * gpd); + + +/** + * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill" + * attribute is set. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return @c 1 (true) if this GraphicalPrimitive2D_t's "fill" attribute has + * been set, otherwise @c 0 (false) is returned. + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isSetFill(const GraphicalPrimitive2D_t * gpd); + + +/** + * Predicate returning @c 1 (true) if this GraphicalPrimitive2D_t's "fill-rule" + * attribute is set. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return @c 1 (true) if this GraphicalPrimitive2D_t's "fill-rule" attribute + * has been set, otherwise @c 0 (false) is returned. + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isSetFillRule(const GraphicalPrimitive2D_t * gpd); + + +/** + * Sets the value of the "fill" attribute of this GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @param fill const char * value of the "fill" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p fill = @c NULL or an empty string is + * equivalent to calling GraphicalPrimitive2D_unsetFill(). + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_setFill(GraphicalPrimitive2D_t * gpd, const char * fill); + + +/** + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @param fillRule FillRule_t value of the "fill-rule" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_setFillRule(GraphicalPrimitive2D_t * gpd, + FillRule_t fillRule); + + +/** + * Sets the value of the "fill-rule" attribute of this GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @param fillRule const char * of the "fill-rule" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_setFillRuleAsString(GraphicalPrimitive2D_t * gpd, + const char * fillRule); + + +/** + * Unsets the value of the "fill" attribute of this GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_unsetFill(GraphicalPrimitive2D_t * gpd); + + +/** + * Unsets the value of the "fill-rule" attribute of this + * GraphicalPrimitive2D_t. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_graphicalprimitive2d_fill-rule + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_unsetFillRule(GraphicalPrimitive2D_t * gpd); + + +/** + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Ellipse_t + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return @c 1 if this GraphicalPrimitive2D_t is of type Ellipse_t, @c 0 + * otherwise + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isEllipse(const GraphicalPrimitive2D_t * gpd); + + +/** + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type + * Rectangle_t + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return @c 1 if this GraphicalPrimitive2D_t is of type Rectangle_t, @c 0 + * otherwise + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isRectangle(const GraphicalPrimitive2D_t * gpd); + + +/** + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type Polygon_t + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return @c 1 if this GraphicalPrimitive2D_t is of type Polygon_t, @c 0 + * otherwise + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isPolygon(const GraphicalPrimitive2D_t * gpd); + + +/** + * Predicate returning @c 1 if this GraphicalPrimitive2D_t is of type + * RenderGroup_t + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return @c 1 if this GraphicalPrimitive2D_t is of type RenderGroup_t, @c 0 + * otherwise + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_isRenderGroup(const GraphicalPrimitive2D_t * gpd); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * GraphicalPrimitive2D_t object have been set. + * + * @param gpd the GraphicalPrimitive2D_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * GraphicalPrimitive2D_t have been set, otherwise @c 0 (false) is returned. + * + * @memberof GraphicalPrimitive2D_t + */ +LIBSBML_EXTERN +int +GraphicalPrimitive2D_hasRequiredAttributes(const GraphicalPrimitive2D_t * gpd); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !GraphicalPrimitive2D_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Group.cpp b/generator/tests/test_cpp_code/test-code/Group.cpp index ad42b364..97b3b335 100644 --- a/generator/tests/test_cpp_code/test-code/Group.cpp +++ b/generator/tests/test_cpp_code/test-code/Group.cpp @@ -1,1665 +1,1665 @@ -/** - * @file Group.cpp - * @brief Implementation of the Group class. - * @author SBMLTeam - * - * - */ -#include -#include -#include -#include - - -using namespace std; - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Group using the given SBML Level, Version and - * “groups” package version. - */ -Group::Group(unsigned int level, - unsigned int version, - unsigned int pkgVersion) - : SBase(level, version) - , mKind (GROUP_KIND_INVALID) - , mMembers (level, version, pkgVersion) -{ - setSBMLNamespacesAndOwn(new GroupsPkgNamespaces(level, version, pkgVersion)); - connectToChild(); -} - - -/* - * Creates a new Group using the given GroupsPkgNamespaces object. - */ -Group::Group(GroupsPkgNamespaces *groupsns) - : SBase(groupsns) - , mKind (GROUP_KIND_INVALID) - , mMembers (groupsns) -{ - setElementNamespace(groupsns->getURI()); - connectToChild(); - loadPlugins(groupsns); -} - - -/* - * Copy constructor for Group. - */ -Group::Group(const Group& orig) - : SBase( orig ) - , mKind ( orig.mKind ) - , mMembers ( orig.mMembers ) -{ - connectToChild(); -} - - -/* - * Assignment operator for Group. - */ -Group& -Group::operator=(const Group& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mKind = rhs.mKind; - mMembers = rhs.mMembers; - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Group object. - */ -Group* -Group::clone() const -{ - return new Group(*this); -} - - -/* - * Destructor for Group. - */ -Group::~Group() -{ -} - - -/* - * Returns the value of the "id" attribute of this Group. - */ -const std::string& -Group::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "name" attribute of this Group. - */ -const std::string& -Group::getName() const -{ - return mName; -} - - -/* - * Returns the value of the "kind" attribute of this Group. - */ -GroupKind_t -Group::getKind() const -{ - return mKind; -} - - -/* - * Returns the value of the "kind" attribute of this Group. - */ -std::string -Group::getKindAsString() const -{ - std::string code_str = GroupKind_toString(mKind); - return code_str; -} - - -/* - * Predicate returning @c true if this Group's "id" attribute is set. - */ -bool -Group::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this Group's "name" attribute is set. - */ -bool -Group::isSetName() const -{ - return (mName.empty() == false); -} - - -/* - * Predicate returning @c true if this Group's "kind" attribute is set. - */ -bool -Group::isSetKind() const -{ - return (mKind != GROUP_KIND_INVALID); -} - - -/* - * Sets the value of the "id" attribute of this Group. - */ -int -Group::setId(const std::string& id) -{ - return SyntaxChecker::checkAndSetSId(id, mId); -} - - -/* - * Sets the value of the "name" attribute of this Group. - */ -int -Group::setName(const std::string& name) -{ - mName = name; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Sets the value of the "kind" attribute of this Group. - */ -int -Group::setKind(const GroupKind_t kind) -{ - if (GroupKind_isValid(kind) == 0) - { - mKind = GROUP_KIND_INVALID; - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - else - { - mKind = kind; - return LIBSBML_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "kind" attribute of this Group. - */ -int -Group::setKind(const std::string& kind) -{ - mKind = GroupKind_fromString(kind.c_str()); - - if (mKind == GROUP_KIND_INVALID) - { - return LIBSBML_INVALID_ATTRIBUTE_VALUE; - } - - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this Group. - */ -int -Group::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "name" attribute of this Group. - */ -int -Group::unsetName() -{ - mName.erase(); - - if (mName.empty() == true) - { - return LIBSBML_OPERATION_SUCCESS; - } - else - { - return LIBSBML_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "kind" attribute of this Group. - */ -int -Group::unsetKind() -{ - mKind = GROUP_KIND_INVALID; - return LIBSBML_OPERATION_SUCCESS; -} - - -/* - * Returns the ListOfMembers from this Group. - */ -const ListOfMembers* -Group::getListOfMembers() const -{ - return &mMembers; -} - - -/* - * Returns the ListOfMembers from this Group. - */ -ListOfMembers* -Group::getListOfMembers() -{ - return &mMembers; -} - - -/* - * Get a Member from the Group. - */ -Member* -Group::getMember(unsigned int n) -{ - return mMembers.get(n); -} - - -/* - * Get a Member from the Group. - */ -const Member* -Group::getMember(unsigned int n) const -{ - return mMembers.get(n); -} - - -/* - * Get a Member from the Group based on its identifier. - */ -Member* -Group::getMember(const std::string& sid) -{ - return mMembers.get(sid); -} - - -/* - * Get a Member from the Group based on its identifier. - */ -const Member* -Group::getMember(const std::string& sid) const -{ - return mMembers.get(sid); -} - - -/* - * Get a Member from the Group based on the element to which it refers. - */ -const Member* -Group::getMemberByIdRef(const std::string& sid) const -{ - return mMembers.getByIdRef(sid); -} - - -/* - * Get a Member from the Group based on the element to which it refers. - */ -Member* -Group::getMemberByIdRef(const std::string& sid) -{ - return mMembers.getByIdRef(sid); -} - - -/* - * Adds a copy of the given Member to this Group. - */ -int -Group::addMember(const Member* m) -{ - if (m == NULL) - { - return LIBSBML_OPERATION_FAILED; - } - else if (m->hasRequiredAttributes() == false) - { - return LIBSBML_INVALID_OBJECT; - } - else if (getLevel() != m->getLevel()) - { - return LIBSBML_LEVEL_MISMATCH; - } - else if (getVersion() != m->getVersion()) - { - return LIBSBML_VERSION_MISMATCH; - } - else if (matchesRequiredSBMLNamespacesForAddition(static_cast(m)) == false) - { - return LIBSBML_NAMESPACES_MISMATCH; - } - else if (m->isSetId() && (mMembers.get(m->getId())) != NULL) - { - return LIBSBML_DUPLICATE_OBJECT_ID; - } - else - { - return mMembers.append(m); - } -} - - -/* - * Get the number of Member objects in this Group. - */ -unsigned int -Group::getNumMembers() const -{ - return mMembers.size(); -} - - -/* - * Creates a new Member object, adds it to this Group object and returns the - * Member object created. - */ -Member* -Group::createMember() -{ - Member* m = NULL; - - try - { - GROUPS_CREATE_NS(groupsns, getSBMLNamespaces()); - m = new Member(groupsns); - delete groupsns; - } - catch (...) - { - } - - if (m != NULL) - { - mMembers.appendAndOwn(m); - } - - return m; -} - - -/* - * Removes the nth Member from this Group and returns a pointer to it. - */ -Member* -Group::removeMember(unsigned int n) -{ - return mMembers.remove(n); -} - - -/* - * Removes the Member from this Group based on its identifier and returns a - * pointer to it. - */ -Member* -Group::removeMember(const std::string& sid) -{ - return mMembers.remove(sid); -} - - -/* - * Returns the XML element name of this Group object. - */ -const std::string& -Group::getElementName() const -{ - static const string name = "group"; - return name; -} - - -/* - * Returns the libSBML type code for this Group object. - */ -int -Group::getTypeCode() const -{ - return SBML_GROUPS_GROUP; -} - - -/* - * Predicate returning @c true if all the required attributes for this Group - * object have been set. - */ -bool -Group::hasRequiredAttributes() const -{ - bool allPresent = true; - - if (isSetKind() == false) - { - allPresent = false; - } - - return allPresent; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Write any contained elements - */ -void -Group::writeElements(XMLOutputStream& stream) const -{ - SBase::writeElements(stream); - - if (getNumMembers() > 0) - { - mMembers.write(stream); - } - - SBase::writeExtensionElements(stream); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Accepts the given SBMLVisitor - */ -bool -Group::accept(SBMLVisitor& v) const -{ - v.visit(*this); - - mMembers.accept(v); - - v.leave(*this); - return true; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the parent SBMLDocument - */ -void -Group::setSBMLDocument(SBMLDocument* d) -{ - SBase::setSBMLDocument(d); - - mMembers.setSBMLDocument(d); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Connects to child elements - */ -void -Group::connectToChild() -{ - SBase::connectToChild(); - - mMembers.connectToParent(this); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Enables/disables the given package with this element - */ -void -Group::enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag) -{ - SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); - - mMembers.enablePackageInternal(pkgURI, pkgPrefix, flag); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Updates the namespaces when setLevelVersion is used - */ -void -Group::updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version) -{ - SBase::updateSBMLNamespace(package, level, version); - - mMembers.updateSBMLNamespace(package, level, version); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Group. - */ -int -Group::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Group. - */ -int -Group::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Group. - */ -int -Group::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Group. - */ -int -Group::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Group. - */ -int -Group::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBML_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "name") - { - value = getName(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - else if (attributeName == "kind") - { - value = getKindAsString(); - return_value = LIBSBML_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Predicate returning @c true if this Group's attribute "attributeName" is - * set. - */ -bool -Group::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "name") - { - value = isSetName(); - } - else if (attributeName == "kind") - { - value = isSetKind(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Group. - */ -int -Group::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Group. - */ -int -Group::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Group. - */ -int -Group::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Group. - */ -int -Group::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Group. - */ -int -Group::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "name") - { - return_value = setName(value); - } - else if (attributeName == "kind") - { - return_value = setKind(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Group. - */ -int -Group::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "name") - { - value = unsetName(); - } - else if (attributeName == "kind") - { - value = unsetKind(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates and returns an new "elementName" object in this Group. - */ -SBase* -Group::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "member") - { - return createMember(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds a new "elementName" object to this Group. - */ -int -Group::addChildObject(const std::string& elementName, const SBase* element) -{ - if (elementName == "member" && element->getTypeCode() == SBML_GROUPS_MEMBER) - { - return addMember((const Member*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Group. - */ -SBase* -Group::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "member") - { - return removeMember(id); - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the number of "elementName" in this Group. - */ -unsigned int -Group::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "member") - { - return getNumMembers(); - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Returns the nth object of "objectName" in this Group. - */ -SBase* -Group::getObject(const std::string& elementName, unsigned int index) -{ - SBase* obj = NULL; - - if (elementName == "member") - { - return getMember(index); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SBase* -Group::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mMembers.getId() == id) - { - return &mMembers; - } - - obj = mMembers.getElementBySId(id); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns the first child element that has the given @p metaid, or @c NULL if - * no such object is found. - */ -SBase* -Group::getElementByMetaId(const std::string& metaid) -{ - if (metaid.empty()) - { - return NULL; - } - - SBase* obj = NULL; - - if (mMembers.getMetaId() == metaid) - { - return &mMembers; - } - - obj = mMembers.getElementByMetaId(metaid); - - if (obj != NULL) - { - return obj; - } - - return obj; -} - - -/* - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - */ -List* -Group::getAllElements(ElementFilter* filter) -{ - List* ret = new List(); - List* sublist = NULL; - - - ADD_FILTERED_LIST(ret, sublist, mMembers, filter); - - ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); - - return ret; -} - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SBase* -Group::createObject(XMLInputStream& stream) -{ - SBase* obj = NULL; - - const std::string& name = stream.peek().getName(); - - if (name == "listOfMembers") - { - if (getErrorLog() && mMembers.size() != 0) - { - getErrorLog()->logPackageError("groups", GroupsGroupAllowedElements, - getPackageVersion(), getLevel(), getVersion(), "", getLine(), - getColumn()); - } - - obj = &mMembers; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Group::addExpectedAttributes(ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("name"); - - attributes.add("kind"); -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Group::readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int pkgVersion = getPackageVersion(); - unsigned int numErrs; - bool assigned = false; - SBMLErrorLog* log = getErrorLog(); - - if (log && getParentSBMLObject() && - static_cast(getParentSBMLObject())->size() < 2) - { - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("groups", GroupsModelLOGroupsAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("groups", - GroupsModelLOGroupsAllowedCoreAttributes, pkgVersion, level, version, - details, getLine(), getColumn()); - } - } - } - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == UnknownPackageAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownPackageAttribute); - log->logPackageError("groups", GroupsGroupAllowedAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(UnknownCoreAttribute); - log->logPackageError("groups", GroupsGroupAllowedCoreAttributes, - pkgVersion, level, version, details, getLine(), getColumn()); - } - } - } - - // - // id SId (use = "optional" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, ""); - } - else if (SyntaxChecker::isValidSBMLSId(mId) == false) - { - log->logPackageError("groups", GroupsIdSyntaxRule, pkgVersion, level, - version, "The id on the <" + getElementName() + "> is '" + mId + "', " - "which does not conform to the syntax.", getLine(), getColumn()); - } - } - - // - // name string (use = "optional" ) - // - - assigned = attributes.readInto("name", mName); - - if (assigned == true) - { - if (mName.empty() == true) - { - logEmptyString(mName, level, version, ""); - } - } - - // - // kind enum (use = "required" ) - // - - std::string kind; - assigned = attributes.readInto("kind", kind); - - if (assigned == true) - { - if (kind.empty() == true) - { - logEmptyString(kind, level, version, ""); - } - else - { - mKind = GroupKind_fromString(kind.c_str()); - - if (log && GroupKind_isValid(mKind) == 0) - { - std::string msg = "The kind on the "; - - if (isSetId()) - { - msg += "with id '" + getId() + "'"; - } - - msg += "is '" + kind + "', which is not a valid option."; - - log->logPackageError("groups", GroupsGroupKindMustBeGroupKindEnum, - pkgVersion, level, version, msg, getLine(), getColumn()); - } - } - } - else - { - if (log) - { - std::string message = "Groups attribute 'kind' is missing."; - log->logPackageError("groups", GroupsGroupAllowedAttributes, pkgVersion, - level, version, message, getLine(), getColumn()); - } - } -} - -/** @endcond */ - - - -/** @cond doxygenLibsbmlInternal */ - -/* - * Writes the attributes to the stream - */ -void -Group::writeAttributes(XMLOutputStream& stream) const -{ - SBase::writeAttributes(stream); - - if (isSetId() == true) - { - stream.writeAttribute("id", getPrefix(), mId); - } - - if (isSetName() == true) - { - stream.writeAttribute("name", getPrefix(), mName); - } - - if (isSetKind() == true) - { - stream.writeAttribute("kind", getPrefix(), GroupKind_toString(mKind)); - } - - SBase::writeExtensionAttributes(stream); -} - -/** @endcond */ - - - - -#endif /* __cplusplus */ - - -/* - * Creates a new Group_t using the given SBML Level, Version and - * “groups” package version. - */ -LIBSBML_EXTERN -Group_t * -Group_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion) -{ - return new Group(level, version, pkgVersion); -} - - -/* - * Creates and returns a deep copy of this Group_t object. - */ -LIBSBML_EXTERN -Group_t* -Group_clone(const Group_t* g) -{ - if (g != NULL) - { - return static_cast(g->clone()); - } - else - { - return NULL; - } -} - - -/* - * Frees this Group_t object. - */ -LIBSBML_EXTERN -void -Group_free(Group_t* g) -{ - if (g != NULL) - { - delete g; - } -} - - -/* - * Returns the value of the "id" attribute of this Group_t. - */ -LIBSBML_EXTERN -char * -Group_getId(const Group_t * g) -{ - if (g == NULL) - { - return NULL; - } - - return g->getId().empty() ? NULL : safe_strdup(g->getId().c_str()); -} - - -/* - * Returns the value of the "name" attribute of this Group_t. - */ -LIBSBML_EXTERN -char * -Group_getName(const Group_t * g) -{ - if (g == NULL) - { - return NULL; - } - - return g->getName().empty() ? NULL : safe_strdup(g->getName().c_str()); -} - - -/* - * Returns the value of the "kind" attribute of this Group_t. - */ -LIBSBML_EXTERN -GroupKind_t -Group_getKind(const Group_t * g) -{ - if (g == NULL) - { - return GROUP_KIND_INVALID; - } - - return g->getKind(); -} - - -/* - * Returns the value of the "kind" attribute of this Group_t. - */ -LIBSBML_EXTERN -char * -Group_getKindAsString(const Group_t * g) -{ - return (char*)(GroupKind_toString(g->getKind())); -} - - -/* - * Predicate returning @c 1 (true) if this Group_t's "id" attribute is set. - */ -LIBSBML_EXTERN -int -Group_isSetId(const Group_t * g) -{ - return (g != NULL) ? static_cast(g->isSetId()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Group_t's "name" attribute is set. - */ -LIBSBML_EXTERN -int -Group_isSetName(const Group_t * g) -{ - return (g != NULL) ? static_cast(g->isSetName()) : 0; -} - - -/* - * Predicate returning @c 1 (true) if this Group_t's "kind" attribute is set. - */ -LIBSBML_EXTERN -int -Group_isSetKind(const Group_t * g) -{ - return (g != NULL) ? static_cast(g->isSetKind()) : 0; -} - - -/* - * Sets the value of the "id" attribute of this Group_t. - */ -LIBSBML_EXTERN -int -Group_setId(Group_t * g, const char * id) -{ - return (g != NULL) ? g->setId(id) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "name" attribute of this Group_t. - */ -LIBSBML_EXTERN -int -Group_setName(Group_t * g, const char * name) -{ - return (g != NULL) ? g->setName(name) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "kind" attribute of this Group_t. - */ -LIBSBML_EXTERN -int -Group_setKind(Group_t * g, GroupKind_t kind) -{ - return (g != NULL) ? g->setKind(kind) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Sets the value of the "kind" attribute of this Group_t. - */ -LIBSBML_EXTERN -int -Group_setKindAsString(Group_t * g, const char * kind) -{ - return (g != NULL) ? g->setKind(kind): LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "id" attribute of this Group_t. - */ -LIBSBML_EXTERN -int -Group_unsetId(Group_t * g) -{ - return (g != NULL) ? g->unsetId() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "name" attribute of this Group_t. - */ -LIBSBML_EXTERN -int -Group_unsetName(Group_t * g) -{ - return (g != NULL) ? g->unsetName() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Unsets the value of the "kind" attribute of this Group_t. - */ -LIBSBML_EXTERN -int -Group_unsetKind(Group_t * g) -{ - return (g != NULL) ? g->unsetKind() : LIBSBML_INVALID_OBJECT; -} - - -/* - * Returns a ListOf_t * containing Member_t objects from this Group_t. - */ -LIBSBML_EXTERN -ListOf_t* -Group_getListOfMembers(Group_t* g) -{ - return (g != NULL) ? g->getListOfMembers() : NULL; -} - - -/* - * Get a Member_t from the Group_t. - */ -LIBSBML_EXTERN -Member_t* -Group_getMember(Group_t* g, unsigned int n) -{ - return (g != NULL) ? g->getMember(n) : NULL; -} - - -/* - * Get a Member_t from the Group_t based on its identifier. - */ -LIBSBML_EXTERN -Member_t* -Group_getMemberById(Group_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getMember(sid) : NULL; -} - - -/* - * Get a Member_t from the Group_t based on the element to which it refers. - */ -LIBSBML_EXTERN -Member_t* -Group_getMemberByIdRef(Group_t* g, const char *sid) -{ - return (g != NULL && sid != NULL) ? g->getMemberByIdRef(sid) : NULL; -} - - -/* - * Adds a copy of the given Member_t to this Group_t. - */ -LIBSBML_EXTERN -int -Group_addMember(Group_t* g, const Member_t* m) -{ - return (g != NULL) ? g->addMember(m) : LIBSBML_INVALID_OBJECT; -} - - -/* - * Get the number of Member_t objects in this Group_t. - */ -LIBSBML_EXTERN -unsigned int -Group_getNumMembers(Group_t* g) -{ - return (g != NULL) ? g->getNumMembers() : SBML_INT_MAX; -} - - -/* - * Creates a new Member_t object, adds it to this Group_t object and returns - * the Member_t object created. - */ -LIBSBML_EXTERN -Member_t* -Group_createMember(Group_t* g) -{ - return (g != NULL) ? g->createMember() : NULL; -} - - -/* - * Removes the nth Member_t from this Group_t and returns a pointer to it. - */ -LIBSBML_EXTERN -Member_t* -Group_removeMember(Group_t* g, unsigned int n) -{ - return (g != NULL) ? g->removeMember(n) : NULL; -} - - -/* - * Removes the Member_t from this Group_t based on its identifier and returns a - * pointer to it. - */ -LIBSBML_EXTERN -Member_t* -Group_removeMemberById(Group_t* g, const char* sid) -{ - return (g != NULL && sid != NULL) ? g->removeMember(sid) : NULL; -} - - -/* - * Predicate returning @c 1 (true) if all the required attributes for this - * Group_t object have been set. - */ -LIBSBML_EXTERN -int -Group_hasRequiredAttributes(const Group_t * g) -{ - return (g != NULL) ? static_cast(g->hasRequiredAttributes()) : 0; -} - - - - -LIBSBML_CPP_NAMESPACE_END - - +/** + * @file Group.cpp + * @brief Implementation of the Group class. + * @author SBMLTeam + * + * + */ +#include +#include +#include +#include + + +using namespace std; + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new Group using the given SBML Level, Version and + * “groups” package version. + */ +Group::Group(unsigned int level, + unsigned int version, + unsigned int pkgVersion) + : SBase(level, version) + , mKind (GROUP_KIND_INVALID) + , mMembers (level, version, pkgVersion) +{ + setSBMLNamespacesAndOwn(new GroupsPkgNamespaces(level, version, pkgVersion)); + connectToChild(); +} + + +/* + * Creates a new Group using the given GroupsPkgNamespaces object. + */ +Group::Group(GroupsPkgNamespaces *groupsns) + : SBase(groupsns) + , mKind (GROUP_KIND_INVALID) + , mMembers (groupsns) +{ + setElementNamespace(groupsns->getURI()); + connectToChild(); + loadPlugins(groupsns); +} + + +/* + * Copy constructor for Group. + */ +Group::Group(const Group& orig) + : SBase( orig ) + , mKind ( orig.mKind ) + , mMembers ( orig.mMembers ) +{ + connectToChild(); +} + + +/* + * Assignment operator for Group. + */ +Group& +Group::operator=(const Group& rhs) +{ + if (&rhs != this) + { + SBase::operator=(rhs); + mKind = rhs.mKind; + mMembers = rhs.mMembers; + connectToChild(); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this Group object. + */ +Group* +Group::clone() const +{ + return new Group(*this); +} + + +/* + * Destructor for Group. + */ +Group::~Group() +{ +} + + +/* + * Returns the value of the "id" attribute of this Group. + */ +const std::string& +Group::getId() const +{ + return mId; +} + + +/* + * Returns the value of the "name" attribute of this Group. + */ +const std::string& +Group::getName() const +{ + return mName; +} + + +/* + * Returns the value of the "kind" attribute of this Group. + */ +GroupKind_t +Group::getKind() const +{ + return mKind; +} + + +/* + * Returns the value of the "kind" attribute of this Group. + */ +std::string +Group::getKindAsString() const +{ + std::string code_str = GroupKind_toString(mKind); + return code_str; +} + + +/* + * Predicate returning @c true if this Group's "id" attribute is set. + */ +bool +Group::isSetId() const +{ + return (mId.empty() == false); +} + + +/* + * Predicate returning @c true if this Group's "name" attribute is set. + */ +bool +Group::isSetName() const +{ + return (mName.empty() == false); +} + + +/* + * Predicate returning @c true if this Group's "kind" attribute is set. + */ +bool +Group::isSetKind() const +{ + return (mKind != GROUP_KIND_INVALID); +} + + +/* + * Sets the value of the "id" attribute of this Group. + */ +int +Group::setId(const std::string& id) +{ + return SyntaxChecker::checkAndSetSId(id, mId); +} + + +/* + * Sets the value of the "name" attribute of this Group. + */ +int +Group::setName(const std::string& name) +{ + mName = name; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Sets the value of the "kind" attribute of this Group. + */ +int +Group::setKind(const GroupKind_t kind) +{ + if (GroupKind_isValid(kind) == 0) + { + mKind = GROUP_KIND_INVALID; + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + else + { + mKind = kind; + return LIBSBML_OPERATION_SUCCESS; + } +} + + +/* + * Sets the value of the "kind" attribute of this Group. + */ +int +Group::setKind(const std::string& kind) +{ + mKind = GroupKind_fromString(kind.c_str()); + + if (mKind == GROUP_KIND_INVALID) + { + return LIBSBML_INVALID_ATTRIBUTE_VALUE; + } + + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "id" attribute of this Group. + */ +int +Group::unsetId() +{ + mId.erase(); + + if (mId.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "name" attribute of this Group. + */ +int +Group::unsetName() +{ + mName.erase(); + + if (mName.empty() == true) + { + return LIBSBML_OPERATION_SUCCESS; + } + else + { + return LIBSBML_OPERATION_FAILED; + } +} + + +/* + * Unsets the value of the "kind" attribute of this Group. + */ +int +Group::unsetKind() +{ + mKind = GROUP_KIND_INVALID; + return LIBSBML_OPERATION_SUCCESS; +} + + +/* + * Returns the ListOfMembers from this Group. + */ +const ListOfMembers* +Group::getListOfMembers() const +{ + return &mMembers; +} + + +/* + * Returns the ListOfMembers from this Group. + */ +ListOfMembers* +Group::getListOfMembers() +{ + return &mMembers; +} + + +/* + * Get a Member from the Group. + */ +Member* +Group::getMember(unsigned int n) +{ + return mMembers.get(n); +} + + +/* + * Get a Member from the Group. + */ +const Member* +Group::getMember(unsigned int n) const +{ + return mMembers.get(n); +} + + +/* + * Get a Member from the Group based on its identifier. + */ +Member* +Group::getMember(const std::string& sid) +{ + return mMembers.get(sid); +} + + +/* + * Get a Member from the Group based on its identifier. + */ +const Member* +Group::getMember(const std::string& sid) const +{ + return mMembers.get(sid); +} + + +/* + * Get a Member from the Group based on the element to which it refers. + */ +const Member* +Group::getMemberByIdRef(const std::string& sid) const +{ + return mMembers.getByIdRef(sid); +} + + +/* + * Get a Member from the Group based on the element to which it refers. + */ +Member* +Group::getMemberByIdRef(const std::string& sid) +{ + return mMembers.getByIdRef(sid); +} + + +/* + * Adds a copy of the given Member to this Group. + */ +int +Group::addMember(const Member* m) +{ + if (m == NULL) + { + return LIBSBML_OPERATION_FAILED; + } + else if (m->hasRequiredAttributes() == false) + { + return LIBSBML_INVALID_OBJECT; + } + else if (getLevel() != m->getLevel()) + { + return LIBSBML_LEVEL_MISMATCH; + } + else if (getVersion() != m->getVersion()) + { + return LIBSBML_VERSION_MISMATCH; + } + else if (matchesRequiredSBMLNamespacesForAddition(static_cast(m)) == false) + { + return LIBSBML_NAMESPACES_MISMATCH; + } + else if (m->isSetId() && (mMembers.get(m->getId())) != NULL) + { + return LIBSBML_DUPLICATE_OBJECT_ID; + } + else + { + return mMembers.append(m); + } +} + + +/* + * Get the number of Member objects in this Group. + */ +unsigned int +Group::getNumMembers() const +{ + return mMembers.size(); +} + + +/* + * Creates a new Member object, adds it to this Group object and returns the + * Member object created. + */ +Member* +Group::createMember() +{ + Member* m = NULL; + + try + { + GROUPS_CREATE_NS(groupsns, getSBMLNamespaces()); + m = new Member(groupsns); + delete groupsns; + } + catch (...) + { + } + + if (m != NULL) + { + mMembers.appendAndOwn(m); + } + + return m; +} + + +/* + * Removes the nth Member from this Group and returns a pointer to it. + */ +Member* +Group::removeMember(unsigned int n) +{ + return mMembers.remove(n); +} + + +/* + * Removes the Member from this Group based on its identifier and returns a + * pointer to it. + */ +Member* +Group::removeMember(const std::string& sid) +{ + return mMembers.remove(sid); +} + + +/* + * Returns the XML element name of this Group object. + */ +const std::string& +Group::getElementName() const +{ + static const string name = "group"; + return name; +} + + +/* + * Returns the libSBML type code for this Group object. + */ +int +Group::getTypeCode() const +{ + return SBML_GROUPS_GROUP; +} + + +/* + * Predicate returning @c true if all the required attributes for this Group + * object have been set. + */ +bool +Group::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetKind() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Write any contained elements + */ +void +Group::writeElements(XMLOutputStream& stream) const +{ + SBase::writeElements(stream); + + if (getNumMembers() > 0) + { + mMembers.write(stream); + } + + SBase::writeExtensionElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Accepts the given SBMLVisitor + */ +bool +Group::accept(SBMLVisitor& v) const +{ + v.visit(*this); + + mMembers.accept(v); + + v.leave(*this); + return true; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the parent SBMLDocument + */ +void +Group::setSBMLDocument(SBMLDocument* d) +{ + SBase::setSBMLDocument(d); + + mMembers.setSBMLDocument(d); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Connects to child elements + */ +void +Group::connectToChild() +{ + SBase::connectToChild(); + + mMembers.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Enables/disables the given package with this element + */ +void +Group::enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag) +{ + SBase::enablePackageInternal(pkgURI, pkgPrefix, flag); + + mMembers.enablePackageInternal(pkgURI, pkgPrefix, flag); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Updates the namespaces when setLevelVersion is used + */ +void +Group::updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version) +{ + SBase::updateSBMLNamespace(package, level, version); + + mMembers.updateSBMLNamespace(package, level, version); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Group. + */ +int +Group::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Group. + */ +int +Group::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Group. + */ +int +Group::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Group. + */ +int +Group::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Gets the value of the "attributeName" attribute of this Group. + */ +int +Group::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = SBase::getAttribute(attributeName, value); + + if (return_value == LIBSBML_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "id") + { + value = getId(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "name") + { + value = getName(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + else if (attributeName == "kind") + { + value = getKindAsString(); + return_value = LIBSBML_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Predicate returning @c true if this Group's attribute "attributeName" is + * set. + */ +bool +Group::isSetAttribute(const std::string& attributeName) const +{ + bool value = SBase::isSetAttribute(attributeName); + + if (attributeName == "id") + { + value = isSetId(); + } + else if (attributeName == "name") + { + value = isSetName(); + } + else if (attributeName == "kind") + { + value = isSetKind(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Group. + */ +int +Group::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Group. + */ +int +Group::setAttribute(const std::string& attributeName, int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Group. + */ +int +Group::setAttribute(const std::string& attributeName, double value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Group. + */ +int +Group::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Sets the value of the "attributeName" attribute of this Group. + */ +int +Group::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = SBase::setAttribute(attributeName, value); + + if (attributeName == "id") + { + return_value = setId(value); + } + else if (attributeName == "name") + { + return_value = setName(value); + } + else if (attributeName == "kind") + { + return_value = setKind(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this Group. + */ +int +Group::unsetAttribute(const std::string& attributeName) +{ + int value = SBase::unsetAttribute(attributeName); + + if (attributeName == "id") + { + value = unsetId(); + } + else if (attributeName == "name") + { + value = unsetName(); + } + else if (attributeName == "kind") + { + value = unsetKind(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates and returns an new "elementName" object in this Group. + */ +SBase* +Group::createChildObject(const std::string& elementName) +{ + SBase* obj = NULL; + + if (elementName == "member") + { + return createMember(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds a new "elementName" object to this Group. + */ +int +Group::addChildObject(const std::string& elementName, const SBase* element) +{ + if (elementName == "member" && element->getTypeCode() == SBML_GROUPS_MEMBER) + { + return addMember((const Member*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * Group. + */ +SBase* +Group::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "member") + { + return removeMember(id); + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the number of "elementName" in this Group. + */ +unsigned int +Group::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "member") + { + return getNumMembers(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Returns the nth object of "objectName" in this Group. + */ +SBase* +Group::getObject(const std::string& elementName, unsigned int index) +{ + SBase* obj = NULL; + + if (elementName == "member") + { + return getMember(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +SBase* +Group::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mMembers.getId() == id) + { + return &mMembers; + } + + obj = mMembers.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns the first child element that has the given @p metaid, or @c NULL if + * no such object is found. + */ +SBase* +Group::getElementByMetaId(const std::string& metaid) +{ + if (metaid.empty()) + { + return NULL; + } + + SBase* obj = NULL; + + if (mMembers.getMetaId() == metaid) + { + return &mMembers; + } + + obj = mMembers.getElementByMetaId(metaid); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + +/* + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + */ +List* +Group::getAllElements(ElementFilter* filter) +{ + List* ret = new List(); + List* sublist = NULL; + + + ADD_FILTERED_LIST(ret, sublist, mMembers, filter); + + ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter); + + return ret; +} + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +SBase* +Group::createObject(XMLInputStream& stream) +{ + SBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "listOfMembers") + { + if (getErrorLog() && mMembers.size() != 0) + { + getErrorLog()->logPackageError("groups", GroupsGroupAllowedElements, + getPackageVersion(), getLevel(), getVersion(), "", getLine(), + getColumn()); + } + + obj = &mMembers; + } + + connectToChild(); + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Adds the expected attributes for this element + */ +void +Group::addExpectedAttributes(ExpectedAttributes& attributes) +{ + SBase::addExpectedAttributes(attributes); + + attributes.add("id"); + + attributes.add("name"); + + attributes.add("kind"); +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +Group::readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int pkgVersion = getPackageVersion(); + unsigned int numErrs; + bool assigned = false; + SBMLErrorLog* log = getErrorLog(); + + if (log && getParentSBMLObject() && + static_cast(getParentSBMLObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("groups", GroupsModelLOGroupsAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("groups", + GroupsModelLOGroupsAllowedCoreAttributes, pkgVersion, level, version, + details, getLine(), getColumn()); + } + } + } + + SBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == UnknownPackageAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownPackageAttribute); + log->logPackageError("groups", GroupsGroupAllowedAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + else if (log->getError(n)->getErrorId() == UnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(UnknownCoreAttribute); + log->logPackageError("groups", GroupsGroupAllowedCoreAttributes, + pkgVersion, level, version, details, getLine(), getColumn()); + } + } + } + + // + // id SId (use = "optional" ) + // + + assigned = attributes.readInto("id", mId); + + if (assigned == true) + { + if (mId.empty() == true) + { + logEmptyString(mId, level, version, ""); + } + else if (SyntaxChecker::isValidSBMLSId(mId) == false) + { + log->logPackageError("groups", GroupsIdSyntaxRule, pkgVersion, level, + version, "The id on the <" + getElementName() + "> is '" + mId + "', " + "which does not conform to the syntax.", getLine(), getColumn()); + } + } + + // + // name string (use = "optional" ) + // + + assigned = attributes.readInto("name", mName); + + if (assigned == true) + { + if (mName.empty() == true) + { + logEmptyString(mName, level, version, ""); + } + } + + // + // kind enum (use = "required" ) + // + + std::string kind; + assigned = attributes.readInto("kind", kind); + + if (assigned == true) + { + if (kind.empty() == true) + { + logEmptyString(kind, level, version, ""); + } + else + { + mKind = GroupKind_fromString(kind.c_str()); + + if (log && GroupKind_isValid(mKind) == 0) + { + std::string msg = "The kind on the "; + + if (isSetId()) + { + msg += "with id '" + getId() + "'"; + } + + msg += "is '" + kind + "', which is not a valid option."; + + log->logPackageError("groups", GroupsGroupKindMustBeGroupKindEnum, + pkgVersion, level, version, msg, getLine(), getColumn()); + } + } + } + else + { + if (log) + { + std::string message = "Groups attribute 'kind' is missing."; + log->logPackageError("groups", GroupsGroupAllowedAttributes, pkgVersion, + level, version, message, getLine(), getColumn()); + } + } +} + +/** @endcond */ + + + +/** @cond doxygenLibsbmlInternal */ + +/* + * Writes the attributes to the stream + */ +void +Group::writeAttributes(XMLOutputStream& stream) const +{ + SBase::writeAttributes(stream); + + if (isSetId() == true) + { + stream.writeAttribute("id", getPrefix(), mId); + } + + if (isSetName() == true) + { + stream.writeAttribute("name", getPrefix(), mName); + } + + if (isSetKind() == true) + { + stream.writeAttribute("kind", getPrefix(), GroupKind_toString(mKind)); + } + + SBase::writeExtensionAttributes(stream); +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new Group_t using the given SBML Level, Version and + * “groups” package version. + */ +LIBSBML_EXTERN +Group_t * +Group_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion) +{ + return new Group(level, version, pkgVersion); +} + + +/* + * Creates and returns a deep copy of this Group_t object. + */ +LIBSBML_EXTERN +Group_t* +Group_clone(const Group_t* g) +{ + if (g != NULL) + { + return static_cast(g->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this Group_t object. + */ +LIBSBML_EXTERN +void +Group_free(Group_t* g) +{ + if (g != NULL) + { + delete g; + } +} + + +/* + * Returns the value of the "id" attribute of this Group_t. + */ +LIBSBML_EXTERN +char * +Group_getId(const Group_t * g) +{ + if (g == NULL) + { + return NULL; + } + + return g->getId().empty() ? NULL : safe_strdup(g->getId().c_str()); +} + + +/* + * Returns the value of the "name" attribute of this Group_t. + */ +LIBSBML_EXTERN +char * +Group_getName(const Group_t * g) +{ + if (g == NULL) + { + return NULL; + } + + return g->getName().empty() ? NULL : safe_strdup(g->getName().c_str()); +} + + +/* + * Returns the value of the "kind" attribute of this Group_t. + */ +LIBSBML_EXTERN +GroupKind_t +Group_getKind(const Group_t * g) +{ + if (g == NULL) + { + return GROUP_KIND_INVALID; + } + + return g->getKind(); +} + + +/* + * Returns the value of the "kind" attribute of this Group_t. + */ +LIBSBML_EXTERN +char * +Group_getKindAsString(const Group_t * g) +{ + return (char*)(GroupKind_toString(g->getKind())); +} + + +/* + * Predicate returning @c 1 (true) if this Group_t's "id" attribute is set. + */ +LIBSBML_EXTERN +int +Group_isSetId(const Group_t * g) +{ + return (g != NULL) ? static_cast(g->isSetId()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Group_t's "name" attribute is set. + */ +LIBSBML_EXTERN +int +Group_isSetName(const Group_t * g) +{ + return (g != NULL) ? static_cast(g->isSetName()) : 0; +} + + +/* + * Predicate returning @c 1 (true) if this Group_t's "kind" attribute is set. + */ +LIBSBML_EXTERN +int +Group_isSetKind(const Group_t * g) +{ + return (g != NULL) ? static_cast(g->isSetKind()) : 0; +} + + +/* + * Sets the value of the "id" attribute of this Group_t. + */ +LIBSBML_EXTERN +int +Group_setId(Group_t * g, const char * id) +{ + return (g != NULL) ? g->setId(id) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "name" attribute of this Group_t. + */ +LIBSBML_EXTERN +int +Group_setName(Group_t * g, const char * name) +{ + return (g != NULL) ? g->setName(name) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "kind" attribute of this Group_t. + */ +LIBSBML_EXTERN +int +Group_setKind(Group_t * g, GroupKind_t kind) +{ + return (g != NULL) ? g->setKind(kind) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Sets the value of the "kind" attribute of this Group_t. + */ +LIBSBML_EXTERN +int +Group_setKindAsString(Group_t * g, const char * kind) +{ + return (g != NULL) ? g->setKind(kind): LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "id" attribute of this Group_t. + */ +LIBSBML_EXTERN +int +Group_unsetId(Group_t * g) +{ + return (g != NULL) ? g->unsetId() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "name" attribute of this Group_t. + */ +LIBSBML_EXTERN +int +Group_unsetName(Group_t * g) +{ + return (g != NULL) ? g->unsetName() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "kind" attribute of this Group_t. + */ +LIBSBML_EXTERN +int +Group_unsetKind(Group_t * g) +{ + return (g != NULL) ? g->unsetKind() : LIBSBML_INVALID_OBJECT; +} + + +/* + * Returns a ListOf_t * containing Member_t objects from this Group_t. + */ +LIBSBML_EXTERN +ListOf_t* +Group_getListOfMembers(Group_t* g) +{ + return (g != NULL) ? g->getListOfMembers() : NULL; +} + + +/* + * Get a Member_t from the Group_t. + */ +LIBSBML_EXTERN +Member_t* +Group_getMember(Group_t* g, unsigned int n) +{ + return (g != NULL) ? g->getMember(n) : NULL; +} + + +/* + * Get a Member_t from the Group_t based on its identifier. + */ +LIBSBML_EXTERN +Member_t* +Group_getMemberById(Group_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getMember(sid) : NULL; +} + + +/* + * Get a Member_t from the Group_t based on the element to which it refers. + */ +LIBSBML_EXTERN +Member_t* +Group_getMemberByIdRef(Group_t* g, const char *sid) +{ + return (g != NULL && sid != NULL) ? g->getMemberByIdRef(sid) : NULL; +} + + +/* + * Adds a copy of the given Member_t to this Group_t. + */ +LIBSBML_EXTERN +int +Group_addMember(Group_t* g, const Member_t* m) +{ + return (g != NULL) ? g->addMember(m) : LIBSBML_INVALID_OBJECT; +} + + +/* + * Get the number of Member_t objects in this Group_t. + */ +LIBSBML_EXTERN +unsigned int +Group_getNumMembers(Group_t* g) +{ + return (g != NULL) ? g->getNumMembers() : SBML_INT_MAX; +} + + +/* + * Creates a new Member_t object, adds it to this Group_t object and returns + * the Member_t object created. + */ +LIBSBML_EXTERN +Member_t* +Group_createMember(Group_t* g) +{ + return (g != NULL) ? g->createMember() : NULL; +} + + +/* + * Removes the nth Member_t from this Group_t and returns a pointer to it. + */ +LIBSBML_EXTERN +Member_t* +Group_removeMember(Group_t* g, unsigned int n) +{ + return (g != NULL) ? g->removeMember(n) : NULL; +} + + +/* + * Removes the Member_t from this Group_t based on its identifier and returns a + * pointer to it. + */ +LIBSBML_EXTERN +Member_t* +Group_removeMemberById(Group_t* g, const char* sid) +{ + return (g != NULL && sid != NULL) ? g->removeMember(sid) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * Group_t object have been set. + */ +LIBSBML_EXTERN +int +Group_hasRequiredAttributes(const Group_t * g) +{ + return (g != NULL) ? static_cast(g->hasRequiredAttributes()) : 0; +} + + + + +LIBSBML_CPP_NAMESPACE_END + + diff --git a/generator/tests/test_cpp_code/test-code/Group.h b/generator/tests/test_cpp_code/test-code/Group.h index 1af59087..e94dbb50 100644 --- a/generator/tests/test_cpp_code/test-code/Group.h +++ b/generator/tests/test_cpp_code/test-code/Group.h @@ -1,1654 +1,1654 @@ -/** - * @file Group.h - * @brief Definition of the Group class. - * @author SBMLTeam - * - * - * - * @class Group - * @sbmlbrief{groups} TODO:Definition of the Group class. - */ - -/** - * - * - * - * @class doc_group_kind - * - * @par - * The attribute "kind" on a Group object is used to TODO:add explanation - * - * In the SBML - * Level 3 Version 1 Groups specification, the following are the - * allowable values for "kind": - *
    - *
  • @c "classification", TODO:add description - * - *
  • @c "partonomy", TODO:add description - * - *
  • @c "collection", TODO:add description - * - *
- */ - - -#ifndef Group_H__ -#define Group_H__ - - -#include -#include -#include - - -#ifdef __cplusplus - - -#include - - -#include -#include -#include - - -LIBSBML_CPP_NAMESPACE_BEGIN - - -class LIBSBML_EXTERN Group : public SBase -{ -protected: - - /** @cond doxygenLibsbmlInternal */ - - GroupKind_t mKind; - ListOfMembers mMembers; - - /** @endcond */ - -public: - - /** - * Creates a new Group using the given SBML Level, Version and - * “groups” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Group. - * - * @param version an unsigned int, the SBML Version to assign to this Group. - * - * @param pkgVersion an unsigned int, the SBML Groups Version to assign to - * this Group. - * - * @copydetails doc_note_setting_lv_pkg - */ - Group(unsigned int level = GroupsExtension::getDefaultLevel(), - unsigned int version = GroupsExtension::getDefaultVersion(), - unsigned int pkgVersion = GroupsExtension::getDefaultPackageVersion()); - - - /** - * Creates a new Group using the given GroupsPkgNamespaces object. - * - * @copydetails doc_what_are_sbml_package_namespaces - * - * @param groupsns the GroupsPkgNamespaces object. - * - * @copydetails doc_note_setting_lv_pkg - */ - Group(GroupsPkgNamespaces *groupsns); - - - /** - * Copy constructor for Group. - * - * @param orig the Group instance to copy. - */ - Group(const Group& orig); - - - /** - * Assignment operator for Group. - * - * @param rhs the Group object whose values are to be used as the basis of - * the assignment. - */ - Group& operator=(const Group& rhs); - - - /** - * Creates and returns a deep copy of this Group object. - * - * @return a (deep) copy of this Group object. - */ - virtual Group* clone() const; - - - /** - * Destructor for Group. - */ - virtual ~Group(); - - - /** - * Returns the value of the "id" attribute of this Group. - * - * @return the value of the "id" attribute of this Group as a string. - */ - virtual const std::string& getId() const; - - - /** - * Returns the value of the "name" attribute of this Group. - * - * @return the value of the "name" attribute of this Group as a string. - */ - virtual const std::string& getName() const; - - - /** - * Returns the value of the "kind" attribute of this Group. - * - * @return the value of the "kind" attribute of this Group as a GroupKind_t. - * - * @copydetails doc_group_kind - * @if clike The value is drawn from the enumeration @ref GroupKind_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{GROUP_KIND_CLASSIFICATION, GroupKind_t} - * @li @sbmlconstant{GROUP_KIND_PARTONOMY, GroupKind_t} - * @li @sbmlconstant{GROUP_KIND_COLLECTION, GroupKind_t} - * @li @sbmlconstant{GROUP_KIND_INVALID, GroupKind_t} - */ - GroupKind_t getKind() const; - - - /** - * Returns the value of the "kind" attribute of this Group. - * - * @return the value of the "kind" attribute of this Group as a string. - * - * @copydetails doc_group_kind - * The possible values returned by this method are: - * @li @c "classification" - * @li @c "partonomy" - * @li @c "collection" - * @li @c "invalid GroupKind value" - */ - std::string getKindAsString() const; - - - /** - * Predicate returning @c true if this Group's "id" attribute is set. - * - * @return @c true if this Group's "id" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetId() const; - - - /** - * Predicate returning @c true if this Group's "name" attribute is set. - * - * @return @c true if this Group's "name" attribute has been set, otherwise - * @c false is returned. - */ - virtual bool isSetName() const; - - - /** - * Predicate returning @c true if this Group's "kind" attribute is set. - * - * @return @c true if this Group's "kind" attribute has been set, otherwise - * @c false is returned. - * - * @copydetails doc_group_kind - */ - bool isSetKind() const; - - - /** - * Sets the value of the "id" attribute of this Group. - * - * @param id std::string& value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is - * equivalent to calling unsetId(). - */ - virtual int setId(const std::string& id); - - - /** - * Sets the value of the "name" attribute of this Group. - * - * @param name std::string& value of the "name" attribute to be set. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * Calling this function with @p name = @c NULL or an empty string is - * equivalent to calling unsetName(). - */ - virtual int setName(const std::string& name); - - - /** - * Sets the value of the "kind" attribute of this Group. - * - * @param kind @if clike GroupKind_t@else int@endif value of the "kind" - * attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_group_kind - */ - int setKind(const GroupKind_t kind); - - - /** - * Sets the value of the "kind" attribute of this Group. - * - * @param kind std::string& of the "kind" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} - * - * @copydetails doc_group_kind - */ - int setKind(const std::string& kind); - - - /** - * Unsets the value of the "id" attribute of this Group. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetId(); - - - /** - * Unsets the value of the "name" attribute of this Group. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetName(); - - - /** - * Unsets the value of the "kind" attribute of this Group. - * - * @copydetails doc_returns_one_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * - * @copydetails doc_group_kind - */ - int unsetKind(); - - - /** - * Returns the ListOfMembers from this Group. - * - * @return the ListOfMembers from this Group. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(const std::string& sid) - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - const ListOfMembers* getListOfMembers() const; - - - /** - * Returns the ListOfMembers from this Group. - * - * @return the ListOfMembers from this Group. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(const std::string& sid) - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - ListOfMembers* getListOfMembers(); - - - /** - * Get a Member from the Group. - * - * @param n an unsigned int representing the index of the Member to retrieve. - * - * @return the nth Member in the ListOfMembers within this Group or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(const std::string& sid) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - Member* getMember(unsigned int n); - - - /** - * Get a Member from the Group. - * - * @param n an unsigned int representing the index of the Member to retrieve. - * - * @return the nth Member in the ListOfMembers within this Group or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(const std::string& sid) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - const Member* getMember(unsigned int n) const; - - - /** - * Get a Member from the Group based on its identifier. - * - * @param sid a string representing the identifier of the Member to retrieve. - * - * @return the Member in the ListOfMembers within this Group with the given - * @p sid or @c NULL if no such Member exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - Member* getMember(const std::string& sid); - - - /** - * Get a Member from the Group based on its identifier. - * - * @param sid a string representing the identifier of the Member to retrieve. - * - * @return the Member in the ListOfMembers within this Group with the given - * @p sid or @c NULL if no such Member exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - const Member* getMember(const std::string& sid) const; - - - /** - * Get a Member from the Group based on the element to which it refers. - * - * @param sid a string representing the "idRef" attribute of the Member - * object to retrieve. - * - * @return the first Member in this Group based on the given idRef attribute - * or NULL if no such Member exists. - * - * @copydetails doc_returned_unowned_pointer - */ - const Member* getMemberByIdRef(const std::string& sid) const; - - - /** - * Get a Member from the Group based on the element to which it refers. - * - * @param sid a string representing the "idRef" attribute of the Member - * object to retrieve. - * - * @return the first Member in this Group based on the given idRef attribute - * or NULL if no such Member exists. - * - * @copydetails doc_returned_unowned_pointer - */ - Member* getMemberByIdRef(const std::string& sid); - - - /** - * Adds a copy of the given Member to this Group. - * - * @param m the Member object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @copydetails doc_note_object_is_copied - * - * @see createMember() - * @see getMember(const std::string& sid) - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - int addMember(const Member* m); - - - /** - * Get the number of Member objects in this Group. - * - * @return the number of Member objects in this Group. - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(const std::string& sid) - * @see getMember(unsigned int n) - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - unsigned int getNumMembers() const; - - - /** - * Creates a new Member object, adds it to this Group object and returns the - * Member object created. - * - * @return a new Member object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @see addMember(const Member* object) - * @see getMember(const std::string& sid) - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - * @see removeMember(unsigned int n) - */ - Member* createMember(); - - - /** - * Removes the nth Member from this Group and returns a pointer to it. - * - * @param n an unsigned int representing the index of the Member to remove. - * - * @return a pointer to the nth Member in this Group. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(const std::string& sid) - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(const std::string& sid) - */ - Member* removeMember(unsigned int n); - - - /** - * Removes the Member from this Group based on its identifier and returns a - * pointer to it. - * - * @param sid a string representing the identifier of the Member to remove. - * - * @return the Member in this Group based on the identifier or NULL if no - * such Member exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @see addMember(const Member* object) - * @see createMember() - * @see getMember(const std::string& sid) - * @see getMember(unsigned int n) - * @see getNumMembers() - * @see removeMember(unsigned int n) - */ - Member* removeMember(const std::string& sid); - - - /** - * Returns the XML element name of this Group object. - * - * For Group, the XML element name is always @c "group". - * - * @return the name of this element, i.e. @c "group". - */ - virtual const std::string& getElementName() const; - - - /** - * Returns the libSBML type code for this Group object. - * - * @copydetails doc_what_are_typecodes - * - * @return the SBML type code for this object: - * @sbmlconstant{SBML_GROUPS_GROUP, SBMLGroupsTypeCode_t}. - * - * @copydetails doc_warning_typecodes_not_unique - * - * @see getElementName() - * @see getPackageName() - */ - virtual int getTypeCode() const; - - - /** - * Predicate returning @c true if all the required attributes for this Group - * object have been set. - * - * @return @c true to indicate that all the required attributes of this Group - * have been set, otherwise @c false is returned. - * - * - * @note The required attributes for the Group object are: - * @li "kind" - */ - virtual bool hasRequiredAttributes() const; - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Write any contained elements - */ - virtual void writeElements(XMLOutputStream& stream) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Accepts the given SBMLVisitor - */ - virtual bool accept(SBMLVisitor& v) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the parent SBMLDocument - */ - virtual void setSBMLDocument(SBMLDocument* d); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Connects to child elements - */ - virtual void connectToChild(); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Enables/disables the given package with this element - */ - virtual void enablePackageInternal(const std::string& pkgURI, - const std::string& pkgPrefix, - bool flag); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Updates the namespaces when setLevelVersion is used - */ - virtual void updateSBMLNamespace(const std::string& package, - unsigned int level, - unsigned int version); - - /** @endcond */ - - - - - #ifndef SWIG - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, bool& value) - const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - double& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - unsigned int& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Gets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to retrieve. - * - * @param value, the address of the value to record. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int getAttribute(const std::string& attributeName, - std::string& value) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Predicate returning @c true if this Group's attribute "attributeName" is - * set. - * - * @param attributeName, the name of the attribute to query. - * - * @return @c true if this Group's attribute "attributeName" has been set, - * otherwise @c false is returned. - */ - virtual bool isSetAttribute(const std::string& attributeName) const; - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, bool value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, double value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - unsigned int value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Sets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to set. - * - * @param value, the value of the attribute to set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int setAttribute(const std::string& attributeName, - const std::string& value); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Unsets the value of the "attributeName" attribute of this Group. - * - * @param attributeName, the name of the attribute to query. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int unsetAttribute(const std::string& attributeName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates and returns an new "elementName" object in this Group. - * - * @param elementName, the name of the element to create. - * - * @return pointer to the element created. - */ - virtual SBase* createChildObject(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds a new "elementName" object to this Group. - * - * @param elementName, the name of the element to create. - * - * @param element, pointer to the element to be added. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - */ - virtual int addChildObject(const std::string& elementName, - const SBase* element); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Removes and returns the new "elementName" object with the given id in this - * Group. - * - * @param elementName, the name of the element to remove. - * - * @param id, the id of the element to remove. - * - * @return pointer to the element removed. - */ - virtual SBase* removeChildObject(const std::string& elementName, - const std::string& id); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the number of "elementName" in this Group. - * - * @param elementName, the name of the element to get number of. - * - * @return unsigned int number of elements. - */ - virtual unsigned int getNumObjects(const std::string& elementName); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Returns the nth object of "objectName" in this Group. - * - * @param elementName, the name of the element to get number of. - * - * @param index, unsigned int the index of the object to retrieve. - * - * @return pointer to the object. - */ - virtual SBase* getObject(const std::string& elementName, unsigned int index); - - /** @endcond */ - - - - - #endif /* !SWIG */ - - - /** - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - * - * @param id a string representing the id attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p id. If no such - * object is found, this method returns @c NULL. - */ - virtual SBase* getElementBySId(const std::string& id); - - - /** - * Returns the first child element that has the given @p metaid, or @c NULL - * if no such object is found. - * - * @param metaid a string representing the metaid attribute of the object to - * retrieve. - * - * @return a pointer to the SBase element with the given @p metaid. If no - * such object is found this method returns @c NULL. - */ - virtual SBase* getElementByMetaId(const std::string& metaid); - - - /** - * Returns a List of all child SBase objects, including those nested to an - * arbitrary depth. - * - * @param filter an ElementFilter that may impose restrictions on the objects - * to be retrieved. - * - * @return a List pointer of pointers to all SBase child objects with any - * restriction imposed. - */ - virtual List* getAllElements(ElementFilter * filter = NULL); - - -protected: - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Creates a new object from the next XMLToken on the XMLInputStream - */ - virtual SBase* createObject(XMLInputStream& stream); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Adds the expected attributes for this element - */ - virtual void addExpectedAttributes(ExpectedAttributes& attributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Reads the expected attributes into the member data variables - */ - virtual void readAttributes(const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); - - /** @endcond */ - - - - /** @cond doxygenLibsbmlInternal */ - - /** - * Writes the attributes to the stream - */ - virtual void writeAttributes(XMLOutputStream& stream) const; - - /** @endcond */ - - -}; - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* __cplusplus */ - - - - -#ifndef SWIG - - - - -LIBSBML_CPP_NAMESPACE_BEGIN - - - - -BEGIN_C_DECLS - - -/** - * Creates a new Group_t using the given SBML Level, Version and - * “groups” package version. - * - * @param level an unsigned int, the SBML Level to assign to this Group_t. - * - * @param version an unsigned int, the SBML Version to assign to this Group_t. - * - * @param pkgVersion an unsigned int, the SBML Groups Version to assign to this - * Group_t. - * - * @copydetails doc_note_setting_lv_pkg - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Group_t * -Group_create(unsigned int level, - unsigned int version, - unsigned int pkgVersion); - - -/** - * Creates and returns a deep copy of this Group_t object. - * - * @param g the Group_t structure. - * - * @return a (deep) copy of this Group_t object. - * - * @copydetails doc_returned_owned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Group_t* -Group_clone(const Group_t* g); - - -/** - * Frees this Group_t object. - * - * @param g the Group_t structure. - * - * @memberof Group_t - */ -LIBSBML_EXTERN -void -Group_free(Group_t* g); - - -/** - * Returns the value of the "id" attribute of this Group_t. - * - * @param g the Group_t structure whose id is sought. - * - * @return the value of the "id" attribute of this Group_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Group_t - */ -LIBSBML_EXTERN -char * -Group_getId(const Group_t * g); - - -/** - * Returns the value of the "name" attribute of this Group_t. - * - * @param g the Group_t structure whose name is sought. - * - * @return the value of the "name" attribute of this Group_t as a pointer to a - * string. - * - * @copydetails doc_returned_owned_char - * - * @memberof Group_t - */ -LIBSBML_EXTERN -char * -Group_getName(const Group_t * g); - - -/** - * Returns the value of the "kind" attribute of this Group_t. - * - * @param g the Group_t structure whose kind is sought. - * - * @return the value of the "kind" attribute of this Group_t as a GroupKind_t. - * - * @copydetails doc_group_kind - * @if clike The value is drawn from the enumeration @ref GroupKind_t @endif - * The possible values returned by this method are: - * @li @sbmlconstant{GROUP_KIND_CLASSIFICATION, GroupKind_t} - * @li @sbmlconstant{GROUP_KIND_PARTONOMY, GroupKind_t} - * @li @sbmlconstant{GROUP_KIND_COLLECTION, GroupKind_t} - * @li @sbmlconstant{GROUP_KIND_INVALID, GroupKind_t} - * - * @memberof Group_t - */ -LIBSBML_EXTERN -GroupKind_t -Group_getKind(const Group_t * g); - - -/** - * Returns the value of the "kind" attribute of this Group_t. - * - * @param g the Group_t structure whose kind is sought. - * - * @return the value of the "kind" attribute of this Group_t as a const char *. - * - * @copydetails doc_returned_unowned_char - * - * @copydetails doc_group_kind - * The possible values returned by this method are: - * @li @c "classification" - * @li @c "partonomy" - * @li @c "collection" - * @li @c "invalid GroupKind value" - * - * @memberof Group_t - */ -LIBSBML_EXTERN -char * -Group_getKindAsString(const Group_t * g); - - -/** - * Predicate returning @c 1 (true) if this Group_t's "id" attribute is set. - * - * @param g the Group_t structure. - * - * @return @c 1 (true) if this Group_t's "id" attribute has been set, otherwise - * @c 0 (false) is returned. - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_isSetId(const Group_t * g); - - -/** - * Predicate returning @c 1 (true) if this Group_t's "name" attribute is set. - * - * @param g the Group_t structure. - * - * @return @c 1 (true) if this Group_t's "name" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_isSetName(const Group_t * g); - - -/** - * Predicate returning @c 1 (true) if this Group_t's "kind" attribute is set. - * - * @param g the Group_t structure. - * - * @return @c 1 (true) if this Group_t's "kind" attribute has been set, - * otherwise @c 0 (false) is returned. - * - * @copydetails doc_group_kind - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_isSetKind(const Group_t * g); - - -/** - * Sets the value of the "id" attribute of this Group_t. - * - * @param g the Group_t structure. - * - * @param id const char * value of the "id" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p id = @c NULL or an empty string is equivalent - * to calling Group_unsetId(). - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_setId(Group_t * g, const char * id); - - -/** - * Sets the value of the "name" attribute of this Group_t. - * - * @param g the Group_t structure. - * - * @param name const char * value of the "name" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * Calling this function with @p name = @c NULL or an empty string is - * equivalent to calling Group_unsetName(). - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_setName(Group_t * g, const char * name); - - -/** - * Sets the value of the "kind" attribute of this Group_t. - * - * @param g the Group_t structure. - * - * @param kind GroupKind_t value of the "kind" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_group_kind - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_setKind(Group_t * g, GroupKind_t kind); - - -/** - * Sets the value of the "kind" attribute of this Group_t. - * - * @param g the Group_t structure. - * - * @param kind const char * of the "kind" attribute to be set. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_group_kind - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_setKindAsString(Group_t * g, const char * kind); - - -/** - * Unsets the value of the "id" attribute of this Group_t. - * - * @param g the Group_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_unsetId(Group_t * g); - - -/** - * Unsets the value of the "name" attribute of this Group_t. - * - * @param g the Group_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_unsetName(Group_t * g); - - -/** - * Unsets the value of the "kind" attribute of this Group_t. - * - * @param g the Group_t structure. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * - * @copydetails doc_group_kind - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_unsetKind(Group_t * g); - - -/** - * Returns a ListOf_t * containing Member_t objects from this Group_t. - * - * @param g the Group_t structure whose ListOfMembers is sought. - * - * @return the ListOfMembers from this Group_t as a ListOf_t *. - * - * @copydetails doc_returned_unowned_pointer - * - * @see Group_addMember() - * @see Group_createMember() - * @see Group_getMemberById() - * @see Group_getMember() - * @see Group_getNumMembers() - * @see Group_removeMemberById() - * @see Group_removeMember() - * - * @memberof Group_t - */ -LIBSBML_EXTERN -ListOf_t* -Group_getListOfMembers(Group_t* g); - - -/** - * Get a Member_t from the Group_t. - * - * @param g the Group_t structure to search. - * - * @param n an unsigned int representing the index of the Member_t to retrieve. - * - * @return the nth Member_t in the ListOfMembers within this Group or @c NULL - * if no such object exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Member_t* -Group_getMember(Group_t* g, unsigned int n); - - -/** - * Get a Member_t from the Group_t based on its identifier. - * - * @param g the Group_t structure to search. - * - * @param sid a string representing the identifier of the Member_t to retrieve. - * - * @return the Member_t in the ListOfMembers within this Group with the given - * @p sid or @c NULL if no such Member_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Member_t* -Group_getMemberById(Group_t* g, const char *sid); - - -/** - * Get a Member_t from the Group_t based on the element to which it refers. - * - * @param g the Group_t structure to search. - * - * @param sid a string representing the "idRef" attribute of the Member_t - * object to retrieve. - * - * @return the first Member_t in this Group_t based on the given idRef - * attribute or NULL if no such Member_t exists. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Member_t* -Group_getMemberByIdRef(Group_t* g, const char *sid); - - -/** - * Adds a copy of the given Member_t to this Group_t. - * - * @param g the Group_t structure to which the Member_t should be added. - * - * @param m the Member_t object to add. - * - * @copydetails doc_returns_success_code - * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} - * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_addMember(Group_t* g, const Member_t* m); - - -/** - * Get the number of Member_t objects in this Group_t. - * - * @param g the Group_t structure to query. - * - * @return the number of Member_t objects in this Group_t. - * - * @memberof Group_t - */ -LIBSBML_EXTERN -unsigned int -Group_getNumMembers(Group_t* g); - - -/** - * Creates a new Member_t object, adds it to this Group_t object and returns - * the Member_t object created. - * - * @param g the Group_t structure to which the Member_t should be added. - * - * @return a new Member_t object instance. - * - * @copydetails doc_returned_unowned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Member_t* -Group_createMember(Group_t* g); - - -/** - * Removes the nth Member_t from this Group_t and returns a pointer to it. - * - * @param g the Group_t structure to search. - * - * @param n an unsigned int representing the index of the Member_t to remove. - * - * @return a pointer to the nth Member_t in this Group_t. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Member_t* -Group_removeMember(Group_t* g, unsigned int n); - - -/** - * Removes the Member_t from this Group_t based on its identifier and returns a - * pointer to it. - * - * @param g the Group_t structure to search. - * - * @param sid a string representing the identifier of the Member_t to remove. - * - * @return the Member_t in this Group_t based on the identifier or NULL if no - * such Member_t exists. - * - * @copydetails doc_warning_returns_owned_pointer - * - * @memberof Group_t - */ -LIBSBML_EXTERN -Member_t* -Group_removeMemberById(Group_t* g, const char* sid); - - -/** - * Predicate returning @c 1 (true) if all the required attributes for this - * Group_t object have been set. - * - * @param g the Group_t structure. - * - * @return @c 1 (true) to indicate that all the required attributes of this - * Group_t have been set, otherwise @c 0 (false) is returned. - * - * - * @note The required attributes for the Group_t object are: - * @li "kind" - * - * @memberof Group_t - */ -LIBSBML_EXTERN -int -Group_hasRequiredAttributes(const Group_t * g); - - - - -END_C_DECLS - - - - -LIBSBML_CPP_NAMESPACE_END - - - - -#endif /* !SWIG */ - - - - -#endif /* !Group_H__ */ - - +/** + * @file Group.h + * @brief Definition of the Group class. + * @author SBMLTeam + * + * + * + * @class Group + * @sbmlbrief{groups} TODO:Definition of the Group class. + */ + +/** + * + * + * + * @class doc_group_kind + * + * @par + * The attribute "kind" on a Group object is used to TODO:add explanation + * + * In the SBML + * Level 3 Version 1 Groups specification, the following are the + * allowable values for "kind": + *
    + *
  • @c "classification", TODO:add description + * + *
  • @c "partonomy", TODO:add description + * + *
  • @c "collection", TODO:add description + * + *
+ */ + + +#ifndef Group_H__ +#define Group_H__ + + +#include +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBSBML_CPP_NAMESPACE_BEGIN + + +class LIBSBML_EXTERN Group : public SBase +{ +protected: + + /** @cond doxygenLibsbmlInternal */ + + GroupKind_t mKind; + ListOfMembers mMembers; + + /** @endcond */ + +public: + + /** + * Creates a new Group using the given SBML Level, Version and + * “groups” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Group. + * + * @param version an unsigned int, the SBML Version to assign to this Group. + * + * @param pkgVersion an unsigned int, the SBML Groups Version to assign to + * this Group. + * + * @copydetails doc_note_setting_lv_pkg + */ + Group(unsigned int level = GroupsExtension::getDefaultLevel(), + unsigned int version = GroupsExtension::getDefaultVersion(), + unsigned int pkgVersion = GroupsExtension::getDefaultPackageVersion()); + + + /** + * Creates a new Group using the given GroupsPkgNamespaces object. + * + * @copydetails doc_what_are_sbml_package_namespaces + * + * @param groupsns the GroupsPkgNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + Group(GroupsPkgNamespaces *groupsns); + + + /** + * Copy constructor for Group. + * + * @param orig the Group instance to copy. + */ + Group(const Group& orig); + + + /** + * Assignment operator for Group. + * + * @param rhs the Group object whose values are to be used as the basis of + * the assignment. + */ + Group& operator=(const Group& rhs); + + + /** + * Creates and returns a deep copy of this Group object. + * + * @return a (deep) copy of this Group object. + */ + virtual Group* clone() const; + + + /** + * Destructor for Group. + */ + virtual ~Group(); + + + /** + * Returns the value of the "id" attribute of this Group. + * + * @return the value of the "id" attribute of this Group as a string. + */ + virtual const std::string& getId() const; + + + /** + * Returns the value of the "name" attribute of this Group. + * + * @return the value of the "name" attribute of this Group as a string. + */ + virtual const std::string& getName() const; + + + /** + * Returns the value of the "kind" attribute of this Group. + * + * @return the value of the "kind" attribute of this Group as a GroupKind_t. + * + * @copydetails doc_group_kind + * @if clike The value is drawn from the enumeration @ref GroupKind_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{GROUP_KIND_CLASSIFICATION, GroupKind_t} + * @li @sbmlconstant{GROUP_KIND_PARTONOMY, GroupKind_t} + * @li @sbmlconstant{GROUP_KIND_COLLECTION, GroupKind_t} + * @li @sbmlconstant{GROUP_KIND_INVALID, GroupKind_t} + */ + GroupKind_t getKind() const; + + + /** + * Returns the value of the "kind" attribute of this Group. + * + * @return the value of the "kind" attribute of this Group as a string. + * + * @copydetails doc_group_kind + * The possible values returned by this method are: + * @li @c "classification" + * @li @c "partonomy" + * @li @c "collection" + * @li @c "invalid GroupKind value" + */ + std::string getKindAsString() const; + + + /** + * Predicate returning @c true if this Group's "id" attribute is set. + * + * @return @c true if this Group's "id" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetId() const; + + + /** + * Predicate returning @c true if this Group's "name" attribute is set. + * + * @return @c true if this Group's "name" attribute has been set, otherwise + * @c false is returned. + */ + virtual bool isSetName() const; + + + /** + * Predicate returning @c true if this Group's "kind" attribute is set. + * + * @return @c true if this Group's "kind" attribute has been set, otherwise + * @c false is returned. + * + * @copydetails doc_group_kind + */ + bool isSetKind() const; + + + /** + * Sets the value of the "id" attribute of this Group. + * + * @param id std::string& value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is + * equivalent to calling unsetId(). + */ + virtual int setId(const std::string& id); + + + /** + * Sets the value of the "name" attribute of this Group. + * + * @param name std::string& value of the "name" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p name = @c NULL or an empty string is + * equivalent to calling unsetName(). + */ + virtual int setName(const std::string& name); + + + /** + * Sets the value of the "kind" attribute of this Group. + * + * @param kind @if clike GroupKind_t@else int@endif value of the "kind" + * attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_group_kind + */ + int setKind(const GroupKind_t kind); + + + /** + * Sets the value of the "kind" attribute of this Group. + * + * @param kind std::string& of the "kind" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, + * OperationReturnValues_t} + * + * @copydetails doc_group_kind + */ + int setKind(const std::string& kind); + + + /** + * Unsets the value of the "id" attribute of this Group. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetId(); + + + /** + * Unsets the value of the "name" attribute of this Group. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetName(); + + + /** + * Unsets the value of the "kind" attribute of this Group. + * + * @copydetails doc_returns_one_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * + * @copydetails doc_group_kind + */ + int unsetKind(); + + + /** + * Returns the ListOfMembers from this Group. + * + * @return the ListOfMembers from this Group. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(const std::string& sid) + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + const ListOfMembers* getListOfMembers() const; + + + /** + * Returns the ListOfMembers from this Group. + * + * @return the ListOfMembers from this Group. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(const std::string& sid) + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + ListOfMembers* getListOfMembers(); + + + /** + * Get a Member from the Group. + * + * @param n an unsigned int representing the index of the Member to retrieve. + * + * @return the nth Member in the ListOfMembers within this Group or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(const std::string& sid) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + Member* getMember(unsigned int n); + + + /** + * Get a Member from the Group. + * + * @param n an unsigned int representing the index of the Member to retrieve. + * + * @return the nth Member in the ListOfMembers within this Group or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(const std::string& sid) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + const Member* getMember(unsigned int n) const; + + + /** + * Get a Member from the Group based on its identifier. + * + * @param sid a string representing the identifier of the Member to retrieve. + * + * @return the Member in the ListOfMembers within this Group with the given + * @p sid or @c NULL if no such Member exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + Member* getMember(const std::string& sid); + + + /** + * Get a Member from the Group based on its identifier. + * + * @param sid a string representing the identifier of the Member to retrieve. + * + * @return the Member in the ListOfMembers within this Group with the given + * @p sid or @c NULL if no such Member exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + const Member* getMember(const std::string& sid) const; + + + /** + * Get a Member from the Group based on the element to which it refers. + * + * @param sid a string representing the "idRef" attribute of the Member + * object to retrieve. + * + * @return the first Member in this Group based on the given idRef attribute + * or NULL if no such Member exists. + * + * @copydetails doc_returned_unowned_pointer + */ + const Member* getMemberByIdRef(const std::string& sid) const; + + + /** + * Get a Member from the Group based on the element to which it refers. + * + * @param sid a string representing the "idRef" attribute of the Member + * object to retrieve. + * + * @return the first Member in this Group based on the given idRef attribute + * or NULL if no such Member exists. + * + * @copydetails doc_returned_unowned_pointer + */ + Member* getMemberByIdRef(const std::string& sid); + + + /** + * Adds a copy of the given Member to this Group. + * + * @param m the Member object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createMember() + * @see getMember(const std::string& sid) + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + int addMember(const Member* m); + + + /** + * Get the number of Member objects in this Group. + * + * @return the number of Member objects in this Group. + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(const std::string& sid) + * @see getMember(unsigned int n) + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + unsigned int getNumMembers() const; + + + /** + * Creates a new Member object, adds it to this Group object and returns the + * Member object created. + * + * @return a new Member object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addMember(const Member* object) + * @see getMember(const std::string& sid) + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + * @see removeMember(unsigned int n) + */ + Member* createMember(); + + + /** + * Removes the nth Member from this Group and returns a pointer to it. + * + * @param n an unsigned int representing the index of the Member to remove. + * + * @return a pointer to the nth Member in this Group. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(const std::string& sid) + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(const std::string& sid) + */ + Member* removeMember(unsigned int n); + + + /** + * Removes the Member from this Group based on its identifier and returns a + * pointer to it. + * + * @param sid a string representing the identifier of the Member to remove. + * + * @return the Member in this Group based on the identifier or NULL if no + * such Member exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @see addMember(const Member* object) + * @see createMember() + * @see getMember(const std::string& sid) + * @see getMember(unsigned int n) + * @see getNumMembers() + * @see removeMember(unsigned int n) + */ + Member* removeMember(const std::string& sid); + + + /** + * Returns the XML element name of this Group object. + * + * For Group, the XML element name is always @c "group". + * + * @return the name of this element, i.e. @c "group". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libSBML type code for this Group object. + * + * @copydetails doc_what_are_typecodes + * + * @return the SBML type code for this object: + * @sbmlconstant{SBML_GROUPS_GROUP, SBMLGroupsTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + * @see getPackageName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this Group + * object have been set. + * + * @return @c true to indicate that all the required attributes of this Group + * have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the Group object are: + * @li "kind" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(XMLOutputStream& stream) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Accepts the given SBMLVisitor + */ + virtual bool accept(SBMLVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the parent SBMLDocument + */ + virtual void setSBMLDocument(SBMLDocument* d); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Enables/disables the given package with this element + */ + virtual void enablePackageInternal(const std::string& pkgURI, + const std::string& pkgPrefix, + bool flag); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Updates the namespaces when setLevelVersion is used + */ + virtual void updateSBMLNamespace(const std::string& package, + unsigned int level, + unsigned int version); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Gets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Predicate returning @c true if this Group's attribute "attributeName" is + * set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this Group's attribute "attributeName" has been set, + * otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Sets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this Group. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates and returns an new "elementName" object in this Group. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual SBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds a new "elementName" object to this Group. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const SBase* element); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * Group. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual SBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the number of "elementName" in this Group. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Returns the nth object of "objectName" in this Group. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual SBase* getObject(const std::string& elementName, unsigned int index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual SBase* getElementBySId(const std::string& id); + + + /** + * Returns the first child element that has the given @p metaid, or @c NULL + * if no such object is found. + * + * @param metaid a string representing the metaid attribute of the object to + * retrieve. + * + * @return a pointer to the SBase element with the given @p metaid. If no + * such object is found this method returns @c NULL. + */ + virtual SBase* getElementByMetaId(const std::string& metaid); + + + /** + * Returns a List of all child SBase objects, including those nested to an + * arbitrary depth. + * + * @param filter an ElementFilter that may impose restrictions on the objects + * to be retrieved. + * + * @return a List pointer of pointers to all SBase child objects with any + * restriction imposed. + */ + virtual List* getAllElements(ElementFilter * filter = NULL); + + +protected: + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual SBase* createObject(XMLInputStream& stream); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes(const XMLAttributes& attributes, + const ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenLibsbmlInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(XMLOutputStream& stream) const; + + /** @endcond */ + + +}; + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBSBML_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new Group_t using the given SBML Level, Version and + * “groups” package version. + * + * @param level an unsigned int, the SBML Level to assign to this Group_t. + * + * @param version an unsigned int, the SBML Version to assign to this Group_t. + * + * @param pkgVersion an unsigned int, the SBML Groups Version to assign to this + * Group_t. + * + * @copydetails doc_note_setting_lv_pkg + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Group_t * +Group_create(unsigned int level, + unsigned int version, + unsigned int pkgVersion); + + +/** + * Creates and returns a deep copy of this Group_t object. + * + * @param g the Group_t structure. + * + * @return a (deep) copy of this Group_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Group_t* +Group_clone(const Group_t* g); + + +/** + * Frees this Group_t object. + * + * @param g the Group_t structure. + * + * @memberof Group_t + */ +LIBSBML_EXTERN +void +Group_free(Group_t* g); + + +/** + * Returns the value of the "id" attribute of this Group_t. + * + * @param g the Group_t structure whose id is sought. + * + * @return the value of the "id" attribute of this Group_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Group_t + */ +LIBSBML_EXTERN +char * +Group_getId(const Group_t * g); + + +/** + * Returns the value of the "name" attribute of this Group_t. + * + * @param g the Group_t structure whose name is sought. + * + * @return the value of the "name" attribute of this Group_t as a pointer to a + * string. + * + * @copydetails doc_returned_owned_char + * + * @memberof Group_t + */ +LIBSBML_EXTERN +char * +Group_getName(const Group_t * g); + + +/** + * Returns the value of the "kind" attribute of this Group_t. + * + * @param g the Group_t structure whose kind is sought. + * + * @return the value of the "kind" attribute of this Group_t as a GroupKind_t. + * + * @copydetails doc_group_kind + * @if clike The value is drawn from the enumeration @ref GroupKind_t @endif + * The possible values returned by this method are: + * @li @sbmlconstant{GROUP_KIND_CLASSIFICATION, GroupKind_t} + * @li @sbmlconstant{GROUP_KIND_PARTONOMY, GroupKind_t} + * @li @sbmlconstant{GROUP_KIND_COLLECTION, GroupKind_t} + * @li @sbmlconstant{GROUP_KIND_INVALID, GroupKind_t} + * + * @memberof Group_t + */ +LIBSBML_EXTERN +GroupKind_t +Group_getKind(const Group_t * g); + + +/** + * Returns the value of the "kind" attribute of this Group_t. + * + * @param g the Group_t structure whose kind is sought. + * + * @return the value of the "kind" attribute of this Group_t as a const char *. + * + * @copydetails doc_returned_unowned_char + * + * @copydetails doc_group_kind + * The possible values returned by this method are: + * @li @c "classification" + * @li @c "partonomy" + * @li @c "collection" + * @li @c "invalid GroupKind value" + * + * @memberof Group_t + */ +LIBSBML_EXTERN +char * +Group_getKindAsString(const Group_t * g); + + +/** + * Predicate returning @c 1 (true) if this Group_t's "id" attribute is set. + * + * @param g the Group_t structure. + * + * @return @c 1 (true) if this Group_t's "id" attribute has been set, otherwise + * @c 0 (false) is returned. + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_isSetId(const Group_t * g); + + +/** + * Predicate returning @c 1 (true) if this Group_t's "name" attribute is set. + * + * @param g the Group_t structure. + * + * @return @c 1 (true) if this Group_t's "name" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_isSetName(const Group_t * g); + + +/** + * Predicate returning @c 1 (true) if this Group_t's "kind" attribute is set. + * + * @param g the Group_t structure. + * + * @return @c 1 (true) if this Group_t's "kind" attribute has been set, + * otherwise @c 0 (false) is returned. + * + * @copydetails doc_group_kind + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_isSetKind(const Group_t * g); + + +/** + * Sets the value of the "id" attribute of this Group_t. + * + * @param g the Group_t structure. + * + * @param id const char * value of the "id" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p id = @c NULL or an empty string is equivalent + * to calling Group_unsetId(). + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_setId(Group_t * g, const char * id); + + +/** + * Sets the value of the "name" attribute of this Group_t. + * + * @param g the Group_t structure. + * + * @param name const char * value of the "name" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p name = @c NULL or an empty string is + * equivalent to calling Group_unsetName(). + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_setName(Group_t * g, const char * name); + + +/** + * Sets the value of the "kind" attribute of this Group_t. + * + * @param g the Group_t structure. + * + * @param kind GroupKind_t value of the "kind" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_group_kind + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_setKind(Group_t * g, GroupKind_t kind); + + +/** + * Sets the value of the "kind" attribute of this Group_t. + * + * @param g the Group_t structure. + * + * @param kind const char * of the "kind" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_group_kind + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_setKindAsString(Group_t * g, const char * kind); + + +/** + * Unsets the value of the "id" attribute of this Group_t. + * + * @param g the Group_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_unsetId(Group_t * g); + + +/** + * Unsets the value of the "name" attribute of this Group_t. + * + * @param g the Group_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_unsetName(Group_t * g); + + +/** + * Unsets the value of the "kind" attribute of this Group_t. + * + * @param g the Group_t structure. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * + * @copydetails doc_group_kind + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_unsetKind(Group_t * g); + + +/** + * Returns a ListOf_t * containing Member_t objects from this Group_t. + * + * @param g the Group_t structure whose ListOfMembers is sought. + * + * @return the ListOfMembers from this Group_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see Group_addMember() + * @see Group_createMember() + * @see Group_getMemberById() + * @see Group_getMember() + * @see Group_getNumMembers() + * @see Group_removeMemberById() + * @see Group_removeMember() + * + * @memberof Group_t + */ +LIBSBML_EXTERN +ListOf_t* +Group_getListOfMembers(Group_t* g); + + +/** + * Get a Member_t from the Group_t. + * + * @param g the Group_t structure to search. + * + * @param n an unsigned int representing the index of the Member_t to retrieve. + * + * @return the nth Member_t in the ListOfMembers within this Group or @c NULL + * if no such object exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Member_t* +Group_getMember(Group_t* g, unsigned int n); + + +/** + * Get a Member_t from the Group_t based on its identifier. + * + * @param g the Group_t structure to search. + * + * @param sid a string representing the identifier of the Member_t to retrieve. + * + * @return the Member_t in the ListOfMembers within this Group with the given + * @p sid or @c NULL if no such Member_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Member_t* +Group_getMemberById(Group_t* g, const char *sid); + + +/** + * Get a Member_t from the Group_t based on the element to which it refers. + * + * @param g the Group_t structure to search. + * + * @param sid a string representing the "idRef" attribute of the Member_t + * object to retrieve. + * + * @return the first Member_t in this Group_t based on the given idRef + * attribute or NULL if no such Member_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Member_t* +Group_getMemberByIdRef(Group_t* g, const char *sid); + + +/** + * Adds a copy of the given Member_t to this Group_t. + * + * @param g the Group_t structure to which the Member_t should be added. + * + * @param m the Member_t object to add. + * + * @copydetails doc_returns_success_code + * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_addMember(Group_t* g, const Member_t* m); + + +/** + * Get the number of Member_t objects in this Group_t. + * + * @param g the Group_t structure to query. + * + * @return the number of Member_t objects in this Group_t. + * + * @memberof Group_t + */ +LIBSBML_EXTERN +unsigned int +Group_getNumMembers(Group_t* g); + + +/** + * Creates a new Member_t object, adds it to this Group_t object and returns + * the Member_t object created. + * + * @param g the Group_t structure to which the Member_t should be added. + * + * @return a new Member_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Member_t* +Group_createMember(Group_t* g); + + +/** + * Removes the nth Member_t from this Group_t and returns a pointer to it. + * + * @param g the Group_t structure to search. + * + * @param n an unsigned int representing the index of the Member_t to remove. + * + * @return a pointer to the nth Member_t in this Group_t. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Member_t* +Group_removeMember(Group_t* g, unsigned int n); + + +/** + * Removes the Member_t from this Group_t based on its identifier and returns a + * pointer to it. + * + * @param g the Group_t structure to search. + * + * @param sid a string representing the identifier of the Member_t to remove. + * + * @return the Member_t in this Group_t based on the identifier or NULL if no + * such Member_t exists. + * + * @copydetails doc_warning_returns_owned_pointer + * + * @memberof Group_t + */ +LIBSBML_EXTERN +Member_t* +Group_removeMemberById(Group_t* g, const char* sid); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * Group_t object have been set. + * + * @param g the Group_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * Group_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the Group_t object are: + * @li "kind" + * + * @memberof Group_t + */ +LIBSBML_EXTERN +int +Group_hasRequiredAttributes(const Group_t * g); + + + + +END_C_DECLS + + + + +LIBSBML_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !Group_H__ */ + + diff --git a/generator/tests/test_cpp_code/test-code/Label.cpp b/generator/tests/test_cpp_code/test-code/Label.cpp index 383dec19..5c27b37c 100644 --- a/generator/tests/test_cpp_code/test-code/Label.cpp +++ b/generator/tests/test_cpp_code/test-code/Label.cpp @@ -1,1269 +1,1269 @@ -/** - * @file Label.cpp - * @brief Implementation of the Label class. - * @author DEVISER - * - * - */ -#include -#include - - -using namespace std; - - - -LIBSBGN_CPP_NAMESPACE_BEGIN - - - - -#ifdef __cplusplus - - -/* - * Creates a new Label using the given SBGN Level and @ p version values. - */ -Label::Label(unsigned int level, unsigned int version) - : SBase(level, version) - , mText ("") - , mBBox (NULL) -{ - setSbgnNamespacesAndOwn(new SbgnNamespaces(level, version)); - connectToChild(); -} - - -/* - * Creates a new Label using the given SbgnNamespaces object @p sbgnns. - */ -Label::Label(SbgnNamespaces *sbgnns) - : SBase(sbgnns) - , mText ("") - , mBBox (NULL) -{ - setElementNamespace(sbgnns->getURI()); - connectToChild(); -} - - -/* - * Copy constructor for Label. - */ -Label::Label(const Label& orig) - : SBase( orig ) - , mText ( orig.mText ) - , mBBox ( NULL ) -{ - if (orig.mBBox != NULL) - { - mBBox = orig.mBBox->clone(); - } - - connectToChild(); -} - - -/* - * Assignment operator for Label. - */ -Label& -Label::operator=(const Label& rhs) -{ - if (&rhs != this) - { - SBase::operator=(rhs); - mText = rhs.mText; - delete mBBox; - if (rhs.mBBox != NULL) - { - mBBox = rhs.mBBox->clone(); - } - else - { - mBBox = NULL; - } - - connectToChild(); - } - - return *this; -} - - -/* - * Creates and returns a deep copy of this Label object. - */ -Label* -Label::clone() const -{ - return new Label(*this); -} - - -/* - * Destructor for Label. - */ -Label::~Label() -{ - delete mBBox; - mBBox = NULL; -} - - -/* - * Returns the value of the "id" attribute of this Label. - */ -const std::string& -Label::getId() const -{ - return mId; -} - - -/* - * Returns the value of the "text" attribute of this Label. - */ -const std::string& -Label::getText() const -{ - return mText; -} - - -/* - * Predicate returning @c true if this Label's "id" attribute is set. - */ -bool -Label::isSetId() const -{ - return (mId.empty() == false); -} - - -/* - * Predicate returning @c true if this Label's "text" attribute is set. - */ -bool -Label::isSetText() const -{ - return (mText.empty() == false); -} - - -/* - * Sets the value of the "id" attribute of this Label. - */ -int -Label::setId(const std::string& id) -{ - if (!(SyntaxChecker::isValidXMLID(id))) - { - return LIBSBGN_INVALID_ATTRIBUTE_VALUE; - } - else - { - mId = id; - return LIBSBGN_OPERATION_SUCCESS; - } -} - - -/* - * Sets the value of the "text" attribute of this Label. - */ -int -Label::setText(const std::string& text) -{ - mText = text; - return LIBSBGN_OPERATION_SUCCESS; -} - - -/* - * Unsets the value of the "id" attribute of this Label. - */ -int -Label::unsetId() -{ - mId.erase(); - - if (mId.empty() == true) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - return LIBSBGN_OPERATION_FAILED; - } -} - - -/* - * Unsets the value of the "text" attribute of this Label. - */ -int -Label::unsetText() -{ - mText.erase(); - - if (mText.empty() == true) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - return LIBSBGN_OPERATION_FAILED; - } -} - - -/* - * Returns the value of the "bbox" element of this Label. - */ -const BBox* -Label::getBBox() const -{ - return mBBox; -} - - -/* - * Returns the value of the "bbox" element of this Label. - */ -BBox* -Label::getBBox() -{ - return mBBox; -} - - -/* - * Predicate returning @c true if this Label's "bbox" element is set. - */ -bool -Label::isSetBBox() const -{ - return (mBBox != NULL); -} - - -/* - * Sets the value of the "bbox" element of this Label. - */ -int -Label::setBBox(const BBox* bbox) -{ - if (mBBox == bbox) - { - return LIBSBGN_OPERATION_SUCCESS; - } - else if (bbox == NULL) - { - delete mBBox; - mBBox = NULL; - return LIBSBGN_OPERATION_SUCCESS; - } - else - { - delete mBBox; - mBBox = (bbox != NULL) ? bbox->clone() : NULL; - if (mBBox != NULL) - { - mBBox->connectToParent(this); - } - - return LIBSBGN_OPERATION_SUCCESS; - } -} - - -/* - * Creates a new BBox object, adds it to this Label object and returns the BBox - * object created. - */ -BBox* -Label::createBBox() -{ - if (mBBox != NULL) - { - delete mBBox; - } - - mBBox = new BBox(getSbgnNamespaces()); - - connectToChild(); - - return mBBox; -} - - -/* - * Unsets the value of the "bbox" element of this Label. - */ -int -Label::unsetBBox() -{ - delete mBBox; - mBBox = NULL; - return LIBSBGN_OPERATION_SUCCESS; -} - - -/* - * Returns the XML element name of this Label object. - */ -const std::string& -Label::getElementName() const -{ - static const string name = "label"; - return name; -} - - -/* - * Returns the libSBGN type code for this Label object. - */ -int -Label::getTypeCode() const -{ - return SBGN_SBGNML_LABEL; -} - - -/* - * Predicate returning @c true if all the required attributes for this Label - * object have been set. - */ -bool -Label::hasRequiredAttributes() const -{ - bool allPresent = SBase::hasRequiredAttributes(); - - if (isSetText() == false) - { - allPresent = false; - } - - return allPresent; -} - - -/* - * Predicate returning @c true if all the required elements for this Label - * object have been set. - */ -bool -Label::hasRequiredElements() const -{ - bool allPresent = SBase::hasRequiredElements(); - - return allPresent; -} - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Write any contained elements - */ -void -Label::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) - const -{ - SBase::writeElements(stream); - - if (isSetBBox() == true) - { - mBBox->write(stream); - } -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Accepts the given SbgnVisitor - */ -bool -Label::accept(SbgnVisitor& v) const -{ - return false; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the parent SbgnDocument - */ -void -Label::setSbgnDocument(SbgnDocument* d) -{ - SBase::setSbgnDocument(d); - - if (mBBox != NULL) - { - mBBox->setSbgnDocument(d); - } -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Connects to child elements - */ -void -Label::connectToChild() -{ - SBase::connectToChild(); - - if (mBBox != NULL) - { - mBBox->connectToParent(this); - } -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Label. - */ -int -Label::getAttribute(const std::string& attributeName, bool& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Label. - */ -int -Label::getAttribute(const std::string& attributeName, int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Label. - */ -int -Label::getAttribute(const std::string& attributeName, double& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Label. - */ -int -Label::getAttribute(const std::string& attributeName, - unsigned int& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Gets the value of the "attributeName" attribute of this Label. - */ -int -Label::getAttribute(const std::string& attributeName, - std::string& value) const -{ - int return_value = SBase::getAttribute(attributeName, value); - - if (return_value == LIBSBGN_OPERATION_SUCCESS) - { - return return_value; - } - - if (attributeName == "id") - { - value = getId(); - return_value = LIBSBGN_OPERATION_SUCCESS; - } - else if (attributeName == "text") - { - value = getText(); - return_value = LIBSBGN_OPERATION_SUCCESS; - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Predicate returning @c true if this Label's attribute "attributeName" is - * set. - */ -bool -Label::isSetAttribute(const std::string& attributeName) const -{ - bool value = SBase::isSetAttribute(attributeName); - - if (attributeName == "id") - { - value = isSetId(); - } - else if (attributeName == "text") - { - value = isSetText(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Label. - */ -int -Label::setAttribute(const std::string& attributeName, bool value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Label. - */ -int -Label::setAttribute(const std::string& attributeName, int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Label. - */ -int -Label::setAttribute(const std::string& attributeName, double value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Label. - */ -int -Label::setAttribute(const std::string& attributeName, unsigned int value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Sets the value of the "attributeName" attribute of this Label. - */ -int -Label::setAttribute(const std::string& attributeName, - const std::string& value) -{ - int return_value = SBase::setAttribute(attributeName, value); - - if (attributeName == "id") - { - return_value = setId(value); - } - else if (attributeName == "text") - { - return_value = setText(value); - } - - return return_value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Unsets the value of the "attributeName" attribute of this Label. - */ -int -Label::unsetAttribute(const std::string& attributeName) -{ - int value = SBase::unsetAttribute(attributeName); - - if (attributeName == "id") - { - value = unsetId(); - } - else if (attributeName == "text") - { - value = unsetText(); - } - - return value; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Creates and returns an new "elementName" object in this Label. - */ -SbgnBase* -Label::createChildObject(const std::string& elementName) -{ - SBase* obj = NULL; - - if (elementName == "bbox") - { - return createBBox(); - } - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Adds a new "elementName" object to this Label. - */ -int -Label::addChildObject(const std::string& elementName, const SbgnBase* element) -{ - if (elementName == "bbox" && element->getTypeCode() == SBGN_SBGNML_BBOX) - { - return setBBox((const BBox*)(element)); - } - - return LIBSBML_OPERATION_FAILED; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Removes and returns the new "elementName" object with the given id in this - * Label. - */ -SbgnBase* -Label::removeChildObject(const std::string& elementName, - const std::string& id) -{ - if (elementName == "bbox") - { - BBox * obj = mBBox; - mBBox = NULL; return obj; - } - - return NULL; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Returns the number of "elementName" in this Label. - */ -unsigned int -Label::getNumObjects(const std::string& elementName) -{ - unsigned int n = 0; - - if (elementName == "bbox") - { - if (isSetBBox()) - { - return 1; - } - } - - return n; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Returns the nth object of "objectName" in this Label. - */ -SbgnBase* -Label::getObject(const std::string& elementName, unsigned int index) -{ - SbgnBase* obj = NULL; - - if (elementName == "bbox") - { - return getBBox(); - } - - return obj; -} - -/** @endcond */ - - -/* - * Returns the first child element that has the given @p id in the model-wide - * SId namespace, or @c NULL if no such object is found. - */ -SbgnBase* -Label::getElementBySId(const std::string& id) -{ - if (id.empty()) - { - return NULL; - } - - SbgnBase* obj = NULL; - - if (mBBox != NULL) - { - if (mBBox->getId() == id) - { - return mBBox; - } - - obj = mBBox->getElementBySId(id); - if (obj != NULL) - { - return obj; - } - } - - return obj; -} - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Creates a new object from the next XMLToken on the XMLInputStream - */ -SbgnBase* -Label::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) -{ - SbgnBase* obj = SBase::createObject(stream); - - const std::string& name = stream.peek().getName(); - - if (name == "bbox") - { - if (getErrorLog() && isSetBBox()) - { - getErrorLog()->logError(SbgnmlLabelAllowedElements, getLevel(), - getVersion(), "", getLine(), getColumn()); - } - - delete mBBox; - mBBox = new BBox(getSbgnNamespaces()); - obj = mBBox; - } - - connectToChild(); - - return obj; -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Adds the expected attributes for this element - */ -void -Label::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER - ExpectedAttributes& attributes) -{ - SBase::addExpectedAttributes(attributes); - - attributes.add("id"); - - attributes.add("text"); -} - -/** @endcond */ - - - -/** @cond doxygenlibSBGNInternal */ - -/* - * Reads the expected attributes into the member data variables - */ -void -Label::readAttributes( - const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& - attributes, - const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& - expectedAttributes) -{ - unsigned int level = getLevel(); - unsigned int version = getVersion(); - unsigned int numErrs; - bool assigned = false; - SbgnErrorLog* log = getErrorLog(); - - SBase::readAttributes(attributes, expectedAttributes); - - if (log) - { - numErrs = log->getNumErrors(); - - for (int n = numErrs-1; n >= 0; n--) - { - if (log->getError(n)->getErrorId() == SbgnUnknownCoreAttribute) - { - const std::string details = log->getError(n)->getMessage(); - log->remove(SbgnUnknownCoreAttribute); - log->logError(SbgnmlLabelAllowedAttributes, level, version, details, - getLine(), getColumn()); - } - } - } - - // - // id ID (use = "optional" ) - // - - assigned = attributes.readInto("id", mId); - - if (assigned == true) - { - if (mId.empty() == true) - { - logEmptyString(mId, level, version, "