diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-01-11 11:42:48 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-01-11 11:42:48 (GMT) |
commit | 1415f63ccf0071e217f428d81ad901cfeae8547f (patch) | |
tree | 0c611d60755e3704a3a98b5b79865dbf4ab5e813 /src | |
parent | 10d3c167f435a9b7e6aa7b34d3a833c28acc53ce (diff) |
Adding string getter functions
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/tng_io.c | 143 | ||||
-rw-r--r-- | src/lib/tng_io.h | 197 |
2 files changed, 340 insertions, 0 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 1c19bf6..3b5aee0 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -5672,6 +5672,19 @@ tng_function_status tng_trajectory_destroy(struct tng_trajectory **tng_data_p) return(TNG_SUCCESS); } +tng_function_status tng_input_file_get(const tng_trajectory_t tng_data, + char *file_name, const int max_len) +{ + strncpy(file_name, tng_data->input_file_path, max_len - 1); + file_name[max_len - 1] = 0; + + if(strlen(tng_data->input_file_path) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_input_file_set(tng_trajectory_t tng_data, const char *file_name) { @@ -5705,6 +5718,19 @@ tng_function_status tng_input_file_set(tng_trajectory_t tng_data, return(tng_input_file_init(tng_data, FALSE)); } +tng_function_status tng_output_file_get(const tng_trajectory_t tng_data, + char *file_name, const int max_len) +{ + strncpy(file_name, tng_data->output_file_path, max_len - 1); + file_name[max_len - 1] = 0; + + if(strlen(tng_data->output_file_path) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_output_file_set(tng_trajectory_t tng_data, const char *file_name) { @@ -5739,6 +5765,19 @@ tng_function_status tng_output_file_set(tng_trajectory_t tng_data, } +tng_function_status tng_first_program_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + strncpy(name, tng_data->first_program_name, max_len - 1); + name[max_len - 1] = 0; + + if(strlen(tng_data->first_program_name) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_first_program_name_set(tng_trajectory_t tng_data, const char *new_name) { @@ -5767,6 +5806,19 @@ tng_function_status tng_first_program_name_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_last_program_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + strncpy(name, tng_data->last_program_name, max_len - 1); + name[max_len - 1] = 0; + + if(strlen(tng_data->last_program_name) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_last_program_name_set(tng_trajectory_t tng_data, const char *new_name) { @@ -5795,6 +5847,19 @@ tng_function_status tng_last_program_name_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_first_user_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + strncpy(name, tng_data->first_user_name, max_len - 1); + name[max_len - 1] = 0; + + if(strlen(tng_data->first_user_name) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_first_user_name_set(tng_trajectory_t tng_data, const char *new_name) { @@ -5823,6 +5888,19 @@ tng_function_status tng_first_user_name_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_last_user_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + strncpy(name, tng_data->last_user_name, max_len - 1); + name[max_len - 1] = 0; + + if(strlen(tng_data->last_user_name) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_last_user_name_set(tng_trajectory_t tng_data, const char *new_name) { @@ -5851,6 +5929,19 @@ tng_function_status tng_last_user_name_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_first_computer_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + strncpy(name, tng_data->first_computer_name, max_len - 1); + name[max_len - 1] = 0; + + if(strlen(tng_data->first_computer_name) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_first_computer_name_set(tng_trajectory_t tng_data, const char *new_name) { @@ -5879,6 +5970,19 @@ tng_function_status tng_first_computer_name_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_last_computer_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + strncpy(name, tng_data->last_computer_name, max_len - 1); + name[max_len - 1] = 0; + + if(strlen(tng_data->last_computer_name) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_last_computer_name_set(tng_trajectory_t tng_data, const char *new_name) { @@ -5907,6 +6011,19 @@ tng_function_status tng_last_computer_name_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_first_signature_get(const tng_trajectory_t tng_data, + char *signature, const int max_len) +{ + strncpy(signature, tng_data->first_pgp_signature, max_len - 1); + signature[max_len - 1] = 0; + + if(strlen(tng_data->first_pgp_signature) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_first_signature_set(tng_trajectory_t tng_data, const char *signature) { @@ -5935,6 +6052,19 @@ tng_function_status tng_first_signature_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_last_signature_get(const tng_trajectory_t tng_data, + char *signature, const int max_len) +{ + strncpy(signature, tng_data->last_pgp_signature, max_len - 1); + signature[max_len - 1] = 0; + + if(strlen(tng_data->last_pgp_signature) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_last_signature_set(tng_trajectory_t tng_data, const char *signature) { @@ -5963,6 +6093,19 @@ tng_function_status tng_last_signature_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_forcefield_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + strncpy(name, tng_data->forcefield_name, max_len - 1); + name[max_len - 1] = 0; + + if(strlen(tng_data->forcefield_name) > max_len - 1) + { + return(TNG_FAILURE); + } + return(TNG_SUCCESS); +} + tng_function_status tng_forcefield_name_set(tng_trajectory_t tng_data, const char *new_name) { diff --git a/src/lib/tng_io.h b/src/lib/tng_io.h index 22990e1..10e4f94 100644 --- a/src/lib/tng_io.h +++ b/src/lib/tng_io.h @@ -353,6 +353,24 @@ tng_function_status tng_trajectory_destroy_(tng_trajectory_t *tng_data_p) } /** + * @brief Get the name of the input file. + * @param tng_data the trajectory of which to get the input file name. + * @param file_name the string to fill with the name of the input file, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for file_name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_input_file_get(const tng_trajectory_t tng_data, + char *file_name, const int max_len); +tng_function_status tng_input_file_get_(const tng_trajectory_t tng_data, + char *file_name, const int max_len) +{ + return(tng_input_file_get(tng_data, file_name, max_len)); +} + +/** * @brief Set the name of the input file. * @param tng_data the trajectory of which to set the input file name. * @param file_name the name of the input file. @@ -375,6 +393,24 @@ tng_function_status tng_input_file_set_(tng_trajectory_t tng_data, } /** + * @brief Get the name of the output file. + * @param tng_data the trajectory of which to get the input file name. + * @param file_name the string to fill with the name of the output file, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for file_name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_output_file_get(const tng_trajectory_t tng_data, + char *file_name, const int max_len); +tng_function_status tng_output_file_get_(const tng_trajectory_t tng_data, + char *file_name, const int max_len) +{ + return(tng_output_file_get(tng_data, file_name, max_len)); +} + +/** * @brief Set the name of the output file. * @param tng_data the trajectory of which to set the output file name. * @param file_name the name of the output file. @@ -397,6 +433,24 @@ tng_function_status tng_output_file_set_(tng_trajectory_t tng_data, } /** + * @brief Get the name of the program used when creating the trajectory. + * @param tng_data the trajectory of which to get the program name. + * @param name the string to fill with the name of the program, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_first_program_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len); +tng_function_status tng_first_program_name_get_(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + return(tng_first_program_name_get(tng_data, name, max_len)); +} + +/** * @brief Set the name of the program used when creating the trajectory. * @param tng_data the trajectory of which to set the program name. * @param new_name is a string containing the wanted name. @@ -420,6 +474,24 @@ tng_function_status tng_first_program_name_set_(tng_trajectory_t tng_data, } /** + * @brief Get the name of the program used when last modifying the trajectory. + * @param tng_data the trajectory of which to get the program name. + * @param name the string to fill with the name of the program, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_last_program_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len); +tng_function_status tng_last_program_name_get_(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + return(tng_last_program_name_get(tng_data, name, max_len)); +} + +/** * @brief Set the name of the program used when last modifying the trajectory. * @param tng_data the trajectory of which to set the program name. * @param new_name is a string containing the wanted name. @@ -442,6 +514,23 @@ tng_function_status tng_last_program_name_set_(tng_trajectory_t tng_data, return(stat); } +/** + * @brief Get the name of the user who created the trajectory. + * @param tng_data the trajectory of which to get the user name. + * @param name the string to fill with the name of the user, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_first_user_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len); +tng_function_status tng_first_user_name_get_(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + return(tng_first_user_name_get(tng_data, name, max_len)); +} /** * @brief Set the name of the user who created the trajectory. @@ -467,6 +556,24 @@ tng_function_status tng_first_user_name_set_(tng_trajectory_t tng_data, } /** + * @brief Get the name of the user who last modified the trajectory. + * @param tng_data the trajectory of which to get the user name. + * @param name the string to fill with the name of the user, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_last_user_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len); +tng_function_status tng_last_user_name_get_(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + return(tng_last_user_name_get(tng_data, name, max_len)); +} + +/** * @brief Set the name of the user who last modified the trajectory. * @param tng_data the trajectory of which to set the user name. * @param new_name is a string containing the wanted name. @@ -491,6 +598,24 @@ tng_function_status tng_last_user_name_set_(tng_trajectory_t tng_data, /** + * @brief Get the name of the computer used when creating the trajectory. + * @param tng_data the trajectory of which to get the computer name. + * @param name the string to fill with the name of the computer, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_first_computer_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len); +tng_function_status tng_first_computer_name_get_(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + return(tng_first_computer_name_get(tng_data, name, max_len)); +} + +/** * @brief Set the name of the computer used when creating the trajectory. * @param tng_data the trajectory of which to set the computer name. * @param new_name is a string containing the wanted name. @@ -514,6 +639,24 @@ tng_function_status tng_first_computer_name_set_(tng_trajectory_t tng_data, } /** + * @brief Get the name of the computer used when last modifying the trajectory. + * @param tng_data the trajectory of which to get the computer name. + * @param name the string to fill with the name of the computer, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_last_computer_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len); +tng_function_status tng_last_computer_name_get_(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + return(tng_last_computer_name_get(tng_data, name, max_len)); +} + +/** * @brief Set the name of the computer used when last modifying the trajectory. * @param tng_data the trajectory of which to set the computer name. * @param new_name is a string containing the wanted name. @@ -537,6 +680,24 @@ tng_function_status tng_last_computer_name_set_(tng_trajectory_t tng_data, } /** + * @brief Get the pgp_signature of the user creating the trajectory. + * @param tng_data the trajectory of which to get the computer name. + * @param signature the string to fill with the signature, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_first_signature_get(const tng_trajectory_t tng_data, + char *signature, const int max_len); +tng_function_status tng_first_signature_get_(const tng_trajectory_t tng_data, + char *signature, const int max_len) +{ + return(tng_first_signature_get(tng_data, signature, max_len)); +} + +/** * @brief Set the pgp_signature of the user creating the trajectory. * @param tng_data the trajectory of which to set the computer name. * @param signature is a string containing the pgp_signature. @@ -560,6 +721,24 @@ tng_function_status tng_first_signature_set_(tng_trajectory_t tng_data, } /** + * @brief Get the pgp_signature of the user last modifying the trajectory. + * @param tng_data the trajectory of which to get the computer name. + * @param signature the string to fill with the signature, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_last_signature_get(const tng_trajectory_t tng_data, + char *signature, const int max_len); +tng_function_status tng_last_signature_get_(const tng_trajectory_t tng_data, + char *signature, const int max_len) +{ + return(tng_last_signature_get(tng_data, signature, max_len)); +} + +/** * @brief Set the pgp_signature of the user last modifying the trajectory. * @param tng_data the trajectory of which to set the computer name. * @param signature is a string containing the pgp_signature. @@ -583,6 +762,24 @@ tng_function_status tng_last_signature_set_(tng_trajectory_t tng_data, } /** + * @brief Get the name of the forcefield used in the trajectory. + * @param tng_data the trajectory of which to get the forcefield name. + * @param name the string to fill with the name of the forcefield, + * memory must be allocated before. + * @param max_len maximum char length of the string, i.e. how much memory has + * been reserved for name. This includes \0 terminating character. + * @return TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error + * has occurred (source string longer than destination string). + */ +tng_function_status tng_forcefield_name_get(const tng_trajectory_t tng_data, + char *name, const int max_len); +tng_function_status tng_forcefield_name_get_(const tng_trajectory_t tng_data, + char *name, const int max_len) +{ + return(tng_forcefield_name_get(tng_data, name, max_len)); +} + +/** * @brief Set the name of the forcefield used in the trajectory. * @param tng_data the trajectory of which to set the forcefield name. * @param new_name is a string containing the wanted name. |