当前位置: 首页>>代码示例>>C++>>正文


C++ DATA函数代码示例

本文整理汇总了C++中DATA函数的典型用法代码示例。如果您正苦于以下问题:C++ DATA函数的具体用法?C++ DATA怎么用?C++ DATA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DATA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

PaceOutput ExternalReader::establishPACEChannelNative(const PaceInput &input)
{
	PaceOutput paceoutput;

	if (m_hDoPACE) {
		enum PinID pinid = PI_UNDEF;
		switch (input.get_pin_id()) {
			case PaceInput::pin:
				pinid = PI_PIN;
				break;
			case PaceInput::can:
				pinid = PI_CAN;
				break;
			case PaceInput::mrz:
				pinid = PI_MRZ;
				break;
			case PaceInput::puk:
				pinid = PI_PUK;
				break;
			default:
				eCardCore_warn(DEBUG_LEVEL_CARD, "Unknown type of secret");
				break;
		}
		const nPADataBuffer_t pin = {
			(unsigned char *) DATA(input.get_pin()),
			input.get_pin().size()};
		const nPADataBuffer_t chat = {
			(unsigned char *) DATA(input.get_chat()),
			input.get_chat().size()};
		const nPADataBuffer_t chat_required = {
			(unsigned char *) DATA(input.get_chat_required()),
			input.get_chat_required().size()};
		const nPADataBuffer_t chat_optional = {
			(unsigned char *) DATA(input.get_chat_optional()),
			input.get_chat_optional().size()};
		const nPADataBuffer_t certificate_description = {
			(unsigned char *) DATA(input.get_certificate_description()),
			input.get_certificate_description().size()};
		const nPADataBuffer_t transaction_info_hidden = {
			(unsigned char *) DATA(input.get_transaction_info_hidden()),
			input.get_transaction_info_hidden().size()};
		unsigned int result;
		unsigned short status_mse_set_at;
		nPADataBuffer_t ef_cardaccess = {NULL, 0};
		nPADataBuffer_t car_curr = {NULL, 0};
		nPADataBuffer_t car_prev = {NULL, 0};
		nPADataBuffer_t id_icc = {NULL, 0};
		nPADataBuffer_t chat_used = {NULL, 0};

		if (ECARD_SUCCESS == m_hDoPACE(m_hCardReader, pinid, &pin, &chat,
					&chat_required, &chat_optional, &certificate_description,
					&transaction_info_hidden, &result, &status_mse_set_at,
					&ef_cardaccess, &car_curr, &car_prev, &id_icc, &chat_used)) {
			paceoutput.set_result(result);
			paceoutput.set_status_mse_set_at(status_mse_set_at);
			paceoutput.set_ef_cardaccess(buffer2vector(&ef_cardaccess));
			paceoutput.set_car_curr(buffer2vector(&car_curr));
			paceoutput.set_car_prev(buffer2vector(&car_prev));
			paceoutput.set_id_icc(buffer2vector(&id_icc));
			paceoutput.set_chat(buffer2vector(&chat_used));

			free(car_curr.pDataBuffer);
			free(car_prev.pDataBuffer);
			free(ef_cardaccess.pDataBuffer);
			free(id_icc.pDataBuffer);
			free(chat_used.pDataBuffer);
		} else
			eCardCore_warn(DEBUG_LEVEL_CARD, "external PACE failed");
	}

    return paceoutput;
}
开发者ID:mockingbird2,项目名称:eIDClientCore,代码行数:72,代码来源:ExternalReader.cpp

示例2: initSSL

