Sebastián Pastor / EtheriosCloudConnector
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rci_binary_element.h Source File

rci_binary_element.h

00001 /*
00002  * Copyright (c) 2013 Digi International Inc.,
00003  * All rights not expressly granted are reserved.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
00007  * You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
00010  * =======================================================================
00011  */
00012 
00013 #define ELEMENT_ID_VARIABLE(rci)        ((rci)->shared.element.id)
00014 #define set_element_id(rci, value)      (ELEMENT_ID_VARIABLE(rci) = (value))
00015 #define get_element_id(rci)             (ELEMENT_ID_VARIABLE(rci))
00016 #define invalidate_element_id(rci)      set_element_id(rci, INVALID_ID)
00017 #define have_element_id(rci)            (get_element_id(rci) != INVALID_ID)
00018 
00019 static connector_group_element_t const * get_current_element(rci_t const * const rci)
00020 {
00021     ASSERT(have_group_id(rci));
00022     ASSERT(have_element_id(rci));
00023 
00024     {
00025         connector_group_t const * const group = get_current_group(rci);
00026         unsigned int const id = get_element_id(rci);
00027 
00028         ASSERT(id < group->elements.count);
00029 
00030         return (group->elements.data + id);
00031     }
00032 }
00033