File: program.cpp

package info (click to toggle)
groops 0%2Bgit20250907%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 11,140 kB
  • sloc: cpp: 135,607; fortran: 1,603; makefile: 20
file content (52 lines) | stat: -rw-r--r-- 1,488 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/***********************************************/
/**
* @file program.cpp
*
* @brief Interface for applications in groops.
*
* @author Torsten Mayer-Guerr
* @date 2008-07-27
*
*/
/***********************************************/

// define GROOPS_TAGS to autogenerate tagStrings
#define GROOPS_STRINGIFY(x) ,#x
#define GROOPS_TAGS(tag_, ...)\
enum Tags {tag_, __VA_ARGS__};\
const char *tagStrings[] = {#tag_ _GROOPS_FOR_EACH(GROOPS_STRINGIFY, __VA_ARGS__)};

#include "base/import.h"
#include "config/configRegister.h"
#include "program.h"

/***********************************************/

std::vector<Program::Program*> Program::Program::programList(Program *program)
{
  static std::vector<Program*> list;
  if(program != nullptr)
    list.push_back(program);
  return list;
}

/***********************************************/

// sort programlist according to first tag, followed by alphabetical order of names
void Program::Program::sortList(std::vector<Program*> &list)
{
  std::sort(list.begin(), list.end(), [](Program *a, Program *b) {return (a->tags().at(0) != b->tags().at(0)) ? (a->tags().at(0) < b->tags().at(0)) : (a->name() < b->name());});
}

/***********************************************/

std::vector<Program::RenamedProgram::Renamed>
  Program::RenamedProgram::renamedList(const Renamed &renamed)
{
  static std::vector<Renamed> list;
  if(!renamed.oldName.empty())
    list.push_back(renamed);
  return list;
}

/***********************************************/