⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cms.hh

📁 CNC 的开放码,EMC2 V2.2.8版
💻 HH
📖 第 1 页 / 共 2 页
字号:
/********************************************************************* Description: cms.hh*   C++ Header file for the Communication Management System (CMS).**   Derived from a work by Fred Proctor & Will Shackleford** Author:* License: LGPL Version 2* System: Linux*    * Copyright (c) 2004 All rights reserved.** Last change: * $Revision: 1.9 $* $Author: jepler $* $Date: 2007/03/22 22:15:35 $********************************************************************/#ifndef CMS_HH#define CMS_HH#ifdef __cplusplusextern "C" {#endif#include <stddef.h>		/* size_t */#ifdef __cplusplus}#endif#include "cms_cfg.hh"		/* CMS_CONFIG_LINELEN */class PHYSMEM_HANDLE;class PM_CARTESIAN;class PM_CYLINDRICAL;class PM_EULER_ZYX;class PM_EULER_ZYZ;class PM_HOMOGENEOUS;class PM_POSE;class PM_QUATERNION;class PM_ROTATION_MATRIX;class PM_ROTATION_VECTOR;class PM_RPY;class PM_SPHERICAL;class LinkedList;enum CMS_STATUS {/* ERROR conditions */    CMS_MISC_ERROR = -1,	/* A miscellaneous error occured. */    CMS_UPDATE_ERROR = -2,	/* An error occured during an update. */    CMS_INTERNAL_ACCESS_ERROR = -3,	/* An error occured during an					   internal access function. */    CMS_NO_MASTER_ERROR = -4,	/* An error occured becouse the master was				   not started */    CMS_CONFIG_ERROR = -5,	/* There was an error in the configuration */    CMS_TIMED_OUT = -6,		/* operation timed out. */    CMS_QUEUE_FULL = -7,	/* A write failed because queuing was enabled 				   but there was no room to add to the queue. 				 */    CMS_CREATE_ERROR = -8,	/* Something could not be created.  */    CMS_PERMISSIONS_ERROR = -9,	/* Problem with permissions */    CMS_NO_SERVER_ERROR = -10,	/* The server has not been started or could				   not be contacted. */    CMS_RESOURCE_CONFLICT_ERROR = -11,	/* Two or more CMS buffers are trying 					   to use the same resource. */    CMS_NO_IMPLEMENTATION_ERROR = -12,	/* An operation was attempted which					   has not yet been implemented for					   the current platform or protocol. */    CMS_INSUFFICIENT_SPACE_ERROR = -13,	/* The size of the buffer was					   insufficient for the requested					   operation. */    CMS_LIBRARY_UNAVAILABLE_ERROR = -14,	/* A DLL or Shared Object						   library needed for the						   current protocol could not 						   be found or initialized. */    CMS_SERVER_SIDE_ERROR = -15,	/* The server reported an error. */    CMS_NO_BLOCKING_SEM_ERROR = -16,	/* A blocking_read operartion was					   tried but no semaphore for the					   blocking was configured or					   available. *//* NON Error Conditions.*/    CMS_STATUS_NOT_SET = 0,	/* The status variable has not been set yet. */    CMS_READ_OLD = 1,		/* Read successful, but data is old. */    CMS_READ_OK = 2,		/* Read successful so far. */    CMS_WRITE_OK = 3,		/* Write successful so far. */    CMS_WRITE_WAS_BLOCKED = 4,	/* Write if read did not succeed, because the 				   buffer had not been read yet. */    CMS_CLEAR_OK = 5,		/* A clear operation was successful.  */    CMS_CLOSED = 6		/* The channel has been closed.  */};/* Mode used within update functions. */enum CMSMODE {    CMS_NOT_A_MODE = 0,    CMS_ENCODE,    CMS_DECODE,    CMS_RAW_OUT,    CMS_RAW_IN,    CMS_READ,    CMS_WRITE};typedef long int CMSID;/* Mode stored for use by the internal access function. */enum CMS_INTERNAL_ACCESS_TYPE {    CMS_ZERO_ACCESS = 0,    CMS_READ_ACCESS,    CMS_CHECK_IF_READ_ACCESS,    CMS_PEEK_ACCESS,    CMS_WRITE_ACCESS,    CMS_WRITE_IF_READ_ACCESS,    CMS_CLEAR_ACCESS,    CMS_GET_MSG_COUNT_ACCESS,    CMS_GET_DIAG_INFO_ACCESS,    CMS_GET_QUEUE_LENGTH_ACCESS,    CMS_GET_SPACE_AVAILABLE_ACCESS};/* What type of global memory buffer. */enum CMS_BUFFERTYPE {    CMS_SHMEM_TYPE,    CMS_PHANTOM_BUFFER,    CMS_LOCMEM_TYPE,    CMS_FILEMEM_TYPE,};/* How will this process access the buffer. */enum CMS_PROCESSTYPE {    CMS_REMOTE_TYPE,    CMS_LOCAL_TYPE,    CMS_PHANTOM_USER,    CMS_AUTO_TYPE};enum CMS_REMOTE_PORT_TYPE {    CMS_NO_REMOTE_PORT_TYPE = 0,    CMS_TTY_REMOTE_PORT_TYPE,    CMS_TCP_REMOTE_PORT_TYPE,    CMS_STCP_REMOTE_PORT_TYPE,    CMS_UDP_REMOTE_PORT_TYPE};/* This structure will be placed at the beginning of every CMS buffer. */struct CMS_HEADER {    long was_read;		/* Has the buffer been read since the last				   write? */    long write_id;		/* Id of last write. */    long in_buffer_size;	/* How much of the buffer is currently used. */};class CMS_DIAG_PROC_INFO;class CMS_DIAG_HEADER;class CMS_DIAGNOSTICS_INFO;struct CMS_QUEUING_HEADER {    long head;    long tail;    long queue_length;    long end_queue_space;    long write_id;};enum CMS_NEUTRAL_ENCODING_METHOD {    CMS_NO_ENCODING,    CMS_XDR_ENCODING,    CMS_ASCII_ENCODING,    CMS_DISPLAY_ASCII_ENCODING};/* CMS class declaration. */class CMS;class CMS_UPDATER;/* CMS class definition. */class CMS {  public:    void *operator                         new(size_t);    void operator                         delete(void *);  public:    /* Constructors and Destructors. */      CMS(long size);      CMS(char *bufline, char *procline, int set_to_server = 0);      virtual ~ CMS();    /* Simple read/write interface functions. */    virtual CMS_STATUS clear();	/* Has the buffer been read recently? */    virtual int check_if_read();	/* Has the buffer been read recently? 					 */    virtual int get_msg_count();	/* Has the buffer been read recently? 					 */    virtual CMS_STATUS read();	/* Read from buffer. */    virtual CMS_STATUS blocking_read(double _timeout);	/* Read from buffer,							   wait for new data. 							 */    virtual CMS_STATUS peek();	/* Read without setting flag. */    virtual CMS_STATUS write(void *user_data);	/* Write to buffer. */    virtual CMS_STATUS write_if_read(void *user_data);	/* Write to buffer. */    virtual int login(const char *name, const char *passwd);    virtual void reconnect();    virtual void disconnect();    virtual int get_queue_length();    virtual int get_space_available();    /* Protocol Defined Virtual Function Stubs. */    virtual CMS_STATUS main_access(void *_local);    /* Neutrally Encoded Buffer positioning functions. */    void rewind();		/* positions at beginning */    int get_encoded_msg_size();	/* Store last position in header.size */    /* Buffer access control functions. */    void set_mode(CMSMODE im);	/* Determine read/write mode.(check neutral) */    /* Select a temporary updator -- This is used by the nml msg2string and       string2msg functions. */    void set_temp_updater(CMS_NEUTRAL_ENCODING_METHOD);    /* Restore the normal update. */    void restore_normal_updater();  /*******************************************************/    /* CMS INTERNAL ACCESS FUNCTIONS located in cms_in.cc */  /*******************************************************/    CMS_STATUS internal_access(PHYSMEM_HANDLE * _global, void *_local);    CMS_STATUS internal_access(void *_global, long global_size, void *_local);    CMS_STATUS internal_clear();	/* Zero the global memory.  */    int check_if_read_raw();    int check_if_read_encoded();    int get_msg_count_raw();    int get_msg_count_encoded();    CMS_STATUS read_raw();	/* Read from raw buffers. */    CMS_STATUS read_encoded();	/* Read from neutrally encoded buffers. */    CMS_STATUS peek_raw();	/* Read without setting flags. */    CMS_STATUS peek_encoded();	/* Read without setting flags. */    CMS_STATUS write_raw(void *user_data);	/* Write to raw buffers. */    CMS_STATUS write_encoded();	/* Write to neutrally encoded buffers. */    CMS_STATUS write_if_read_raw(void *user_data);	/* Write if read. */    CMS_STATUS write_if_read_encoded();	/* Write if read. */    int queue_check_if_read_raw();    int queue_check_if_read_encoded();    int queue_get_msg_count_raw();    int queue_get_msg_count_encoded();    int queue_get_queue_length_raw();    int queue_get_queue_length_encoded();    int queue_get_space_available_raw();    int queue_get_space_available_encoded();    CMS_STATUS queue_read_raw();	/* Read from raw buffers. */    CMS_STATUS queue_read_encoded();	/* Read from neutral buffers. */    CMS_STATUS queue_peek_raw();	/* Read without setting flags. */    CMS_STATUS queue_peek_encoded();	/* Read without setting flags. */    CMS_STATUS queue_write_raw(void *user_data);	/* Write to raw bufs */    CMS_STATUS queue_write_encoded();	/* Write to neutral buffers. */    CMS_STATUS queue_write_if_read_raw(void *user_data);    CMS_STATUS queue_write_if_read_encoded();	/* Write if read. */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -