load.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * The University of Tokyo
8  */
9 /*
10  * load.cpp
11  * Create: Katsu Yamane, 03.12.02
12  */
13 
14 #include "chain.h"
15 
16 #define DEFAULT_LEX_LINE_BUFFER_SIZE (64*1024)
17 
18 void ClearBuffer();
19 void ChainMakeLexerBuffers(int lexBufferSize, int lineBufferSize);
20 void ChainSetInputFile(FILE *fp);
21 int chparse();
23 void SetCharName(const char* chname);
24 void SetChain(Chain* ch);
25 
26 int Chain::Load(const char* fname, const char* charname)
27 {
28  ClearBuffer();
29  FILE* fp = fopen(fname, "r");
30  if(!fp)
31  {
32  cerr << "Chain::Load- error: failed to open " << fname << " to read" << endl;
33  return -1;
34  }
35 
36  fseek(fp, 0, SEEK_END);
37  int lexBufferSize = ftell(fp);
38  fseek(fp, 0, SEEK_SET);
40 
41  if(charname && strcmp(charname, ""))
42  SetCharName(charname);
43  SetChain(this);
44 
46  int ret = chparse();
47 
49  fclose(fp);
50 
51 // Dump(cout);
52  return ret;
53 }
int chparse()
void ChainDeleteLexerBuffers()
void ChainSetInputFile(FILE *fp)
#define SEEK_END
Definition: zconf.h:298
void ClearBuffer()
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
int Load(const char *fname, const char *charname=0)
Load the chain from a file in original (*.prm) format.
Definition: load.cpp:26
png_FILE_p fp
Definition: png.h:1951
void SetCharName(const char *chname)
#define SEEK_SET
Definition: jmemansi.c:26
void ChainMakeLexerBuffers(int lexBufferSize, int lineBufferSize)
Classes for defining open/closed kinematic chains.
The class representing the whole mechanism. May contain multiple characters.
Definition: chain.h:144
void SetChain(Chain *ch)
#define DEFAULT_LEX_LINE_BUFFER_SIZE
Definition: load.cpp:16


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:24