| Directory: | ./ |
|---|---|
| File: | pdserv-1.1.0/src/Variable.cpp |
| Date: | 2025-11-02 04:09:49 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 6 | 6 | 100.0% |
| Branches: | 5 | 6 | 83.3% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * $Id$ | ||
| 4 | * | ||
| 5 | * Copyright 2010 Richard Hacker (lerichi at gmx dot net) | ||
| 6 | * | ||
| 7 | * This file is part of the pdserv library. | ||
| 8 | * | ||
| 9 | * The pdserv library is free software: you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU Lesser General Public License as published | ||
| 11 | * by the Free Software Foundation, either version 3 of the License, or (at | ||
| 12 | * your option) any later version. | ||
| 13 | * | ||
| 14 | * The pdserv library is distributed in the hope that it will be useful, but | ||
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
| 17 | * License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU Lesser General Public License | ||
| 20 | * along with the pdserv library. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | * | ||
| 22 | *****************************************************************************/ | ||
| 23 | |||
| 24 | #include "Variable.h" | ||
| 25 | #include "DataType.h" | ||
| 26 | |||
| 27 | #include <stdint.h> | ||
| 28 | #include <sstream> | ||
| 29 | |||
| 30 | using namespace PdServ; | ||
| 31 | |||
| 32 | ////////////////////////////////////////////////////////////////////// | ||
| 33 | ////////////////////////////////////////////////////////////////////// | ||
| 34 | 120 | Variable::Variable( | |
| 35 | const std::string& path, | ||
| 36 | const DataType& dtype, | ||
| 37 | size_t ndims, | ||
| 38 | 120 | const size_t *dim): | |
| 39 | path(path), | ||
| 40 | dtype(dtype), | ||
| 41 | dim(dim ? ndims : 1, dim ? dim : &ndims), | ||
| 42 |
5/6✓ Branch 8 taken 110 times.
✓ Branch 9 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 11 taken 110 times.
✓ Branch 13 taken 120 times.
✗ Branch 14 not taken.
|
120 | memSize(this->dim.nelem * dtype.size) |
| 43 | { | ||
| 44 | 120 | } | |
| 45 | |||
| 46 | ////////////////////////////////////////////////////////////////////// | ||
| 47 | 60 | Variable::~Variable() | |
| 48 | { | ||
| 49 | 60 | } | |
| 50 | |||
| 51 | // ////////////////////////////////////////////////////////////////////// | ||
| 52 | // void Variable::print(std::ostream& os, const char *data, size_t nelem) const | ||
| 53 | // { | ||
| 54 | // dtype.print(os, data, dim.nelem | ||
| 55 | // if (!nelem) | ||
| 56 | // nelem = 1; | ||
| 57 | // | ||
| 58 | // char delim = '\0'; | ||
| 59 | // | ||
| 60 | // log_debug("%s = %zu %zu", path.c_str(), dim.nelem, nelem); | ||
| 61 | // while (nelem--) { | ||
| 62 | // | ||
| 63 | // if (delim) | ||
| 64 | // os << delim; | ||
| 65 | // delim = ';'; | ||
| 66 | // | ||
| 67 | // dtype.print(os, data, 1); //dim.nelem); | ||
| 68 | // | ||
| 69 | // data += memSize; | ||
| 70 | // } | ||
| 71 | // } | ||
| 72 |