IoSecureServer *IoSecureServer_proto(void *state)
{
	initSSL();
	
	IoObject *self = IoObject_new(state);
	
	IoObject_tag_(self, IoSecureServer_newTag(state));
	
	IoObject_setDataPointer_(self, (SecureServerData *)calloc(1, sizeof(SecureServerData)));
	SSL_CTX *ctx = SSL_CTX_new(TLSv1_server_method());
	DATA(self)->ssl_ctx = ctx;
	SSL_CTX_set_default_passwd_cb(ctx, IoSecureSockets_Password_Callback);
	SSL_CTX_set_default_passwd_cb_userdata(ctx, self);
	SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, IoSecureSockets_Verify_Callback);
	
	#ifdef DTLS_IMPLEMENTED
	IoObject_setSlot_to_(self, IOSYMBOL("supportsDTLS"), IOTRUE(self));
	#else
	IoObject_setSlot_to_(self, IOSYMBOL("supportsDTLS"), IOFALSE(self));
	#endif
	//doc SecureServer supportsDTLS Returns true if server supports DTLS, false otherwise.

	IoState_registerProtoWithFunc_((IoState *)state, self, IoSecureServer_proto);
	
	{
		IoMethodTable methodTable[] = {
		{"setKeyFile", IoSecureServer_setKeyFile},
		//doc SecureServer setKeyFile(path) Sets the key file. Returns self.
		
		{"setCertFile", IoSecureServer_setCertFile},
		//doc SecureServer setCertFile(path) Sets the certificate file. Returns self.
		
		{"setCAFile", IoSecureServer_setCAFile},
		//doc SecureServer setCAFile(path) Sets the CA file. Returns self.
		
		{"setCRLFile", IoSecureServer_setCRLFile},
		//doc SecureServer setCRLFile(path) Sets the CRL file. Returns self.
		
		{"useTLS", IoSecureServer_useTLS},
		//doc SecureServer useTLS Returns useTLS value.

		{"useDTLS", IoSecureServer_useDTLS},
		//doc SecureServer useDTLS Returns useDTLS value.

		{"setRequiresClientCertificate", IoSecureServer_setRequiresClientCertificate},
		//doc SecureServer setRequiresClientCertificate(aBool) Sets the requires client certificate attribute. Returns self.
		
		{"tlsWrap", IoSecureServer_tlsWrap},
		//doc SecureServer tlsWrap Returns tlsWrap value.
		
		#ifdef DTLS_IMPLEMENTED
		{"dtlsWrap", IoSecureServer_dtlsWrap},
		//doc SecureServer dtlsWrap Returns dtlsWrap value.
		
		{"udpRecvIP", IoSecureServer_udpRecvIP},
		//doc SecureServer udpRecvIP Returns udpRecvIP value.
		
		{"dispatchUdp", IoSecureServer_dispatchUDP},
		//doc SecureServer dispatchUdp Returns dispatchUdp value.
		
		#endif
		{NULL, NULL}
		};
		IoObject_addMethodTable_(self, methodTable);
	}
	
	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:68,代码来源:IoSecureServer.c

示例3: IoNumber_asFloat

float IoNumber_asFloat(IoNumber *self)
{
	return (float)DATA(self);
}
开发者ID:Akiyah,项目名称:io,代码行数:4,代码来源:IoNumber.c

示例4: IONUMBER

IoNumber *IoNumber_numberForDouble_canUse_(IoNumber *self, double n, IoNumber *other)
{
	if (DATA(self)  == n) return self;
	if (DATA(other) == n) return other;
	return IONUMBER(n);
}
开发者ID:Akiyah,项目名称:io,代码行数:6,代码来源:IoNumber.c

示例5: IoNumber_asInt

int IoNumber_asInt(IoNumber *self)
{
	return (int)(DATA(self));
}
开发者ID:Akiyah,项目名称:io,代码行数:4,代码来源:IoNumber.c

示例6: tree23_delete

// does not check that the element is already there
static int tree23_delete (tree23_root_t *R, int x) {
  int *P = 0, *PP = 0;
  tree23_t *st[40];
  int sp, *y_Data = 0;
  tree23_t *cur = R->root, *up, *succ;
  int extra_words = R->extra_words;

  for (sp = 0; sp < R->depth; sp++) {
    st[sp] = cur;
    if (x > cur->x2) {
      cur = cur->right;
    } else if (x < cur->x1) {
      cur = cur->left;
    } else if (x == cur->x1) {
      P = &cur->x1;
      y_Data = DATA(cur->x1);
      if (cur->x2 == cur->x1) {
        PP = &cur->x2;
      }
      x++;
      break;
    } else if (x < cur->x2) {
      cur = cur->middle;
    } else {
      P = &cur->x2;
      y_Data = DATA(cur->x2);
      x++;
      break;
    }
  }

  // if x belongs to an inner node:
  // - P points to the key equal to (original) x in node cur
  // - PP points to cur->x2 if cur->x2 = cur->x1 = (original) x
  // - x equals original x+1 for some reason
  // if x is in a leaf, cur is this leaf, and P=PP=0

  while (sp < R->depth) {
    st[sp++] = cur;
    if (x < cur->x1) {
      cur = cur->left;   // actually will go left at all steps except the first one
    } else if (x > cur->x2) {
      cur = cur->right;
    } else {
      cur = cur->middle;
    }
  }

  // now cur is the leaf containing next value after (original) x, if x was in a inner node
  // otherwise, cur is the leaf containing x

  if (P) {
    // case 1: x was found in some inner node, ancestor of leaf cur
    // then x':=cur->x1 is the next value in tree after x
    // and we replace references to x with references to x'
    *P = cur->x1;
    if (PP) {
      *PP = cur->x1;
    }
    DCPY (y, cur->x1); // copy extra data words as well
    // after that, we just need to remove x' from leaf node cur
    if (cur->x1 < cur->x2) {
      // case 1a: cur: [ x' y ] , replace with [ y ]
      LET (cur->x1, cur->x2);
      return 1;
    }
  } else if (x == cur->x1) {
    if (x < cur->x2) {
      // case 0a: x was found in leaf cur: [ x y ], x < y
      // replace with [ y ]
      LET (cur->x1, cur->x2);
      return 1;
    }
  } else if (x == cur->x2) {
    // case 0b: x was found in leaf cur: [ u x ], u < x
    // simply replace it with [ u ]
    cur->x2 = cur->x1;
    return 1;
  } else {
    // x NOT FOUND in tree (?)
    return 0;
  }

  // here we have to remove x' from leaf node cur: [ x' ]

  //oh, no...
  //printf ("%d\n", sp);
  if (sp == 0) {
    // we are deleting the root!
    free_leaf (cur, Extra_words);
    R->root = 0;
    return 1;
  }

  up = st[--sp];
  // up is the parent of leaf cur: [ x' ]  ( we are deleting x': "cur --> []")
  if (up->right == cur) {
    if (IS_2N(up)) {
      // up: [ (left) x1 cur:[ x' ] ]
//.........这里部分代码省略.........
开发者ID:AbramovVitaliy,项目名称:kphp-kdb,代码行数:101,代码来源:23tree_nd.c

示例7: yajl_gen_map_close

IoObject *IoYajlGen_closeMap(IoYajlGen *self, IoObject *locals, IoMessage *m)
{
	yajl_gen_map_close(DATA(self));
	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:5,代码来源:IoYajlGen.c

示例8: main

int
main(int argc, char **argv)
{
    int c = 0;
    llist_t* list = 0;
    node_t* aux = 0;


    list = ll_create();
    ll_initialize(list, free, compare_int_data);

    /* 0...9 */
    for(; c < 10; c++)
        ll_add_last(list, create_node( create_int_data(c) ) );

    /* 10 0...9 */
    ll_add_first(list, create_node( create_int_data(c) ) );

    /* 11 10 0...9 */
    ll_add_first(list, create_node( create_int_data(++c) ) );

    /* 11 10 12 0...9 */
    ll_add_before(list, list->first->next->next, create_node( create_int_data(++c) ) );

    /* 11 10 12 0...8 13 9 */
    ll_add_after(list, list->last->prev, create_node( create_int_data(++c) ));

    /* 11 10 12 0...8 13 14 9 */
    ll_add_after(list, list->last->prev, create_node( create_int_data(++c) ));

    /* 11 12 0...8 13 14 9	*/
    ll_remove(list, list->first->next, DESTROYNODE );

    /* 11 12 0...8 13 14 */
    ll_remove(list, list->last, DESTROYNODE);

    /* 12 0...8 13 14 */
    ll_remove(list, list->first, DESTROYNODE);

    /* to test "NOTDESTROY" option*/
    aux = list->last->prev;

    /* 12 0...8 14 */
    ll_remove(list, list->last->prev, NOTDESTROY);

    printf("\n");

    /* Forward: 12 0...8 14	*/
    ll_traverse(list, print_int_data, FORWARDTRAVERSE);
    printf("\n");

    /* Backward: 14 8...0 12 */
    ll_traverse(list, print_int_data, BACKWARDTRAVERSE);
    printf("\n\n");

    /* Destroy node	"13"*/
    free_node(aux, list->free_data);
    printf("\n");

    /* Deleted node, is not found*/
    int a = 10;
    aux = ll_search_node(list, &a);

    if(aux != NULL)
        printf("NODE: %p DATA: %d\n", aux ,*(int*)DATA(aux));

    a = 4;
    aux = ll_search_node(list, &a);

    if(aux != NULL)
        printf("NODE: %p DATA: %d\n", aux ,*(int*)DATA(aux));


    ll_free(list);
    list = 0;
    return EXIT_SUCCESS;
}
开发者ID:rgcr,项目名称:dsrc,代码行数:77,代码来源:example_ll.c

示例9: tree23_insert

// does not check whether the element is already there
static void tree23_insert (tree23_root_t *R, int x, int *Data) {
  tree23_t *st[40];
  int x_Data[8];
  tree23_t *cur, *s, *l;
  int sp, extra_words = R->extra_words;

#define Extra_words	extra_words
#define x1_Data		extra-Extra_words
#define x2_Data		extra-Extra_words*2
#define DATA(__x)	(__x##_Data)
#define	CPY(__x,__y)	{if(Extra_words>0) {memcpy(__x,__y,Extra_words*4);}}
#define DCPY(__x,__y)	CPY(DATA(__x),DATA(__y))
#define	LET(__x,__y)	{__x = __y; DCPY(__x,__y);}
#define IS_2N(__t)	((__t)->x1 == (__t)->x2)
#define IS_3N(__t)	(!IS_2N(__t))
#define LEAF(__t)	((tree23_leaf_t *)(__t))

  //empty tree case
  if (!R->root) {
    R->root = new_leaf (x, extra_words);
    CPY(DATA(R->root->x1), Data);
    R->depth = 0;
    return;
  }

  sp = 0;
  cur = R->root;
  while (sp < R->depth) {
    st[sp++] = cur;
    if (x < cur->x1) {
      cur = cur->left;
    } else if (x > cur->x2) {
      cur = cur->right;
    } else {
      cur = cur->middle;
    }
  }
  
  //leaf split
  if (IS_3N(cur)) {
    //case 1. two-element leaf: have cur:[ B D ]
    if (x < cur->x1) {
      // cur:[ B D ] + x:A --> [ A B D ] --> (new)s:[ A ] new_x:B (cur)l:[ D ]
      s = new_leaf (x, Extra_words);
      CPY (DATA(s->x1), Data)
      LET (x, cur->x1);
      LET (cur->x1, cur->x2);
      l = cur;
    } else if (x > cur->x2) {
      // cur:[ B D ] + x:E --> [ A D E ] --> (cur)s:[ B ] new_x:D (new)l:[ E ]
      l = new_leaf (x, Extra_words);
      CPY (DATA(l->x1), Data)
      LET (x, cur->x2)
      cur->x2 = cur->x1;
      s = cur;
    } else {
      // cur:[ B D ] + x:C --> [ A C E ] --> (cur)s:[ B ] new_x:C (new)l:[ D ]
      l = new_leaf (cur->x2, Extra_words);
      CPY (DATA(l->x1), DATA(cur->x2))
      CPY (DATA(x), Data);
      cur->x2 = cur->x1;
      s = cur;
    }
  } else {
    //case 2. single-element leaf:  have cur:[ B ]
    if (x < cur->x1) {
      // cur:[ B ] + x:A --> cur:[ A B ]
      LET (cur->x2, cur->x1);
      cur->x1 = x;
      CPY (DATA(cur->x1), Data);
    } else {
      // cur:[ B ] + x:C --> cur:[ B C ]
      cur->x2 = x;
      CPY (DATA(cur->x2), Data);
    }
    return;
  }

  while (sp) {
    cur = st[--sp];
    // here cur is a parent node cur: [ ... old_cur:[.E.G.] ... ]
    // we are replacing its subtree [.E.G.] with two: s:[.E.] x:F l:[.G.]
    if (IS_3N(cur)) {
      //case 1. two-element internal node
      // cur: [ (left) x1 (middle) x2 (right) ]
      if (x < cur->x1) {
        // s l middle right
        // cur: [ old_cur:[.E.G.] x1:H [.I.] x2:J [.K.] ]
        // -->  [ s:[.E.] x:F l:[.G.] x1:H [.I.] J [.K.] ]
        // -->  (new)new_s:[ s:[.E.] x:F l:[.G.] ] new_x:H (cur)new_l:[ [.I.] J [.K.] ]
        s = new_node2 (x, s, l, Extra_words);
        DCPY(s->x1, x);
        LET (x, cur->x1);
        LET (cur->x1, cur->x2);
        cur->left = cur->middle;
        l = cur;
      } else
      if (x > cur->x2) {
        // left middle s l
//.........这里部分代码省略.........
开发者ID:AbramovVitaliy,项目名称:kphp-kdb,代码行数:101,代码来源:23tree_nd.c

示例10: MODULE_ID

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

/***************************************************************************
* Module m_request_name                                                    *
* Routines to handle external names of menu requests                       *
***************************************************************************/

#include "menu.priv.h"

MODULE_ID("$Id: m_req_name.c,v 1.23 2015/04/04 18:00:23 tom Exp $")

#define DATA(s) { s }

static const char request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1][14] =
{
  DATA("LEFT_ITEM"),
  DATA("RIGHT_ITEM"),
  DATA("UP_ITEM"),
  DATA("DOWN_ITEM"),
  DATA("SCR_ULINE"),
  DATA("SCR_DLINE"),
  DATA("SCR_DPAGE"),
  DATA("SCR_UPAGE"),
  DATA("FIRST_ITEM"),
  DATA("LAST_ITEM"),
  DATA("NEXT_ITEM"),
  DATA("PREV_ITEM"),
  DATA("TOGGLE_ITEM"),
  DATA("CLEAR_PATTERN"),
  DATA("BACK_PATTERN"),
  DATA("NEXT_MATCH"),
开发者ID:Scarletts,项目名称:LiteBSD,代码行数:31,代码来源:m_req_name.c

示例11: IoObject_rawClonePrimitive

IoCFFIArray *IoCFFIArray_rawClone(IoCFFIArray *proto)
{
	IoObject *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, io_calloc(1, sizeof(IoCFFIArrayData)));
	memset(DATA(self), 0, sizeof(IoCFFIArrayData));

	IoObject* arrayType = IoObject_getSlot_(proto, IOSYMBOL("arrayType"));

	if ( !ISNIL(arrayType) ) {
		DATA(self)->ffiType = DATA(proto)->ffiType;
		DATA(self)->itemSize = DATA(proto)->itemSize;
		DATA(self)->arraySize = DATA(proto)->arraySize;
		DATA(self)->buffer = io_calloc(DATA(self)->arraySize, DATA(self)->itemSize);
		DATA(self)->needToFreeBuffer = 1;
	}
	return self;
}
开发者ID:akimd,项目名称:io,代码行数:17,代码来源:IoCFFIArray.c

示例12: IONUMBER

IoNumber *IoCFFIArray_size(IoCFFIArray *self, IoObject *locals, IoMessage *m)
{
	return IONUMBER(DATA(self)->arraySize);
}
开发者ID:akimd,项目名称:io,代码行数:4,代码来源:IoCFFIArray.c

示例13: dag_get_dropped_packets

/* Gets the number of dropped packets */
static uint64_t dag_get_dropped_packets(libtrace_t *trace)
{
	if (!trace->format_data)
		return (uint64_t)-1;
	return DATA(trace)->drops;
}
开发者ID:EaseTheWorld,项目名称:libtrace,代码行数:7,代码来源:format_dag24.c

示例14: yajl_gen_array_close

IoObject *IoYajlGen_closeArray(IoYajlGen *self, IoObject *locals, IoMessage *m)
{
	yajl_gen_array_close(DATA(self));
	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:5,代码来源:IoYajlGen.c

示例15: IoObject_rawClonePrimitive

IoNumber *IoNumber_rawClone(IoNumber *proto)
{
	IoObject *self = IoObject_rawClonePrimitive(proto);
	DATA(self) = DATA(proto);
	return self;
}
开发者ID:Akiyah,项目名称:io,代码行数:6,代码来源:IoNumber.c


注:本文中的DATA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。